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

The following examples show how to use codechicken.lib.packet.PacketCustom#writeBoolean() . 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: PlayerChunkViewerTracker.java    From ChickenChunks with MIT License 6 votes vote down vote up
public void writeTicketToPacket(PacketCustom packet, Ticket ticket, Collection<ChunkCoordIntPair> chunkSet)
{
    packet.writeInt(manager.ticketIDs.get(ticket));
    packet.writeString(ticket.getModId());
    String player = ticket.getPlayerName();
    packet.writeBoolean(player != null);
    if(player != null)
        packet.writeString(player);
    packet.writeByte(ticket.getType().ordinal());
    Entity entity = ticket.getEntity();
    if(entity != null)
        packet.writeInt(entity.getEntityId());
    packet.writeShort(chunkSet.size());
    for(ChunkCoordIntPair chunk : chunkSet)
    {
        packet.writeInt(chunk.chunkXPos);
        packet.writeInt(chunk.chunkZPos);
    }
    
    knownTickets.add(manager.ticketIDs.get(ticket));
}
 
Example 2
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 5 votes vote down vote up
public static void sendSyncTriang(int freq, boolean required) {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 52);
    packet.writeShort(freq);
    packet.writeBoolean(required);

    packet.sendToServer();
}
 
Example 3
Source File: TileItemTranslocator.java    From Translocators with MIT License 5 votes vote down vote up
@Override
public void write(PacketCustom packet)
{
    super.write(packet);
    packet.writeBoolean(regulate);
    packet.writeBoolean(signal);
    packet.writeBoolean(a_powering);
}
 
Example 4
Source File: NEICPH.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void sendSetSlot(int slot, ItemStack stack, boolean container) {
    PacketCustom packet = new PacketCustom(channel, 5);
    packet.writeBoolean(container);
    packet.writeShort(slot);
    packet.writeItemStack(stack);
    packet.sendToServer();
}
 
Example 5
Source File: NEICPH.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void sendGiveItem(ItemStack spawnstack, boolean infinite, boolean doSpawn) {
    PacketCustom packet = new PacketCustom(channel, 1);
    packet.writeItemStack(spawnstack);
    packet.writeBoolean(infinite);
    packet.writeBoolean(doSpawn);
    packet.sendToServer();
}
 
Example 6
Source File: PlayerChunkViewerTracker.java    From ChickenChunks with MIT License 5 votes vote down vote up
public void sendTicketChange(TicketChange change)
{
    int ticketID = manager.ticketIDs.get(change.ticket);
    if(!knownTickets.contains(ticketID))
        addTicket(change.dimension, change.ticket);
    
    PacketCustom packet = new PacketCustom(channel, 5);
    packet.writeInt(change.dimension);
    packet.writeInt(ticketID);
    packet.writeInt(change.chunk.chunkXPos);
    packet.writeInt(change.chunk.chunkZPos);
    packet.writeBoolean(change.force);
    
    packet.sendToPlayer(owner);
}
 
Example 7
Source File: WRCoreSPH.java    From WirelessRedstone with MIT License 5 votes vote down vote up
public static void sendSetFrequencyRangeTo(EntityPlayer player, int startfreq, int endfreq, boolean jam) {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 3);
    packet.writeShort((short) startfreq);
    packet.writeShort((short) endfreq);
    packet.writeBoolean(jam);

    packet.sendToPlayer(player);
}
 
Example 8
Source File: EnderStorageSPH.java    From EnderStorage with MIT License 5 votes vote down vote up
public static void sendOpenUpdateTo(EntityPlayer player, String owner, int freq, boolean open) {
    PacketCustom packet = new PacketCustom(channel, 3);
    packet.writeString(owner);
    packet.writeShort(freq);
    packet.writeBoolean(open);

    packet.sendToPlayer(player);
}
 
