This code used to work on v1.7 pmmp 3.4 releases, but isnt working on pmmp 3.5 releases for v1.8, whats the changed thing? i cant find anything wrong and theres no error... hmmmmm, weird Code: public function spawnChest($levelname) { $level = $this->plugin->getServer()->getLevelByName($levelname); $level->setBlock(new Vector3(4, 6, 4), new Block(0, 0)); $chest = Tile::createTile("Chest",$level, new CompoundTag(" ", [ new ListTag("Items", []), new StringTag("id", Tile::CHEST), new StringTag("CustomName", "§b§lKit"), new IntTag("x", 4), new IntTag("y", 6), new IntTag("z", 4) ])); $level->setBlock(new Vector3(4, 6, 4), new Block(54, 0)); $level->addTile($chest); $inventory = $chest->getInventory(); $inventory->addItem(Item::get(Item::STEAK, 0, 1)); } NOTE: I am generating the level by a custom generator i made, and loading the level and calling this spawnChest function, it was working in 3.4, and now i dont have any error in 3.5 and its not working, is this internal pmmp level glitch? If you want to see the generating level code, Click below: Spoiler: Extra code Code: $server = $this->plugin->getServer(); $server->generateLevel('ggh', null, GeneratorManager::getGenerator("basic")); $server->loadLevel('ggh'); $level = $this->plugin->getServer()->getLevelByName('ggh'); $pos = new Position(3, 6, 2, $level); $level->setSpawnLocation($pos); $this->spawnChest($level); EDIT: Forget adding chest tile and block, can't even setBlock a basic dirt block either by Code: $level->setBlock(new Vector3(4, 6, 4), new Block(3)); All classes are being used from the right sources. Doesn't work from ChunkLoadEvent either... Used this -> Code: public function onChunkLoad(ChunkLoadEvent $event) { $level = $event->getLevel(); $position = new Position(4,6,4,$level); if($level->getChunk($position->x >> 4, $position->z >> 4) === $event->getChunk() and $event->isNewChunk()) { echo "hi"; $level->setBlock(new Vector3(4, 6, 4), new Block(3)); echo "hi1"; } } didn't work, output came hi and hi1... but no block, teleported to that postion and checked too...
Try by replacing PHP: new Block(3) with PHP: Block::get(3) Anyway, you should use the latter as opposed to the former. The latter returns a cloned instance of the former initialized in the BlockFactory if that makes sense. The former will return a block instance with an invalid block name, bounding box etc. (you can try by var_dump()ing the two block instances).
Are you sure you are using release 3.5? Before 3.5.0 was released, there was this commit that removed Tile::createTile() use Tile::createFromData() instead (note its not just renaming the function)
i've had similar issues regarding this, it seems as if the level needs to be loaded, then wait a minimum of 10 seconds, then you can use setBlock() try using Tile::createFromData() focus on trying to make setBlock() working first, maybe the generated level is corrupted, use a pre-existing world, also make sure you're in the right coordinates of where the block should be set
If you were paying attention you'd notice that was committed to the bleeding edge branch, not to the release branch. If you were paying even more attention, you'd have noticed that that change was not mentioned in the changelogs. It's a pretty significant API break so it would be quite serious to find it unmentioned in the release notes, wouldn't it? Finally, I'll remind everyone that public API breaks are disallowed on non-major version bumps. See https://github.com/pmmp/DeveloperDocs/blob/master/api-version-spec.md Please make sure you have your facts straight before posting misinformation. Thank you.