package com.slugterra.capabilities;

import com.slugterra.inventory.InventorySlug;

import net.minecraft.nbt.NBTTagCompound;

public class SlugInv implements ISlugInv{
	
	public int invslot;
	public InventorySlug inventory = new InventorySlug();
	
	@Override
	public int getSlot() {
		return this.invslot;
	}
	
	@Override
	public void setSlot(int slot) {
		this.invslot = slot;
	}
	
	@Override
	public InventorySlug getInventory() {
		return this.inventory;
	}
	
	@Override
	public void loadInventory(NBTTagCompound inventory) {
		System.out.println("Reading Inventory Capability from NBT Storage!!!!");
		this.inventory.readFromNBT(inventory);
		inventory.setInteger("Slot", this.invslot);
	}
	
	@Override
	public void saveInventoryToNBT(NBTTagCompound inventory) {
		System.out.println("Writing Inventory Capability to NBT Storage!!!!");
		this.inventory.writeToNBT(inventory);
		this.invslot = inventory.getInteger("Slot");
	}
	
	@Override
	public void setInventory(InventorySlug inventory) {
		this.inventory = inventory;
	}
	
	public void increaseSlot(){
		if (invslot < 5)
			invslot++;
		else
			invslot = 0;

		inventory.getStackInSlot(invslot);
	}

	public void decreaseSlot(){
		if (invslot > 0)
			invslot--;
		else
			invslot = 5;

		inventory.getStackInSlot(invslot);
	}
	
}

@@ -513,150 +513,87 @@
 und 
-inventory) %7B%0A%09%09System.out.println(%22Reading Inventory Capability from NBT Storage!!!!%22);%0A%09%09this.inventory.readFromNBT(inventory);%0A%09%09inventory.s
+compound) %7B%0A%09%09this.inventory.readFromNBT(compound);%0A%09%09this.invslot = compound.g
 etIn
@@ -608,22 +608,8 @@
 lot%22
-, this.invslot
 );%0A%09
@@ -631,19 +631,29 @@
 %09public 
-voi
+NBTTagCompoun
 d saveIn
@@ -684,179 +684,124 @@
 und 
-inventory) %7B%0A%09%09System.out.println(%22Writing Inventory Capability to NBT Storage!!!!%22);%0A%09%09this.inventory.writeToNBT(inventory);%0A%09%09this.invslot = inventory.getInteger(%22Slot%22)
+compound) %7B%0A%09%09this.inventory.writeToNBT(compound);%0A%09%09compound.setInteger(%22Slot%22, this.invslot);%0A%09%09%0A%09%09return compound
 ;%0A%09%7D

Switch get and set Integer in NBT load and save