[SPIGOT-5561] Warning in logs when changing a Mob Spawner to Air on chunk load Created: 02/Feb/20 Updated: 13/Jul/21 Resolved: 13/Jul/21 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | lokka30 | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Labels: | 1.15.2, bug, event, spigot | ||
Environment: |
Windows 10 |
Version: | This server is running CraftBukkit version git-Spigot-800b93f-8160e29 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) |
Plugin: | N/A - the code is available in the description. |
Guidelines Read: | Yes |
Description |
As discussed in this SpigotMC thread, when using either ChunkPopulateEvent or ChunkLoadEvent and checking for mob spawners being created/existing and trying to replace it with another material, it sends this warning into the logs:
[07:52:10 WARN]: Tried to load a DUMMY block entity @ BlockPosition{x=186, y=37, z=327} but found not block entity block Block{minecraft:diamond_ore} at location
[07:52:10 WARN]: Tried to load a block entity for block Block{minecraft:diamond_ore} but failed at location BlockPosition{x=186, y=37, z=327}
These are the two pieces of code used: @EventHandler public void onChunkPopulate(final ChunkPopulateEvent e) { final Chunk chunk = e.getChunk(); for(BlockState blockState : chunk.getTileEntities()) { if(blockState instanceof CreatureSpawner) { blockState.getBlock().setType(Material.DIAMOND_ORE); } } } @EventHandler public void onChunkLoad(final ChunkLoadEvent e) { if(e.isNewChunk()) { for(BlockState tileEntity : e.getChunk().getTileEntities()) { if(tileEntity.getBlock().getType() == Material.SPAWNER) { final Location location = tileEntity.getLocation(); tileEntity.getBlock().setType(Material.AIR); } } } }
|
Comments |
Comment by lokka30 [ 13/Jul/21 ] |
Thank you - I am yet to test it, although I appreciate it! |
Comment by Marvin Rieple [ 11/Jul/21 ] |
Made a PR for this: craftbukkit#884 |
Comment by Kentaro Doi [ 13/Jul/20 ] |
It's still reproduce in 1.16.1 |
Comment by TheCreeperCow [ 12/Feb/20 ] |
due to the fact im not sure why this check is there in the first place im gonna let it stay there until we know more about it |
Comment by lokka30 [ 12/Feb/20 ] |
Yup, that's the exact conclusion I had with this issue. If Spigot adds another way to detect when spawners are created (instead of checking every block when a chunk loads and then checking if it's a custom spawner), it would be appreciated |
Comment by TheCreeperCow [ 11/Feb/20 ] |
It seems to be a vanilla thing in the chunk load code it tries to find a tileentity but not all blocks have them so it errors if its unable to find it however during testing i was able to change the spawner into diamond ore so its not impossible but errors will show up however |
Comment by TheCreeperCow [ 11/Feb/20 ] |
Wait so what happens after you change the block is it just air? |
Comment by lokka30 [ 10/Feb/20 ] |
There is currently no other way we can achieve what we want without using either of the codes I posted above. I even tried adding a scheduler to remove the spawner later but it still has that error |
Comment by TheCreeperCow [ 10/Feb/20 ] |
After looking at the code it looks to me like the spawner was not yet spawned in hence the fact it was using a DUMMY entity so it could add the spawner later. |