use of net.minecraft.core.BlockPos in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showBlockAction.
@Override
public void showBlockAction(Player player, Location location, int action, int state) {
BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
Block block = ((CraftWorld) location.getWorld()).getHandle().getBlockState(position).getBlock();
send(player, new ClientboundBlockEventPacket(position, block, action, state));
}
use of net.minecraft.core.BlockPos in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showSignEditor.
@Override
public boolean showSignEditor(Player player, Location location) {
if (location == null) {
LocationTag fakeSign = new LocationTag(player.getLocation());
fakeSign.setY(0);
FakeBlock.showFakeBlockTo(Collections.singletonList(new PlayerTag(player)), fakeSign, new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN), new DurationTag(1), true);
BlockPos pos = new BlockPos(fakeSign.getX(), 0, fakeSign.getZ());
((DenizenNetworkManagerImpl) ((CraftPlayer) player).getHandle().connection.connection).packetListener.fakeSignExpected = pos;
send(player, new ClientboundOpenSignEditorPacket(pos));
return true;
}
BlockEntity tileEntity = ((CraftWorld) location.getWorld()).getHandle().getTileEntity(new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()), true);
if (tileEntity instanceof SignBlockEntity) {
SignBlockEntity sign = (SignBlockEntity) tileEntity;
// Prevent client crashing by sending current state of the sign
send(player, sign.getUpdatePacket());
sign.isEditable = true;
sign.setAllowedPlayerEditor(player.getUniqueId());
send(player, new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
return true;
} else {
return false;
}
}
use of net.minecraft.core.BlockPos in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showTileEntityData.
@Override
public void showTileEntityData(Player player, Location location, int action, CompoundTag compoundTag) {
BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
send(player, new ClientboundBlockEntityDataPacket(position, action, ((CompoundTagImpl) compoundTag).toNMSTag()));
}
use of net.minecraft.core.BlockPos in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showBlockCrack.
@Override
public void showBlockCrack(Player player, int id, Location location, int progress) {
BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
send(player, new ClientboundBlockDestructionPacket(id, position, progress));
}
use of net.minecraft.core.BlockPos in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showTileEntityData.
@Override
public void showTileEntityData(Player player, Location location, int action, CompoundTag compoundTag) {
BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
try {
ClientboundBlockEntityDataPacket packet = (ClientboundBlockEntityDataPacket) BLOCK_ENTITY_DATA_PACKET_CONSTRUCTOR.invoke(position, action, ((CompoundTagImpl) compoundTag).toNMSTag());
send(player, packet);
} catch (Throwable ex) {
Debug.echoError(ex);
}
}
Aggregations