07-25-2018, 04:39 AM
So how are we going to implement block states?
...in the protocol...
Does this introduce way too much overhead? It certainly looks nice...
class Block
{
string GetName();
JsonSomething GetProperties();
bool operator==(Block lhs, BlockIdentifier rhs);
private:
BlockIdentifier id;
}
class Piston : public Block
{
int Facing;
bool Extended;
bool Sticky;
string GetName() { return "minecraft:piston"; }
JsonSomething GetProperties { return {{"facing", "west"}, {"extended", false}}; }
}
...in the protocol...
Block actuallyapiston = ...; GlobalPalette::GetId(actuallyapiston.GetName(), actuallyapiston.GetProperties()); // returns e.g. 1547
Does this introduce way too much overhead? It certainly looks nice...
Block thing = World.GetBlock(State?)(Pos); if (thing != BlockIdentifier::Piston) return; ((Piston)thing).Sticky = false; World.SetBlockState(Pos, thing);

