Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed unused, Knapsack, and Canister slots
- Loading branch information
1 parent
daa2368
commit 0413812
Showing
4 changed files
with
105 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package tconstruct.inventory; | ||
|
||
import tconstruct.items.armor.HeartCanister; | ||
import net.minecraft.inventory.IInventory; | ||
import net.minecraft.inventory.Slot; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Item; | ||
|
||
public class SlotCanister extends Slot | ||
{ | ||
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5) | ||
{ | ||
super(par2IInventory, par3, par4, par5); | ||
this.parent = container; | ||
} | ||
|
||
/** | ||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case | ||
* of armor slots) | ||
*/ | ||
public int getSlotStackLimit () | ||
{ | ||
return 10; | ||
} | ||
|
||
/** | ||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots. | ||
*/ | ||
public boolean isItemValid (ItemStack par1ItemStack) | ||
{ | ||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem()); | ||
return item != null && (item instanceof HeartCanister); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package tconstruct.inventory; | ||
|
||
import tconstruct.items.armor.Knapsack; | ||
import net.minecraft.inventory.IInventory; | ||
import net.minecraft.inventory.Slot; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Item; | ||
|
||
public class SlotKnapsack extends Slot | ||
{ | ||
public SlotKnapsack(IInventory par2IInventory, int par3, int par4, int par5) | ||
{ | ||
super(par2IInventory, par3, par4, par5); | ||
this.parent = container; | ||
} | ||
|
||
/** | ||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case | ||
* of armor slots) | ||
*/ | ||
public int getSlotStackLimit () | ||
{ | ||
return 1; | ||
} | ||
|
||
/** | ||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots. | ||
*/ | ||
public boolean isItemValid (ItemStack par1ItemStack) | ||
{ | ||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem()); | ||
return item != null && (item instanceof Knapsack); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package tconstruct.inventory; | ||
|
||
import net.minecraft.inventory.IInventory; | ||
import net.minecraft.inventory.Slot; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class SlotUnused extends Slot | ||
{ | ||
public SlotUnused(IInventory par2IInventory, int par3, int par4, int par5) | ||
{ | ||
super(par2IInventory, par3, par4, par5); | ||
} | ||
|
||
/** | ||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case | ||
* of armor slots) | ||
*/ | ||
public int getSlotStackLimit () | ||
{ | ||
return 0; | ||
} | ||
|
||
/** | ||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots. | ||
*/ | ||
public boolean isItemValid (ItemStack par1ItemStack) | ||
{ | ||
return false; | ||
} | ||
} |