diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 3bbf1a290..943416c39 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -144,7 +144,6 @@ class Block extends Position implements Metadatable{ const SUGARCANE_BLOCK = 83; const FENCE = 85; - const FENCE_OAK = 85; const PUMPKIN = 86; const NETHERRACK = 87; const SOUL_SAND = 88; @@ -236,11 +235,6 @@ class Block extends Position implements Metadatable{ const FENCE_GATE_JUNGLE = 185; const FENCE_GATE_DARK_OAK = 186; const FENCE_GATE_ACACIA = 187; - const FENCE_SPRUCE = 188; - const FENCE_BIRCH = 189; - const FENCE_JUNGLE = 190; - const FENCE_DARK_OAK = 191; - const FENCE_ACACIA = 192; const PODZOL = 243; const BEETROOT_BLOCK = 244; @@ -368,10 +362,11 @@ class Block extends Position implements Metadatable{ [Item::WOODEN_DOOR, 0], [Item::TRAPDOOR, 0], [Item::FENCE, 0], - [Item::FENCE_SPRUCE, 0], - [Item::FENCE_BIRCH, 0], - [Item::FENCE_DARK_OAK, 0], - [Item::FENCE_JUNGLE, 0], + [Item::FENCE, 1], + [Item::FENCE, 2], + [Item::FENCE, 3], + [Item::FENCE, 4], + [Item::FENCE, 5], [Item::FENCE_GATE, 0], [Item::FENCE_GATE_BIRCH, 0], [Item::FENCE_GATE_SPRUCE, 0], @@ -723,11 +718,6 @@ class Block extends Position implements Metadatable{ self::$list[self::FENCE_GATE_JUNGLE] = FenceGateJungle::class; self::$list[self::FENCE_GATE_DARK_OAK] = FenceGateDarkOak::class; self::$list[self::FENCE_GATE_ACACIA] = FenceGateAcacia::class; - self::$list[self::FENCE_SPRUCE] = FenceSpruce::class; - self::$list[self::FENCE_BIRCH] = FenceBirch::class; - self::$list[self::FENCE_DARK_OAK] = FenceDarkOak::class; - self::$list[self::FENCE_JUNGLE] = FenceJungle::class; - self::$list[self::FENCE_ACACIA] = FenceAcacia::class; self::$list[self::PODZOL] = Podzol::class; self::$list[self::BEETROOT_BLOCK] = Beetroot::class; diff --git a/src/pocketmine/block/Fence.php b/src/pocketmine/block/Fence.php index 67eae5b69..f55b66de0 100644 --- a/src/pocketmine/block/Fence.php +++ b/src/pocketmine/block/Fence.php @@ -27,16 +27,27 @@ class Fence extends Transparent{ protected $id = self::FENCE; - public function __construct(){ - + public function __construct($meta = 0){ + $this->meta = $meta; } public function getHardness(){ return 15; } + public function getName(){ - return "Oak Fence"; + static $names = [ + 0 => "Oak Fence", + 1 => "Spruce Fence", + 2 => "Birch Fence", + 3 => "Jungle Fence", + 4 => "Acacia Fence", + 5 => "Jungle Fence", + "", + "" + ]; + return $names[$this->meta & 0x07]; } protected function recalculateBoundingBox(){ diff --git a/src/pocketmine/block/FenceAcacia.php b/src/pocketmine/block/FenceAcacia.php deleted file mode 100644 index aa367fb2c..000000000 --- a/src/pocketmine/block/FenceAcacia.php +++ /dev/null @@ -1,31 +0,0 @@ -closed){ $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this)); $this->closed = true; - unset($this->level->updateEntities[$this->id]); - if($this->chunk instanceof FullChunk){ + if($this->chunk !== null){ $this->chunk->removeEntity($this); } if($this->level instanceof Level){ diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index 2799533a0..001467e90 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -73,11 +73,11 @@ class CraftingManager{ $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BED, 0, 1)))->addIngredient(Item::get(Item::WOOL, null, 3))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 3))); $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::CHEST, 0, 1)))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 8))); $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 4))); - $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_SPRUCE, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 4))); - $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_BIRCH, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 4))); - $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_JUNGLE, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 4))); - $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_ACACIA, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 4))); - $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_DARK_OAK, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 4))); + $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::SPRUCE, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 4))); + $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::BIRCH, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 4))); + $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::JUNGLE, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 4))); + $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::ACACIA, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 4))); + $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::DARK_OAK, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 4))); $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 2))->addIngredient(Item::get(Item::STICK, 0, 4))); $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_SPRUCE, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 2))->addIngredient(Item::get(Item::STICK, 0, 4))); $this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_BIRCH, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 2))->addIngredient(Item::get(Item::STICK, 0, 4))); diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 301dd1e78..c8f85de3c 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -227,11 +227,6 @@ class Item{ const FENCE_GATE_JUNGLE = 185; const FENCE_GATE_DARK_OAK = 186; const FENCE_GATE_ACACIA = 187; - const FENCE_SPRUCE = 188; - const FENCE_BIRCH = 189; - const FENCE_JUNGLE = 190; - const FENCE_DARK_OAK = 191; - const FENCE_ACACIA = 192; const PODZOL = 243; const BEETROOT_BLOCK = 244; diff --git a/src/pocketmine/level/format/leveldb/Chunk.php b/src/pocketmine/level/format/leveldb/Chunk.php index 262dee2a4..85ae24d0e 100644 --- a/src/pocketmine/level/format/leveldb/Chunk.php +++ b/src/pocketmine/level/format/leveldb/Chunk.php @@ -297,9 +297,11 @@ class Chunk extends BaseFullChunk{ $tiles = []; foreach($this->getTiles() as $tile){ - $tile->saveNBT(); - $nbt->setData($tile->namedtag); - $tiles[] = $nbt->write(); + if(!$tile->closed){ + $tile->saveNBT(); + $nbt->setData($tile->namedtag); + $tiles[] = $nbt->write(); + } } if(count($tiles) > 0){