TileEntityStructure Missing from WorldServer.class

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: None
    • None

      For NMS code:

           - WorldServer.class:
               public TileEntity getTileEntity(BlockPosition pos)
                > TileEntityStructure is missing as a possible variant of TileEntity to be returned.

      This issue causes CraftStructureBlock to error upon:

      (TileEntityStructure)((CraftWorld)block.getWorld()).getTileEntityAt(this.getX(), this.getY(), this.getZ());

      yielding a ClassCastException if the original block was a type that possessed a TileEntity...

      Example:

        > For Block a: a's Material (type) is Material.ENDER_CHEST
        > a.setType(Material.STRUCTURE_BLOCK);

      Now attempting to call getTileEntityAt will still yield an instance of TileEntityEnderChest, and attempting to use block.getState() will produce a ClassCastException.

      If a was a type not associated with a TileEntity (ie. Material.WOOL), setting a to type Material.STRUCTURE_BLOCK will yield the appropriate TileEntity as an instance of TileEntityStructure.

       

      "Caused by: java.lang.ClassCastException: net.minecraft.server.v1_12_R1.TileEntityEnderChest cannot be cast to net.minecraft.server.v1_12_R1.TileEntityStructure"

            Assignee:
            Unassigned
            Reporter:
            Dan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: