gt:         	ItemStack oldStack = mainhandstack.copy();
context: package kenijey.harshenuniverse.tileentity;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Random;
  
  import kenijey.harshenuniverse.HarshenBlocks;
  import kenijey.harshenuniverse.HarshenItems;
  import kenijey.harshenuniverse.HarshenSounds;
  import kenijey.harshenuniverse.HarshenUniverse;
  import kenijey.harshenuniverse.HarshenUtils;
  import kenijey.harshenuniverse.api.CauldronLiquid;
  import kenijey.harshenuniverse.base.BaseTileEntityHarshenSingleItemInventory;
  import kenijey.harshenuniverse.blocks.BloodBlock;
  import kenijey.harshenuniverse.enums.items.GlassContainerValues;
  import kenijey.harshenuniverse.enums.particle.EnumHarshenParticle;
  import kenijey.harshenuniverse.internal.HarshenRegistry;
  import kenijey.harshenuniverse.items.BloodCollector;
  import kenijey.harshenuniverse.items.GlassContainer;
  import kenijey.harshenuniverse.network.HarshenNetwork;
  import kenijey.harshenuniverse.network.packets.MessagePacketSpawnBloodParticle;
  import kenijey.harshenuniverse.network.packets.MessagePacketSpawnItemParticles;
  import kenijey.harshenuniverse.objecthandlers.FaceRenderer;
  import kenijey.harshenuniverse.recipies.CauldronRecipes;
  import kenijey.harshenuniverse.recipies.HereticRitualRecipes;
  import net.minecraft.block.Block;
  import net.minecraft.block.state.IBlockState;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.init.Blocks;
  import net.minecraft.init.Items;
  import net.minecraft.init.SoundEvents;
  import net.minecraft.item.Item;
  import net.minecraft.item.ItemBucket;
  import net.minecraft.item.ItemStack;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.util.EnumFacing;
  import net.minecraft.util.EnumHand;
  import net.minecraft.util.SoundCategory;
  import net.minecraft.util.math.BlockPos;
  import net.minecraft.util.math.Vec3d;
  import net.minecraft.util.text.TextComponentTranslation;
  import net.minecraft.util.text.translation.I18n;
  import net.minecraftforge.common.capabilities.Capability;
  import net.minecraftforge.fluids.UniversalBucket;
  import net.minecraftforge.items.CapabilityItemHandler;
  
  public class TileEntityHereticCauldron extends BaseTileEntityHarshenSingleItemInventory
  {
  	boolean alterSameGlassContainer = false;
  	private int activeTimer = 0;
  	private int overstandingTimer = 0;
  	int layersDrained = 0;
  	public boolean isActive = false;
  	public boolean isActiveInBackground = false;
  	private ItemStack switchedItem = ItemStack.EMPTY;
  	private int[] drainPos = {50, 75, 100, Integer.MAX_VALUE};
  	private CauldronLiquid fluid = CauldronLiquid.NONE;
  	private int level = 0;
  	private CauldronLiquid workingFluid = CauldronLiquid.NONE;
  	private HereticRitualRecipes overstandingRecipe;
  	private HashMap<BlockPos, ItemStack> pedestalMap = new HashMap<>(); 
  	
  	@Override
  	public void tick() {
  		if(level <= 0 && fluid != CauldronLiquid.NONE)
  		{
  			level = 0;
  			fluid = CauldronLiquid.NONE;
  		}
  		else if(fluid == CauldronLiquid.NONE && level > 0)
  		{
  			level = 0;
  			fluid = CauldronLiquid.NONE;
  		}
  		if(isActive)
  		{
  			if(activeTimer++ > 175)
  			{
  				deactivate();
  				setItem(switchedItem);
  				layersDrained = 0;
  			}
  		}
  		if(overstandingRecipe != null)
  		{
  			if(!checkForHereticRitual(false))
  				killRitual();
  			else if(overstandingTimer-- <= 100)
  			{
  				for(TileEntityHarshenDimensionalPedestal pedestal : pedestals)
  				{
  					if(pedestal.getItem().getItem() == Items.AIR ||  new Random().nextInt(overstandingTimer / 2) == 0)
  					{
  						Vec3d vec = new Vec3d(pedestal.getPos()).addVector(0.5d, 0.9d, 0.5d);
  						HarshenNetwork.sendToPlayersInWorld(world, new MessagePacketSpawnItemParticles(pedestalMap.get(pedestal.getPos()), vec, 
  								HarshenUtils.speedToPos(vec, new Vec3d(this.pos).addVector(0.5, 2, 0.5), 20), (float)randPos() + 1f, false, 20, "cauldron_ritual"));
  						pedestal.deactiveateNonController();
  						pedestal.setItemAir();
  						continue;
  					}
  				}
  				ArrayList<BlockPos> localBloodPos = new ArrayList<>();
  				for(BlockPos pos : bloodPos)
  					if(new Random().nextInt(overstandingTimer / 2) == 0)
  						{
  							world.setBlockToAir(pos);
  							deletedBloodPos.add(pos);
  						}
  					else localBloodPos.add(pos);
  				bloodPos.clear();
  				for(BlockPos pos : localBloodPos)
  					bloodPos.add(pos);
  				boolean flag = !localBloodPos.isEmpty();
  				for(TileEntityHarshenDimensionalPedestal pedestal : pedestals)
  					if(!pedestal.getItem().isEmpty())
  						flag = true;
  				if(!flag)
  				{
  					pedestals.clear();
  					setActive(true);
  					overstandingRecipe = null;
  					pedestalMap.clear();
  				}
  			}
  			for(BlockPos pos : bloodPos)
  				for(int i = 0; i < 7; i ++)
  					{
  						Vec3d vec = new Vec3d(pos).addVector(randPos(), -0.1, randPos());
  						HarshenNetwork.sendToPlayersInWorld(world, new MessagePacketSpawnBloodParticle(vec, 
  								HarshenUtils.speedToPos(vec, new Vec3d(this.pos).addVector(0.5, 2, 0.5), 30), 1f, false));
  					}
  		}
  			
  		if(activeTimer >= drainPos[layersDrained])
  		{
  			if(layersDrained == 2)
  				setItem(switchedItem);
  			if(world.isRemote)
  				return;
  			double[] yPosOfDrains = {0.7D, 0.8D, 0.9D};
  			level--;
  			for(int i = 0; i < 35; i++)
  				HarshenUniverse.proxy.spawnParticle(EnumHarshenParticle.CAULDRON,
  						new Vec3d(pos).addVector((new Random().nextDouble() / 2) + 0.25D, yPosOfDrains[layersDrained], (new Random().nextDouble() / 2) + 0.25D), new Vec3d(0, 0.01d, 0), 1f, false,
  						workingFluid.getStateOrLoc());
  
  			reactivate(1);
  		}
  	}
  	
  	public boolean onActivated(EntityPlayer playerIn)
  	{
  		boolean isCreative = playerIn.capabilities.isCreativeMode;
  		if(isActiveInBackground || isActive)
  			return true;
  		ItemStack mainhandstack = playerIn.getHeldItemMainhand();
  		ItemStack offhandstack = playerIn.getHeldItemOffhand();
          Item mainhanditem = mainhandstack.getItem();
  		Item offhanditem = offhandstack.getItem();
  		int slot = playerIn.inventory.getSlotFor(mainhandstack);
          boolean flag;
          if(mainhanditem instanceof BloodCollector && (fluid ==  GlassContainerValues.BLOOD.getType() || fluid == CauldronLiquid.NONE) && !(offhanditem instanceof BloodCollector))
          {
          	if(level != 3)
          	{
          		if(!isCreative && ((BloodCollector)mainhanditem).getBloodLevel(playerIn, EnumHand.MAIN_HAND) < 1) return false;
          		if (!isCreative) ((BloodCollector)mainhanditem).remove(playerIn, EnumHand.MAIN_HAND, 1);
          		this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
          		level ++;
          		if (fluid == CauldronLiquid.NONE) fluid = GlassContainerValues.BLOOD.getType();
          		return true;
          	}
          }
          if(offhanditem instanceof BloodCollector && (fluid == GlassContainerValues.BLOOD.getType()) && !(mainhanditem instanceof BloodCollector))
          {
          	if(level > 0 && ((BloodCollector) offhanditem).getBloodLevel(playerIn, EnumHand.OFF_HAND) < BloodCollector.capacity)
          	{
          		this.world.playSound((EntityPlayer)null, pos, HarshenSounds.BLOOD_COLLECTOR_USE, SoundCategory.BLOCKS, 1.0F, 1.0F);
          		((BloodCollector) offhanditem).fill(playerIn, EnumHand.OFF_HAND, 1);
          		level --;
          		return true;
          	}
          }
          if(mainhanditem instanceof ItemBucket && level == 3)
          {
          	if(fluid ==  GlassContainerValues.WATER.getType())
          	{
          		this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
          		level -=3;
          		playerIn.getHeldItemMainhand().setCount(playerIn.getHeldItemMainhand().getCount()-1);
          		if(mainhandstack.getCount() < 1)
          			playerIn.inventory.setInventorySlotContents(slot, new ItemStack(Items.WATER_BUCKET));
          		else
          			playerIn.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
          		return true;
          	}
          	if(fluid ==  GlassContainerValues.LAVA.getType())
          	{
          		{
          			this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1.0F, 1.0F);
          			level -=3;
          			playerIn.getHeldItemMainhand().setCount(playerIn.getHeldItemMainhand().getCount()-1);
          			if(mainhandstack.getCount() < 1)
          				playerIn.inventory.setInventorySlotContents(slot, new ItemStack(Items.LAVA_BUCKET));
          			else
          				playerIn.addItemStackToInventory(new ItemStack(Items.LAVA_BUCKET));
          			return true;
          		}
          	}
          	if(fluid ==  GlassContainerValues.MILK.getType())
          	{
          		{
          			this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
          			level -=3;
          			playerIn.getHeldItemMainhand().setCount(playerIn.getHeldItemMainhand().getCount()-1);
          			if(mainhandstack.getCount() < 1)
          				playerIn.inventory.setInventorySlotContents(slot, new ItemStack(Items.MILK_BUCKET));
          			else
          				playerIn.addItemStackToInventory(new ItemStack(Items.MILK_BUCKET));
          			return true;
          		}
          	}
          }
          if(level == 0)
          {
          	if(mainhanditem == Items.WATER_BUCKET)
          	{
          		this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
          		fluid = GlassContainerValues.WATER.getType();
          		level +=3;
          		playerIn.getHeldItemMainhand().setCount(playerIn.getHeldItemMainhand().getCount()-1);
          		playerIn.inventory.setInventorySlotContents(slot, new ItemStack(Items.BUCKET));
          		return true;
          	}
          	if(mainhanditem == Items.LAVA_BUCKET)
          	{
          		this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_EMPTY_LAVA, SoundCategory.BLOCKS, 1.0F, 1.0F);
          		fluid = GlassContainerValues.LAVA.getType();
          		level +=3;
          		playerIn.getHeldItemMainhand().setCount(playerIn.getHeldItemMainhand().getCount()-1);
          		playerIn.inventory.setInventorySlotContents(slot, new ItemStack(Items.BUCKET));
          		return true;
          	}
          	if(mainhanditem == Items.MILK_BUCKET)
          	{
          		this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
          		fluid = GlassContainerValues.MILK.getType();
          		level +=3;
          		playerIn.getHeldItemMainhand().setCount(playerIn.getHeldItemMainhand().getCount()-1);
          		playerIn.inventory.setInventorySlotContents(slot, new ItemStack(Items.BUCKET));
          		return true;
          	}
          }
          
          CauldronLiquid potentionalLiquid = HarshenRegistry.getLiquidFromStack(mainhandstack);
          if(potentionalLiquid != null && (level == 0 || (fluid == potentionalLiquid && level + HarshenRegistry.getFill(mainhandstack) < 4)))
          {
          	if(mainhandstack.getItem() instanceof UniversalBucket) this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
          	if(mainhandstack.getItem() instanceof GlassContainer) this.world.playSound((EntityPlayer)null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
          	fluid = HarshenRegistry.getRelativeFluid(potentionalLiquid);
          	level += HarshenRegistry.getFill(mainhandstack);
  