Example 9
Source File: ContainerPotionCreator.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void setPotionEffect(Potion potion, int duration, int amplifier) {
    PacketCustom packet = NEIClientPacketHandler.createContainerPacket();
    packet.writeBoolean(true);
    packet.writeByte(Potion.getIdFromPotion(potion));
    packet.writeInt(duration);
    packet.writeByte(amplifier);
    packet.sendToServer();
}
 
Example 10
Source File: WRAddonSPH.java    From WirelessRedstone with MIT License 5 votes vote down vote up
public static void sendKillREP(EntityREP entityREP) {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 59);
    packet.writeBoolean(false);
    packet.writeInt(entityREP.getEntityId());

    packet.sendToChunk(entityREP.worldObj, (int) entityREP.posX >> 4, (int) entityREP.posZ >> 4);
}
 
Example 11
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
/**
 * Notifies the server about an enchantment being modified inside NEI's enchantment gui.
 *
 * @param enchID The Enchantment ID.
 * @param level  The Enchantments level.
 * @param add    If the enchantment is being added or removed.
 */
public static void sendModifyEnchantment(int enchID, int level, boolean add) {
    PacketCustom packet = new PacketCustom(channel, 22);
    packet.writeByte(enchID);
    packet.writeByte(level);
    packet.writeBoolean(add);
    packet.sendToServer();
}
 
Example 12
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
/**
 * Sets a specific slot on the players inventory to the given item.
 *
 * @param slot      The slot to change.
 * @param stack     The stack to set the slot to.
 * @param container if the inventory is a container.
 */
public static void sendSetSlot(int slot, ItemStack stack, boolean container) {
    PacketCustom packet = new PacketCustom(channel, 5);
    packet.writeBoolean(container);
    packet.writeShort(slot);
    packet.writeItemStack(stack);
    packet.sendToServer();
}
 
Example 13
Source File: ContainerPotionCreator.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public void removePotionEffect(Potion potion) {
    PacketCustom packet = NEIClientPacketHandler.createContainerPacket();
    packet.writeBoolean(false);
    packet.writeByte(Potion.getIdFromPotion(potion));
    packet.sendToServer();
}
 
Example 14
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 15
Source File: TileEnderTank.java    From EnderStorage with MIT License 4 votes vote down vote up
@Override
public void writeToPacket(PacketCustom packet) {
    packet.writeByte(rotation);
    packet.writeFluidStack(liquid_state.s_liquid);
    packet.writeBoolean(pressure_state.a_pressure);
}
 
Example 16
Source File: NEICPH.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void sendCreativeInv(boolean open) {
    PacketCustom packet = new PacketCustom(channel, 23);
    packet.writeBoolean(open);
    packet.sendToServer();
}
 
Example 17
Source File: TileTranslocator.java    From Translocators with MIT License 4 votes vote down vote up
public void write(PacketCustom packet)
{
    packet.writeBoolean(a_eject);
    packet.writeBoolean(redstone);
    packet.writeBoolean(fast);
}
 
Example 18
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
public static void sendSetRemote(boolean active) {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 51);
    packet.writeBoolean(active);

    packet.sendToServer();
}
 
Example 19
Source File: EnderStorageSPH.java    From EnderStorage with MIT License 4 votes vote down vote up
public static void sendOpenUpdateTo(ServerPlayerEntity player, Frequency freq, boolean open) {
    PacketCustom packet = new PacketCustom(EnderStorageNetwork.NET_CHANNEL, 3);
    freq.writeToPacket(packet);
    packet.writeBoolean(open);
    packet.sendToPlayer(player);
}
 
Example 20
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 3 votes vote down vote up
/**
 * Sent to the server when a user disables a specific action.
 * For example Noon, Weather.
 * Is handled on the server then relayed to all clients in the dimension.
 *
 * @param name   The identifier for the action.
 * @param enable The actions new state.
 */
public static void sendActionDisableStateChange(String name, boolean enable) {
    PacketCustom packet = new PacketCustom(channel, 12);
    packet.writeString(name);
    packet.writeBoolean(enable);
    packet.sendToServer();
}