Suggested Move fields in Block onto Components

SoniEx2

New Member
All (or at least most) of this, from the Block class:

Code:
    // Overall behavioural
    private boolean liquid;
    private boolean attachmentAllowed = true;
    private boolean replacementAllowed;
    private int hardness = 3;
    private boolean supportRequired;
    private EnumBooleanMap<Side> fullSide = new EnumBooleanMap<>(Side.class);
    private BlockSounds sounds;

    // Special rendering flags (TODO: clean this up)
    private boolean water;
    private boolean lava;
    private boolean grass;
    private boolean ice;

    // Rendering related
    private BlockMeshGenerator meshGenerator = new BlockMeshGeneratorSingleShape(this);
    private boolean translucent;
    private boolean doubleSided;
    private boolean shadowCasting = true;
    private boolean waving;
    private byte luminance;
    private Vector3f tint = new Vector3f(0, 0, 0);
    private Map<BlockPart, BlockColorSource> colorSource = Maps.newEnumMap(BlockPart.class);
    private Map<BlockPart, Vector4f> colorOffsets = Maps.newEnumMap(BlockPart.class);

    // Collision related
    private boolean penetrable;
    private boolean targetable = true;
    private boolean climbable;

    // Physics
    private float mass = 10;
    private boolean debrisOnDestroy = true;

    // Entity integration
    private Prefab prefab;
    private boolean keepActive;
    private EntityRef entity = EntityRef.NULL;
    private boolean lifecycleEventsRequired;

    // Inventory settings
    private boolean directPickup;
    private boolean stackable = true;

    private BlockAppearance primaryAppearance = new BlockAppearance();
    // TODO: Remove once liquids have nicer generation
    private Map<Side, BlockMeshPart> loweredLiquidMesh = Maps.newEnumMap(Side.class);

    /* Collision */
    private CollisionShape collisionShape;
    private Vector3f collisionOffset;
    private AABB bounds = AABB.createEmpty();
Should be moved onto Components.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
This is easier said than done, and the goal of moving all those seems dubious.

The overall idea was to keep two systems: primitive blocks (with all the above data) to work with the majority of world blocks in an efficient fashion without having the entity system touch everything then a way smaller set of enhanced blocks with entities and special handling.

Should some pieces be moved? Yes, most likely. But that gets done when it seems sensible + when somebody wants to do so because they see a purpose to actually apply the change to. I don't support simply moving a bunch of things just to move them.
 
Top