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

The following examples show how to use codechicken.lib.packet.PacketCustom#sendToServer() . 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: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
/**
 * Tells the server to cheat a specific item to the player.
 *
 * @param stack    The stack to cheat.
 * @param infinite If the stack should be infinite or not.
 * @param doSpawn  If the server should actually give the item.
 */
public static void sendGiveItem(ItemStack stack, boolean infinite, boolean doSpawn) {
    PacketCustom packet = new PacketCustom(channel, 1);
    packet.writeItemStack(stack);
    packet.writeBoolean(infinite);
    packet.writeBoolean(doSpawn);
    packet.sendToServer();
}
 
Example 2
Source File: ContainerPotionCreator.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void setPotionEffect(int effectID, int duration, int amplifier) {
    PacketCustom packet = NEICPH.createContainerPacket();
    packet.writeBoolean(true);
    packet.writeByte(effectID);
    packet.writeInt(duration);
    packet.writeByte(amplifier);
    packet.sendToServer();
}
 
Example 3
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 4
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 5
Source File: NEICPH.java    From NotEnoughItems with MIT License 5 votes vote down vote up
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 6
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 7
Source File: ChunkLoaderCPH.java    From ChickenChunks with MIT License 5 votes vote down vote up
public static void sendShapeChange(TileChunkLoader tile, ChunkLoaderShape shape, int radius) {
    PacketCustom packet = new PacketCustom(channel, 2);
    packet.writeCoord(tile.xCoord, tile.yCoord, tile.zCoord);
    packet.writeByte(shape.ordinal());
    packet.writeByte(radius);
    packet.sendToServer();
}
 
Example 8
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 9
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
public static void sendResetMap() {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 58);

    packet.sendToServer();
}
 
Example 10
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
public static void sendCloseSniffer() {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 50);
    packet.writeBoolean(false);

    packet.sendToServer();
}
 
Example 11
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 12
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void sendCreativeScroll(int steps) {
    PacketCustom packet = new PacketCustom(channel, 14);
    packet.writeInt(steps);
    packet.sendToServer();
}
 
Example 13
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
/**
 * Tells the server open NEI's extended creative inv.
 *
 * @param open Is it open or close.
 */
public static void sendCreativeInv(boolean open) {
    PacketCustom packet = new PacketCustom(channel, 23);
    packet.writeBoolean(open);
    packet.sendToServer();
}
 
Example 14
Source File: NEICPH.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void sendToggleMagnetMode() {
    PacketCustom packet = new PacketCustom(channel, 6);
    packet.sendToServer();
}
 
Example 15
Source File: ContainerPotionCreator.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public void removePotionEffect(int effectID) {
    PacketCustom packet = NEICPH.createContainerPacket();
    packet.writeBoolean(false);
    packet.writeByte(effectID);
    packet.sendToServer();
}
 
Example 16
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
/**
 * Sent to the server to change the time.
 */
public static void sendSetTime(int hour) {
    PacketCustom packet = new PacketCustom(channel, 7);
    packet.writeByte(hour);
    packet.sendToServer();
}
 
Example 17
Source File: NEICPH.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void sendDeleteAllItems() {
    PacketCustom packet = new PacketCustom(channel, 4);
    packet.sendToServer();
}
 
Example 18
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
/**
 * Sent to the server to request a LoginState.
 */
private static void sendRequestLoginInfo() {
    PacketCustom packet = new PacketCustom(channel, 10);
    packet.sendToServer();
}
 
Example 19
Source File: NEICPH.java    From NotEnoughItems with MIT License 4 votes vote down vote up
private static void sendRequestLoginInfo() {
    PacketCustom packet = new PacketCustom(channel, 10);
    packet.sendToServer();
}
 
Example 20
Source File: WRCoreCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
public static void sendDecrementSlot(int slot) {
    PacketCustom packet = new PacketCustom(WirelessRedstoneCore.channel, 5);
    packet.writeShort(slot);
    packet.sendToServer();
}