Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5561

Warning in logs when changing a Mob Spawner to Air on chunk load

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Windows 10

    • This server is running CraftBukkit version git-Spigot-800b93f-8160e29 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
    • N/A - the code is available in the description.
    • Yes

      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);
                      }
                  }
              }
          }
      

       

            Unassigned Unassigned
            lokka30 lokka30
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: