@Override public void execute(String[] args) throws Error { if (args.length > 0) syntaxError(); // check for creative mode EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (!player.capabilities.isCreativeMode) error("Creative mode only."); // validate item ItemStack item = player.inventory.getCurrentItem(); if (item == null) error("You need an item in your hand."); if (!item.isItemStackDamageable()) error("This item can't take damage."); if (!item.isItemDamaged()) error("This item is not damaged."); // repair item item.setItemDamage(0); player.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36 + player.inventory.currentItem, item)); }
@Override public void onUpdate() { if (infinite) { Item item = null; while (item == null) item = Item.getItemById(new Random().nextInt(431)); Minecraft.getMinecraft().thePlayer.sendQueue .addToSendQueue(new C10PacketCreativeInventoryAction(-1, new ItemStack(item, 64))); return; } if (WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive()) { timer++; if (timer >= 5) { Minecraft.getMinecraft().playerController .windowClick(0, counter, 1, 4, Minecraft.getMinecraft().thePlayer); counter++; timer = 0; if (counter >= 45) WurstClient.INSTANCE.events.remove(UpdateListener.class, this); } } else { for (int i = 9; i < 45; i++) { Minecraft.getMinecraft().playerController.windowClick(0, i, 1, 4, Minecraft.getMinecraft().thePlayer); } WurstClient.INSTANCE.events.remove(UpdateListener.class, this); } }
/** * Used in PlayerControllerMP to update the server with an ItemStack in a slot. */ public void sendSlotPacket(ItemStack itemStackIn, int slotId) { if (this.currentGameType.isCreative()) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(slotId, itemStackIn)); } }
/** * Sends a Packet107 to the server to drop the item on the ground */ public void sendPacketDropItem(ItemStack itemStackIn) { if (this.currentGameType.isCreative() && itemStackIn != null) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(-1, itemStackIn)); } }
public static void updateInventory() { for (int index = 0; index < 44; index++) { try { int offset = index < 9 ? 36 : 0; Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(index + offset, Minecraft.getMinecraft().thePlayer.inventory.mainInventory[index])); } catch (Exception localException) { localException.printStackTrace(); } } }
@Override public void onEnable() { if (Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(0) != null) { WurstClient.INSTANCE.chat.error("Please clear the first slot in your hotbar."); setEnabled(false); return; } else if (!Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) { WurstClient.INSTANCE.chat.error("Creative mode only."); setEnabled(false); return; } ItemStack stack = new ItemStack(Items.potionitem); stack.setItemDamage(16384); NBTTagList effects = new NBTTagList(); for (int i = 1; i <= 23; i++) { NBTTagCompound effect = new NBTTagCompound(); effect.setInteger("Amplifier", Integer.MAX_VALUE); effect.setInteger("Duration", Integer.MAX_VALUE); effect.setInteger("Id", i); effects.appendTag(effect); } stack.setTagInfo("CustomPotionEffects", effects); stack.setStackDisplayName("�c�lTroll�6�lPotion"); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36, stack)); WurstClient.INSTANCE.chat.message("Potion created. Trololo!"); setEnabled(false); }
public void createCmdBlock(String cmd) { ItemStack stack = new ItemStack(Blocks.command_block); NBTTagCompound nbtTagCompound = new NBTTagCompound(); nbtTagCompound.setTag("Command", new NBTTagString(cmd)); stack.writeToNBT(nbtTagCompound); stack.setTagInfo("BlockEntityTag", nbtTagCompound); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36, stack)); WurstClient.INSTANCE.chat.message("Command Block created."); }
@Override public void onEnable() { if (Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(0) != null) { WurstClient.INSTANCE.chat.error("Please clear the first slot in your hotbar."); setEnabled(false); return; } else if (!Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) { WurstClient.INSTANCE.chat.error("Creative mode only."); setEnabled(false); return; } ItemStack stack = new ItemStack(Items.potionitem); stack.setItemDamage(16384); NBTTagList effects = new NBTTagList(); NBTTagCompound effect = new NBTTagCompound(); effect.setInteger("Amplifier", 125); effect.setInteger("Duration", 2000); effect.setInteger("Id", 6); effects.appendTag(effect); stack.setTagInfo("CustomPotionEffects", effects); stack.setStackDisplayName("�c�lKiller�6�lPotion"); Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36, stack)); WurstClient.INSTANCE.chat.message("Potion created."); setEnabled(false); }
/** * Update the server with an ItemStack in a slot. */ public void processCreativeInventoryAction(C10PacketCreativeInventoryAction p_147344_1_) { if (this.playerEntity.theItemInWorldManager.isCreative()) { boolean var2 = p_147344_1_.func_149627_c() < 0; ItemStack var3 = p_147344_1_.func_149625_d(); boolean var4 = p_147344_1_.func_149627_c() >= 1 && p_147344_1_.func_149627_c() < 36 + InventoryPlayer.getHotbarSize(); boolean var5 = var3 == null || var3.getItem() != null; boolean var6 = var3 == null || var3.getItemDamage() >= 0 && var3.stackSize <= 64 && var3.stackSize > 0; if (var4 && var5 && var6) { if (var3 == null) { this.playerEntity.inventoryContainer.putStackInSlot(p_147344_1_.func_149627_c(), (ItemStack)null); } else { this.playerEntity.inventoryContainer.putStackInSlot(p_147344_1_.func_149627_c(), var3); } this.playerEntity.inventoryContainer.setPlayerIsPresent(this.playerEntity, true); } else if (var2 && var5 && var6 && this.field_147375_m < 200) { this.field_147375_m += 20; EntityItem var7 = this.playerEntity.dropPlayerItemWithRandomChoice(var3, true); if (var7 != null) { var7.setAgeToCreativeDespawnTime(); } } } }
/** * Used in PlayerControllerMP to update the server with an ItemStack in a slot. */ public void sendSlotPacket(ItemStack par1ItemStack, int par2) { if (this.currentGameType.isCreative()) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(par2, par1ItemStack)); } }
/** * Sends a Packet107 to the server to drop the item on the ground */ public void sendPacketDropItem(ItemStack par1ItemStack) { if (this.currentGameType.isCreative() && par1ItemStack != null) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(-1, par1ItemStack)); } }
public void sendSlotPacket(ItemStack p_78761_1_, int p_78761_2_) { if (this.currentGameType.isCreative()) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(p_78761_2_, p_78761_1_)); } }
public void sendPacketDropItem(ItemStack p_78752_1_) { if (this.currentGameType.isCreative() && p_78752_1_ != null) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(-1, p_78752_1_)); } }
public void processCreativeInventoryAction(C10PacketCreativeInventoryAction p_147344_1_) { if (this.playerEntity.theItemInWorldManager.isCreative()) { boolean flag = p_147344_1_.func_149627_c() < 0; ItemStack itemstack = p_147344_1_.func_149625_d(); boolean flag1 = p_147344_1_.func_149627_c() >= 1 && p_147344_1_.func_149627_c() < 36 + InventoryPlayer.getHotbarSize(); boolean flag2 = itemstack == null || itemstack.getItem() != null; boolean flag3 = itemstack == null || itemstack.getItemDamage() >= 0 && itemstack.stackSize <= 64 && itemstack.stackSize > 0; if (flag1 && flag2 && flag3) { if (itemstack == null) { this.playerEntity.inventoryContainer.putStackInSlot(p_147344_1_.func_149627_c(), (ItemStack)null); } else { this.playerEntity.inventoryContainer.putStackInSlot(p_147344_1_.func_149627_c(), itemstack); } this.playerEntity.inventoryContainer.setPlayerIsPresent(this.playerEntity, true); } else if (flag && flag2 && flag3 && this.field_147375_m < 200) { this.field_147375_m += 20; EntityItem entityitem = this.playerEntity.dropPlayerItemWithRandomChoice(itemstack, true); if (entityitem != null) { entityitem.setAgeToCreativeDespawnTime(); } } } }
/** * Update the server with an ItemStack in a slot. */ public void processCreativeInventoryAction(C10PacketCreativeInventoryAction packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); if (this.playerEntity.theItemInWorldManager.isCreative()) { boolean flag = packetIn.getSlotId() < 0; ItemStack itemstack = packetIn.getStack(); if (itemstack != null && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10)) { NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag"); if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z")) { BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z")); TileEntity tileentity = this.playerEntity.worldObj.getTileEntity(blockpos); if (tileentity != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); tileentity.writeToNBT(nbttagcompound1); nbttagcompound1.removeTag("x"); nbttagcompound1.removeTag("y"); nbttagcompound1.removeTag("z"); itemstack.setTagInfo("BlockEntityTag", nbttagcompound1); } } } boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() < 36 + InventoryPlayer.getHotbarSize(); boolean flag2 = itemstack == null || itemstack.getItem() != null; boolean flag3 = itemstack == null || itemstack.getMetadata() >= 0 && itemstack.stackSize <= 64 && itemstack.stackSize > 0; if (flag1 && flag2 && flag3) { if (itemstack == null) { this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), (ItemStack)null); } else { this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack); } this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true); } else if (flag && flag2 && flag3 && this.itemDropThreshold < 200) { this.itemDropThreshold += 20; EntityItem entityitem = this.playerEntity.dropPlayerItemWithRandomChoice(itemstack, true); if (entityitem != null) { entityitem.setAgeToCreativeDespawnTime(); } } } }
public void sendPacketDropItem(ItemStack p_78752_1_) { if ((this.currentGameType.isCreative()) && (p_78752_1_ != null)) { this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(-1, p_78752_1_)); } }
@Override public void processCreativeInventoryAction(C10PacketCreativeInventoryAction p_147344_1_) { }
/** * Update the server with an ItemStack in a slot. */ void processCreativeInventoryAction(C10PacketCreativeInventoryAction packetIn);
/** * Update the server with an ItemStack in a slot. */ void processCreativeInventoryAction(C10PacketCreativeInventoryAction var1);
void processCreativeInventoryAction(C10PacketCreativeInventoryAction p_147344_1_);