@Override public World getWorld() { return base.getWorld(); }
public static void setTileEntityNBTTagCompound(BlockState tile, Object comp) { try { Object pos = getNewBlockPosition(tile.getX(), tile.getY(), tile.getZ()); Object cworld = getCraftWorld().cast(tile.getWorld()); Object nmsworld = cworld.getClass().getMethod("getHandle").invoke(cworld); Object o = nmsworld.getClass().getMethod("getTileEntity", pos.getClass()).invoke(nmsworld, pos); Method method = getTileEntity().getMethod("a", getNBTTagCompound()); method.invoke(o, comp); } catch (Exception e) { e.printStackTrace(); } }
public static Object getTileEntityNBTTagCompound(BlockState tile) { try { Object pos = getNewBlockPosition(tile.getX(), tile.getY(), tile.getZ()); Object cworld = getCraftWorld().cast(tile.getWorld()); Object nmsworld = cworld.getClass().getMethod("getHandle").invoke(cworld); Object o = nmsworld.getClass().getMethod("getTileEntity", pos.getClass()).invoke(nmsworld, pos); Method method = getTileEntity().getMethod(MethodNames.getTileDataMethodName(), getNBTTagCompound()); Object tag = getNBTTagCompound().newInstance(); Object answer = method.invoke(o, tag); return answer != null ? answer:tag; } catch (Exception e) { e.printStackTrace(); } return null; }
@Override public synchronized boolean isTrue(BlockState blockState) { if (blockState == null) { return false; } return isTrue(blockState.getX(), blockState.getY(), blockState.getZ(), blockState.getWorld()); }
@Override public synchronized void setFalse(BlockState blockState) { if (blockState == null) { return; } setFalse(blockState.getX(), blockState.getY(), blockState.getZ(), blockState.getWorld()); }
@Override public void setTrue(BlockState blockState) { if (blockState == null) { return; } setTrue(blockState.getX(), blockState.getY(), blockState.getZ(), blockState.getWorld()); }
public static void setTileEntityNBTTagCompound(BlockState tile, Object comp) { try { Object pos = ObjectCreator.NMS_BLOCKPOSITION.getInstance(tile.getX(), tile.getY(), tile.getZ()); Object cworld = ClassWrapper.CRAFT_WORLD.getClazz().cast(tile.getWorld()); Object nmsworld = ReflectionMethod.CRAFT_WORLD_GET_HANDLE.run(cworld); Object o = ReflectionMethod.NMS_WORLD_GET_TILEENTITY.run(nmsworld, pos); ReflectionMethod.TILEENTITY_SET_NBT.run(o, comp); } catch (Exception e) { e.printStackTrace(); } }
@Override public org.bukkit.World convertSpecial(Object value, Class<?> valueType, org.bukkit.World def) { if (value instanceof World) { return ((World) value).getWorld(); } else if (value instanceof Location) { return ((Location) value).getWorld(); } else if (value instanceof org.bukkit.block.Block) { return ((org.bukkit.block.Block) value).getWorld(); } else if (value instanceof BlockState) { return ((BlockState) value).getWorld(); } else if (value instanceof Entity) { return ((Entity) value).world.getWorld(); } else if (value instanceof TileEntity) { TileEntity tile = (TileEntity) value; return TileEntityRef.world.get(tile); } else if (value instanceof org.bukkit.entity.Entity) { return ((org.bukkit.entity.Entity) value).getWorld(); } else if (value instanceof BlockState) { return ((BlockState) value).getWorld(); } else { return def; } } };
public RepairableBlock(BlockState state) { this.state = state; world = state.getWorld(); x = state.getX(); y = state.getY(); z = state.getZ(); data = state.getBlockData(); type = state.getType(); }
public static Object getTileEntityNBTTagCompound(BlockState tile) { try { Object pos = ObjectCreator.NMS_BLOCKPOSITION.getInstance(tile.getX(), tile.getY(), tile.getZ()); Object cworld = ClassWrapper.CRAFT_WORLD.getClazz().cast(tile.getWorld()); Object nmsworld = ReflectionMethod.CRAFT_WORLD_GET_HANDLE.run(cworld); Object o = ReflectionMethod.NMS_WORLD_GET_TILEENTITY.run(nmsworld, pos); Object tag = ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().newInstance(); Object answer = ReflectionMethod.TILEENTITY_GET_NBT.run(o, tag); if (answer == null) answer = tag; return answer; } catch (Exception e) { e.printStackTrace(); } return null; }
/** * @param state */ public GriefBlock(BlockState state) { super(state.getX(), state.getY(), state.getZ(), state.getWorld().getName()); this.type = new BlockTypeEntry(state.getTypeId(), state.getRawData()); this.empty = true; }
/** * @param state */ public TranslocationBlock(BlockState state) { super(state.getX(), state.getY(), state.getZ(), state.getWorld().getName()); this.type = new BlockTypeEntry(state.getTypeId(), state.getRawData()); this.empty = true; }
ret += "y:" + state.getY() + ";"; ret += "z:" + state.getZ() + ";"; ret += "world:" + state.getWorld().getName(); if(items != null){ ret += ";";