1
0
forked from xjboss/KCauldronX

Fix Thaumcraft bucket dupe (close #64)

This commit is contained in:
Prototik 2015-06-26 22:42:30 +07:00
parent 3647ee33f7
commit f6ba538998
2 changed files with 32 additions and 2 deletions

View File

@ -106,6 +106,28 @@
public int getFirstEmptyStack() public int getFirstEmptyStack()
{ {
for (int i = 0; i < this.mainInventory.length; ++i) for (int i = 0; i < this.mainInventory.length; ++i)
@@ -430,17 +505,17 @@
if (aitemstack[p_70298_1_] != null)
{
- ItemStack itemstack;
+ ItemStack itemstack = aitemstack[p_70298_1_];
- if (aitemstack[p_70298_1_].stackSize <= p_70298_2_)
+ if (itemstack.stackSize <= p_70298_2_)
{
- itemstack = aitemstack[p_70298_1_];
+ itemstack.stackSize = 0;
aitemstack[p_70298_1_] = null;
return itemstack;
}
else
{
- itemstack = aitemstack[p_70298_1_].splitStack(p_70298_2_);
+ itemstack = itemstack.splitStack(p_70298_2_);
if (aitemstack[p_70298_1_].stackSize == 0)
{
@@ -658,7 +733,7 @@ @@ -658,7 +733,7 @@
if (this.mainInventory[i] != null) if (this.mainInventory[i] != null)
{ {

View File

@ -159,7 +159,15 @@
int l = this.theWorld.getBlockMetadata(p_73084_1_, p_73084_2_, p_73084_3_); int l = this.theWorld.getBlockMetadata(p_73084_1_, p_73084_2_, p_73084_3_);
this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, p_73084_1_, p_73084_2_, p_73084_3_, Block.getIdFromBlock(block) + (this.theWorld.getBlockMetadata(p_73084_1_, p_73084_2_, p_73084_3_) << 12)); this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, p_73084_1_, p_73084_2_, p_73084_3_, Block.getIdFromBlock(block) + (this.theWorld.getBlockMetadata(p_73084_1_, p_73084_2_, p_73084_3_) << 12));
boolean flag = false; boolean flag = false;
@@ -350,57 +416,105 @@ @@ -312,6 +378,7 @@
public boolean tryUseItem(EntityPlayer p_73085_1_, World p_73085_2_, ItemStack p_73085_3_)
{
int i = p_73085_3_.stackSize;
+ if (i <= 0) return false;
int j = p_73085_3_.getItemDamage();
ItemStack itemstack1 = p_73085_3_.useItemRightClick(p_73085_2_, p_73085_1_);
@@ -350,57 +417,105 @@
public boolean activateBlockOrUseItem(EntityPlayer p_73078_1_, World p_73078_2_, ItemStack p_73078_3_, int p_73078_4_, int p_73078_5_, int p_73078_6_, int p_73078_7_, float p_73078_8_, float p_73078_9_, float p_73078_10_) public boolean activateBlockOrUseItem(EntityPlayer p_73078_1_, World p_73078_2_, ItemStack p_73078_3_, int p_73078_4_, int p_73078_5_, int p_73078_6_, int p_73078_7_, float p_73078_8_, float p_73078_9_, float p_73078_10_)
{ {
@ -264,7 +272,7 @@
+ // Cauldron end + // Cauldron end
+ } + }
+ +
+ if (p_73078_3_ != null && !denyResult) + if (p_73078_3_ != null && !denyResult && p_73078_3_.stackSize > 0)
{ {
- p_73078_3_.setItemDamage(meta); - p_73078_3_.setItemDamage(meta);
- p_73078_3_.stackSize = size; - p_73078_3_.stackSize = size;