diff --git a/src/material/block/solid/MonsterSpawnerBlock.php b/src/material/block/solid/MonsterSpawnerBlock.php index 11ac5c3e..ce097b01 100644 --- a/src/material/block/solid/MonsterSpawnerBlock.php +++ b/src/material/block/solid/MonsterSpawnerBlock.php @@ -5,7 +5,16 @@ class MonsterSpawnerBlock extends SolidBlock{ parent::__construct(MONSTER_SPAWNER, $meta, "Monster Spawner"); $this->hardness = 5; } - + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + parent::place($item, $player, $block, $target, $face, $fx, $fy, $fz); + ServerAPI::request()->api->tile->add($this->level, TILE_MOB_SPAWNER, $this->x, $this->y, $this->z, [ + "EntityId" => 0, + "id" => TILE_MOB_SPAWNER, + "x" => $this->x, + "y" => $this->y, + "z" => $this->z, + ]); + } public function getDrops(Item $item, Player $player){ return []; } diff --git a/src/material/item/generic/SpawnEggItem.php b/src/material/item/generic/SpawnEggItem.php index 3aac8d9c..9deb6c76 100644 --- a/src/material/item/generic/SpawnEggItem.php +++ b/src/material/item/generic/SpawnEggItem.php @@ -8,6 +8,18 @@ class SpawnEggItem extends Item{ } public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + + if($target instanceof MonsterSpawnerBlock){ + $tile = ServerAPI::request()->api->tile->get($target); + if($tile instanceof Tile){ + $tile->data["EntityId"] = $this->meta; + //TODO update tile somehow + }else{ + ConsoleAPI::warn("No tile was found at $target!"); + } + return false; + } + $ageable = $this->meta === MOB_CHICKEN || $this->meta === MOB_COW || $this->meta === MOB_SHEEP || $this->meta === MOB_PIG; $data = array( "x" => $block->x + 0.5, diff --git a/src/world/Level.php b/src/world/Level.php index 253a6a4a..a9dff4b0 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -226,7 +226,6 @@ class Level{ $tileEntities .= $nbt->write(); break; case TILE_MOB_SPAWNER: - console("mobspawner spawn {$tile->data["EntityId"]}"); $nbt->setData(new Compound("", array( new StringTag("id", TILE_MOB_SPAWNER), new IntTag("x", (int) $tile->x), diff --git a/src/world/generator/NormalGenerator.php b/src/world/generator/NormalGenerator.php index 4ef253ba..c800abe1 100644 --- a/src/world/generator/NormalGenerator.php +++ b/src/world/generator/NormalGenerator.php @@ -185,7 +185,7 @@ class NormalGenerator implements NewLevelGenerator{ } } foreach($this->populators as $populator){ - $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed()); //ty shoghicp for 250k bytes of randomness + $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed()); //ty shoghicp for 250k bytes of randomness (where ~65536 are usable) $populator->populate($this->level, $chunkX, $chunkZ, $this->random); } } diff --git a/src/world/generator/populator/DesertWellPopulator.php b/src/world/generator/populator/DesertWellPopulator.php deleted file mode 100644 index e69de29b..00000000 diff --git a/src/world/generator/populator/ForestRockPopulator.php b/src/world/generator/populator/ForestRockPopulator.php deleted file mode 100644 index e69de29b..00000000 diff --git a/src/world/generator/populator/VillagePopulator.php b/src/world/generator/populator/VillagePopulator.php deleted file mode 100644 index e69de29b..00000000