Solved [1.14.x][NMS] Replacement for World#getTileEntityAt

Discussion in 'Spigot Plugin Development' started by eccentric, Aug 18, 2019.

  1. I'm updating some code to 1.14 and as the title says I'm looking for a replacement for World#getTileEntityAt(x, y, z)

    The current code I have:
    Code (Text):

    TileEntitySign t = (TileEntitySign) ((CraftWorld) l.getWorld()).getTileEntityAt(l.getBlockX(), l.getBlockY(), l.getBlockZ());
    CraftWorld no longer has a getTileEnitityAt method - any ideas on how I can get the tile entity?
    • Agree Agree x 1
  2. Oh, sorry I don't know how to read... Try CraftWorld#getHandle().getTileEntity(new BlockPosition(x,y,z))
  3. There is no such method in 1.14
    #5 eccentric, Aug 18, 2019
    Last edited: Aug 18, 2019
  4. It works for me in 1.14... Did you used CraftWorld#getHandle()? Your code should be like this:
    Code (Java):
    TileEntitySign t = (TileEntitySign) ((CraftWorld) l.getWorld()).getHandle().getTileEntity(new BlockPosition(l.getBlockX(), l.getBlockY(), l.getBlockZ()));
  5. Thank you, for some reason when searching for the method in the source file my editor couldn't find the method :(
    #7 eccentric, Aug 18, 2019
    Last edited: Aug 18, 2019
  6. You should have in your library org.bukkit.craftbukkit.v1_14_R1.CraftWorld... You can try to run that with reflection...