use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.
the class NEIServerUtils method setGamemode.
public static void setGamemode(EntityPlayerMP player, int mode) {
if (mode < 0 || mode >= NEIActions.gameModes.length || NEIActions.nameActionMap.containsKey(NEIActions.gameModes[mode]) && !NEIServerConfig.canPlayerPerformAction(player.getName(), NEIActions.gameModes[mode])) {
return;
}
// creative+
NEIServerConfig.forPlayer(player.getName()).enableAction("creative+", mode == 2);
if (// open the container immediately for the client
mode == 2 && !(player.openContainer instanceof ContainerCreativeInv)) {
NEISPH.processCreativeInv(player, true);
}
// change it on the server
player.theItemInWorldManager.setGameType(getGameType(mode));
// tell the client to change it
new PacketCustom(NEISPH.channel, 14).writeByte(mode).sendToPlayer(player);
player.addChatMessage(new ChatComponentTranslation("nei.chat.gamemode." + mode));
}
use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.
the class NEICPH method sendOpenPotionWindow.
public static void sendOpenPotionWindow() {
ItemStack[] potionStore = new ItemStack[9];
InventoryUtils.readItemStacksFromTag(potionStore, NEIClientConfig.global.nbt.getCompoundTag("potionStore").getTagList("items", 10));
PacketCustom packet = new PacketCustom(channel, 24);
for (ItemStack stack : potionStore) {
packet.writeItemStack(stack);
}
packet.sendToServer();
}
use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.
the class NEICPH method sendToggleMagnetMode.
public static void sendToggleMagnetMode() {
PacketCustom packet = new PacketCustom(channel, 6);
packet.sendToServer();
}
use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.
the class NEICPH method sendCreativeInv.
public static void sendCreativeInv(boolean open) {
PacketCustom packet = new PacketCustom(channel, 23);
packet.writeBoolean(open);
packet.sendToServer();
}
use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.
the class NEICPH method sendDeleteAllItems.
public static void sendDeleteAllItems() {
PacketCustom packet = new PacketCustom(channel, 4);
packet.sendToServer();
}
Aggregations