From 2226efd7a007e7a0b1c49c8ba75ed076a5851334 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 11 Jul 2020 17:44:22 +0100 Subject: [PATCH] added base data handling for Lab Table, Compound Creator, Element Constructor and Material Reducer these also have a blockentity which needs to be implemented as well. --- src/block/BlockFactory.php | 7 ++++- src/block/ChemistryTable.php | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/block/ChemistryTable.php diff --git a/src/block/BlockFactory.php b/src/block/BlockFactory.php index e01b541e7..fd2c62203 100644 --- a/src/block/BlockFactory.php +++ b/src/block/BlockFactory.php @@ -486,6 +486,12 @@ class BlockFactory{ $this->registerElements(); + $chemistryTableBreakInfo = new BlockBreakInfo(2.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()); + $this->register(new ChemistryTable(new BID(Ids::CHEMISTRY_TABLE, Meta::CHEMISTRY_COMPOUND_CREATOR), "Compound Creator", $chemistryTableBreakInfo)); + $this->register(new ChemistryTable(new BID(Ids::CHEMISTRY_TABLE, Meta::CHEMISTRY_ELEMENT_CONSTRUCTOR), "Element Constructor", $chemistryTableBreakInfo)); + $this->register(new ChemistryTable(new BID(Ids::CHEMISTRY_TABLE, Meta::CHEMISTRY_LAB_TABLE), "Lab Table", $chemistryTableBreakInfo)); + $this->register(new ChemistryTable(new BID(Ids::CHEMISTRY_TABLE, Meta::CHEMISTRY_MATERIAL_REDUCER), "Material Reducer", $chemistryTableBreakInfo)); + //region --- auto-generated TODOs --- //TODO: minecraft:bamboo //TODO: minecraft:bamboo_sapling @@ -499,7 +505,6 @@ class BlockFactory{ //TODO: minecraft:cauldron //TODO: minecraft:chain_command_block //TODO: minecraft:chemical_heat - //TODO: minecraft:chemistry_table //TODO: minecraft:chorus_flower //TODO: minecraft:chorus_plant //TODO: minecraft:command_block diff --git a/src/block/ChemistryTable.php b/src/block/ChemistryTable.php new file mode 100644 index 000000000..d3b3d6d77 --- /dev/null +++ b/src/block/ChemistryTable.php @@ -0,0 +1,61 @@ +facing = Facing::opposite(BlockDataSerializer::readLegacyHorizontalFacing($stateMeta & 0x3)); + } + + protected function writeStateToMeta() : int{ + return BlockDataSerializer::writeLegacyHorizontalFacing(Facing::opposite($this->facing)); + } + + public function getStateBitmask() : int{ + return 0b0011; + } + + public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ + if($player !== null){ + $this->facing = Facing::opposite($player->getHorizontalFacing()); + } + return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player); + } + + public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ + //TODO + return false; + } +}