/*
 * Copyright  2014 - 2016 | Wurst-Imperium | All rights reserved.
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package tk.wurst_client.mods;

import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.play.client.CPacketCreativeInventoryAction;
import tk.wurst_client.mods.Mod.Bypasses;

@Mod.Info(
	description = "Generates an incredibly annoying potion.\n"
		+ "Tip: AntiBlind makes you partially immune to it.",
	name = "TrollPotion",
	tags = "troll potion",
	help = "Mods/TrollPotion")
@Bypasses
public class TrollPotionMod extends Mod
{
	@Override
	public void onEnable()
	{
		if(mc.player.inventory.getStackInSlot(0) != null)
		{
			wurst.chat.error("Please clear the first slot in your hotbar.");
			setEnabled(false);
			return;
		}else if(!mc.player.capabilities.isCreativeMode)
		{
			wurst.chat.error("Creative mode only.");
			setEnabled(false);
			return;
		}
		ItemStack stack = new ItemStack(Items.SPLASH_POTION);
		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("clTroll6lPotion");
		mc.player.connection
			.sendPacket(new CPacketCreativeInventoryAction(36, stack));
		wurst.chat.message("Potion created. Trololo!");
		setEnabled(false);
	}
}

@@ -462,113 +462,43 @@
 ort 
-net.minecraft.network.play.client.CPacketCreativeInventoryAction;%0Aimport tk.wurst_client.mods.Mod.Bypasse
+tk.wurst_client.utils.InventoryUtil
 s;%0A%0A
@@ -700,16 +700,20 @@
 tion%22)%0A@
+Mod.
 Bypasses
@@ -799,171 +799,28 @@
 %7B%0A%09%09
-if(mc.player.inventory.getStackInSlot(0) != null)%0A%09%09%7B%0A%09%09%09wurst.chat.error(%22Please clear the first slot in your hotbar.%22);%0A%09%09%09setEnabled(false);%0A%09%09%09return;%0A%09%09%7Delse 
+// check gamemode%0A%09%09
 if(!
@@ -943,16 +943,40 @@
 rn;%0A%09%09%7D%0A
+%09%09%0A%09%09// generate potion%0A
 %09%09ItemSt
@@ -1405,113 +1405,106 @@
 me(%22
-clTroll6lPotion%22);%0A%09%09mc.player.connection%0A%09%09%09.sendPacket(new CPacketCreativeInventoryAction(36, 
+rSplash Potion of Trolling%22);%0A%09%09%0A%09%09// give potion%0A%09%09if(InventoryUtils.placeStackInHotbar(
 stack))
-;
 %0A
+%09
 %09%09wu
@@ -1540,20 +1540,81 @@
 ted.
- Trololo!%22);
+%22);%0A%09%09else%0A%09%09%09wurst.chat.error(%22Please clear a slot in your hotbar.%22);%0A%09%09
 %0A%09%09s

Update TrollPotionMod