Random Chitchat 2018
#25
I think it'd be better to have each chunk's section contain an array of VirtualBlockType (a number) plus a Palette object that provides the mapping of VirtualBlockType -> BlockTypeWithParams class instance.
BlockTypeWithParams stores the block's type (piston / grass / torch / ...) and parameters ("facing=west, powered=true, ..."). So if a piston gets extended, it receives a different VirtualBlockType from the section's Palette and the section remembers the new number. This is much better than allocating a separate object for each and every block in the world.

The Palette class manages the mapping - if a new BlockTypeWithParams is to be set in the section, it is assigned a new number; rather than removing a mapping when all of its instances are removed (-> holes in the numbers sequence, would need defragmenting), it should cooperate with the section to provide a "garbage collect" operation that would clean up the unused numbers and re-sequence the rest.

This is a huge undertaking and will break things across all of Cuberite, no idea how to tackle that sequentially, so that it's reviewable as PRs.
Thanks given by:


Messages In This Thread
Random Chitchat 2018 - by xoft - 01-02-2018, 03:15 PM
RE: Random Chitchat 2018 - by ShadowCone - 01-02-2018, 05:01 PM
RE: Random Chitchat 2018 - by xoft - 01-14-2018, 09:21 AM
RE: Random Chitchat 2018 - by ShadowCone - 01-14-2018, 09:00 PM
RE: Random Chitchat 2018 - by xoft - 01-15-2018, 01:26 PM
RE: Random Chitchat 2018 - by ShadowCone - 01-16-2018, 06:41 AM
RE: Random Chitchat 2018 - by xoft - 01-16-2018, 05:57 PM
RE: Random Chitchat 2018 - by Mathias - 01-28-2018, 12:59 AM
RE: Random Chitchat 2018 - by peterbell10 - 01-28-2018, 08:50 AM
RE: Random Chitchat 2018 - by tonibm19 - 03-12-2018, 11:33 PM
RE: Random Chitchat 2018 - by xoft - 03-15-2018, 06:06 PM
RE: Random Chitchat 2018 - by xoft - 05-01-2018, 07:01 AM
RE: Random Chitchat 2018 - by Mathias - 05-16-2018, 07:33 AM
RE: Random Chitchat 2018 - by xoft - 05-01-2018, 07:58 AM
RE: Random Chitchat 2018 - by yangm97 - 06-19-2018, 05:03 PM
RE: Random Chitchat 2018 - by ShadowCone - 06-20-2018, 08:12 AM
RE: Random Chitchat 2018 - by Morrissey - 07-11-2018, 09:40 PM
RE: Random Chitchat 2018 - by tigerw - 07-16-2018, 06:45 AM
RE: Random Chitchat 2018 - by tigerw - 07-16-2018, 06:51 AM
RE: Random Chitchat 2018 - by peterbell10 - 07-20-2018, 07:52 AM
RE: Random Chitchat 2018 - by xoft - 07-20-2018, 05:41 PM
RE: Random Chitchat 2018 - by NiLSPACE - 07-20-2018, 10:07 PM
RE: Random Chitchat 2018 - by tigerw - 07-25-2018, 04:39 AM
RE: Random Chitchat 2018 - by NiLSPACE - 07-25-2018, 07:41 PM
RE: Random Chitchat 2018 - by xoft - 07-25-2018, 08:15 PM
RE: Random Chitchat 2018 - by tigerw - 07-26-2018, 12:43 AM
RE: Random Chitchat 2018 - by tigerw - 07-26-2018, 12:42 AM
RE: Random Chitchat 2018 - by xoft - 07-27-2018, 05:40 AM
RE: Random Chitchat 2018 - by tigerw - 07-27-2018, 10:35 PM
RE: Random Chitchat 2018 - by Mathias - 08-07-2018, 09:02 AM
RE: Random Chitchat 2018 - by xoft - 08-31-2018, 02:41 PM
RE: Random Chitchat 2018 - by NiLSPACE - 08-31-2018, 05:06 PM
RE: Random Chitchat 2018 - by ShadowCone - 09-01-2018, 06:29 AM
RE: Random Chitchat 2018 - by ThuGie - 09-01-2018, 10:16 AM
RE: Random Chitchat 2018 - by xoft - 09-03-2018, 07:41 AM
RE: Random Chitchat 2018 - by tonibm19 - 09-06-2018, 02:49 AM
RE: Random Chitchat 2018 - by xoft - 10-22-2018, 10:20 PM
RE: Random Chitchat 2018 - by NiLSPACE - 10-23-2018, 12:24 AM
RE: Random Chitchat 2018 - by tonibm19 - 12-25-2018, 09:14 PM
RE: Random Chitchat 2018 - by tigerw - 12-26-2018, 02:12 AM
RE: Random Chitchat 2018 - by ThuGie - 12-26-2018, 10:13 PM
RE: Random Chitchat 2018 - by xoft - 12-27-2018, 01:55 AM
RE: Random Chitchat 2018 - by xoft - 12-27-2018, 02:07 AM
RE: Random Chitchat 2018 - by NiLSPACE - 12-27-2018, 06:09 AM
RE: Random Chitchat 2018 - by ShadowCone - 12-28-2018, 05:25 PM
RE: Random Chitchat 2018 - by ThuGie - 12-29-2018, 09:57 AM
RE: Random Chitchat 2018 - by Mathias - 01-02-2019, 06:25 PM



Users browsing this thread: 1 Guest(s)