Java Code Examples for codechicken.lib.packet.PacketCustom#writePos()

The following examples show how to use codechicken.lib.packet.PacketCustom#writePos() . 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: TileEnderTank.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public void sendSyncPacket() {
    PacketCustom packet = new PacketCustom(EnderStorageNetwork.NET_CHANNEL, 5);
    packet.writePos(getPos());
    packet.writeFluidStack(s_liquid);
    packet.sendToChunk(TileEnderTank.this);
}
 
Example 2
Source File: TileEnderTank.java    From EnderStorage with MIT License 4 votes vote down vote up
private void sendSyncPacket() {
    PacketCustom packet = new PacketCustom(EnderStorageNetwork.NET_CHANNEL, 6);
    packet.writePos(getPos());
    packet.writeBoolean(a_pressure);
    packet.sendToChunk(TileEnderTank.this);
}
 
Example 3
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void sendMobSpawnerID(int x, int y, int z, String mobtype) {
    PacketCustom packet = new PacketCustom(channel, 15);
    packet.writePos(new BlockPos(x, y, z));
    packet.writeString(mobtype);
    packet.sendToServer();
}
 
Example 4
Source File: CustomParticleHandler.java    From CodeChickenLib with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Call from {@link Block#addLandingEffects}
 * Provided the model bound is an instance of IModelParticleProvider, you will have landing particles just handled for you.
 *
 * @param world        The world.
 * @param pos          The position of the block.
 * @param entity       The entity.
 * @param numParticles The number of particles to spawn.
 * @return Always true for this, basically just return the result of this method inside {@link Block#addLandingEffects}
 */
public static boolean handleLandingEffects(ServerWorld world, BlockPos pos, LivingEntity entity, int numParticles) {
    PacketCustom packet = new PacketCustom(CCLNetwork.NET_CHANNEL, C_ADD_LANDING_EFFECTS);
    packet.writePos(pos);
    packet.writeVector(Vector3.fromEntity(entity));
    packet.writeVarInt(numParticles);
    packet.sendToPlayer((ServerPlayerEntity) entity);
    return true;
}