Java Code Examples for net.minecraft.network.PacketBuffer#readBlockPos()
The following examples show how to use
net.minecraft.network.PacketBuffer#readBlockPos() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaTileEntityTank.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void receiveCustomData(int dataId, PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == 1) { this.controllerPos = buf.readBlockPos(); this.controllerCache = new WeakReference<>(null); this.multiblockFluidTank.setFluid(null); } else if (dataId == 2) { this.controllerPos = null; this.controllerCache = new WeakReference<>(null); this.multiblockFluidTank.setFluid(null); this.connectedTanks.clear(); this.multiblockSize = new Vec3i(1, 1, 1); } else if (dataId == 3) { if (controllerPos == null) { FluidStack fluidStack = ByteBufUtils.readFluidStackDelta(buf, multiblockFluidTank.getFluid()); this.multiblockFluidTank.setFluid(fluidStack); } } else if (dataId == 4) { this.connectedTanks = ByteBufUtils.readRelativeBlockList(buf, getPos()); this.multiblockSize = buf.readBlockPos(); recomputeTankSizeNow(true); } }
Example 2
Source File: CoverBehaviorUIFactory.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected CoverBehavior readHolderFromSyncData(PacketBuffer syncData) { BlockPos blockPos = syncData.readBlockPos(); EnumFacing attachedSide = EnumFacing.VALUES[syncData.readByte()]; TileEntity tileEntity = Minecraft.getMinecraft().world.getTileEntity(blockPos); ICoverable coverable = tileEntity == null ? null : tileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_COVERABLE, null); if (coverable != null) { return coverable.getCoverAtSide(attachedSide); } return null; }
Example 3
Source File: MetaTileEntityMultiblockPart.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void receiveInitialSyncData(PacketBuffer buf) { super.receiveInitialSyncData(buf); if (buf.readBoolean()) { this.controllerPos = buf.readBlockPos(); this.controllerTile = null; } }
Example 4
Source File: MetaTileEntityMultiblockPart.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void receiveCustomData(int dataId, PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == 100) { if (buf.readBoolean()) { this.controllerPos = buf.readBlockPos(); this.controllerTile = null; } else { this.controllerPos = null; this.controllerTile = null; } getHolder().scheduleChunkForRenderUpdate(); } }
Example 5
Source File: MetaTileEntityTank.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void receiveInitialSyncData(PacketBuffer buf) { super.receiveInitialSyncData(buf); if (buf.readBoolean()) { this.connectedTanks = ByteBufUtils.readRelativeBlockList(buf, getPos()); this.multiblockSize = buf.readBlockPos(); recomputeTankSizeNow(true); FluidStack fluidStack = ByteBufUtils.readFluidStack(buf); this.multiblockFluidTank.setFluid(fluidStack); } else { this.controllerPos = buf.readBlockPos(); } }
Example 6
Source File: EntityMountable.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@Override public void readSpawnData(ByteBuf additionalData) { PacketBuffer packetBuffer = new PacketBuffer(additionalData); mountPos = new Vec3d(packetBuffer.readDouble(), packetBuffer.readDouble(), packetBuffer.readDouble()); mountPosSpace = CoordinateSpaceType.values()[packetBuffer.readInt()]; if (packetBuffer.readBoolean()) { referencePos = packetBuffer.readBlockPos(); } else { referencePos = null; } }
Example 7
Source File: TileEntityRpcTarget.java From OpenModsLib with MIT License | 5 votes |
@Override public void readFromStreamStream(Side side, EntityPlayer player, PacketBuffer input) { int worldId = input.readInt(); BlockPos pos = input.readBlockPos(); World world = WorldUtils.getWorld(side, worldId); te = world.getTileEntity(pos); }
Example 8
Source File: SyncMapTile.java From OpenModsLib with MIT License | 5 votes |
public static ISyncMapProvider findOwner(World world, PacketBuffer input) { final BlockPos pos = input.readBlockPos(); if (world != null) { if (world.isBlockLoaded(pos)) { final TileEntity tile = world.getTileEntity(pos); if (tile instanceof ISyncMapProvider) return (ISyncMapProvider)tile; } } return null; }
Example 9
Source File: PacketExtractUpgrade.java From MiningGadgets with MIT License | 4 votes |
public static PacketExtractUpgrade decode(PacketBuffer buffer) { int strLength = buffer.readInt(); return new PacketExtractUpgrade(buffer.readBlockPos(), buffer.readString(strLength), strLength); }
Example 10
Source File: VSGuiButtonMessage.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public void fromBytes(ByteBuf buf) { PacketBuffer packetBuffer = new PacketBuffer(buf); tileEntityPos = packetBuffer.readBlockPos(); buttonId = packetBuffer.readVarInt(); }
Example 11
Source File: TypeRW.java From OpenModsLib with MIT License | 4 votes |
@Override public BlockPos readFromStream(PacketBuffer input) { return input.readBlockPos(); }
Example 12
Source File: BlockEventPacket.java From OpenModsLib with MIT License | 4 votes |
@Override protected void readFromStream(PacketBuffer input) { dimension = input.readInt(); blockPos = input.readBlockPos(); }