fix for various unequip/ equip event fails
This commit is contained in:
Azanor committed 2014-08-07 09:30:13 +02:00
1 parent 3e8015e246
commit 2ef1fca7cb
6 files changed
+37 -11

No files matched your search

@@ -45,8 +45,13 @@ public class GuiPlayerExpanded extends InventoryEffectRenderer {
@Override
public void updateScreen()
{
try {
((ContainerPlayerExpanded)inventorySlots).baubles.blockEvents=false;
} catch (Exception e) { }
}
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@@ -55,6 +60,7 @@ public class GuiPlayerExpanded extends InventoryEffectRenderer {
{
this.buttonList.clear();
super.initGui();
}
/**
+1 -1
View File
@@ -24,7 +24,7 @@ public class Baubles {
public static final String MODID = "Baubles";
public static final String MODNAME = "Baubles";
public static final String VERSION = "1.0.1.2";
public static final String VERSION = "1.0.1.3";
@SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy")
public static CommonProxy proxy;
@@ -86,6 +86,7 @@ public class ContainerPlayerExpanded extends Container
}
this.onCraftMatrixChanged(this.craftMatrix);
}
/**
@@ -264,7 +265,18 @@ public class ContainerPlayerExpanded extends Container
}
}
protected boolean mergeItemStack(ItemStack par1ItemStack, int par2, int par3, boolean par4, Slot ss)
@Override
public void putStacksInSlots(ItemStack[] p_75131_1_) {
baubles.blockEvents=true;
super.putStacksInSlots(p_75131_1_);
}
protected boolean mergeItemStack(ItemStack par1ItemStack, int par2, int par3, boolean par4, Slot ss)
{
boolean flag1 = false;
int k = par2;
@@ -22,6 +22,7 @@ public class InventoryBaubles implements IInventory {
public ItemStack[] stackList;
private Container eventHandler;
public WeakReference<EntityPlayer> player;
public boolean blockEvents=false;
public InventoryBaubles(EntityPlayer player) {
this.stackList = new ItemStack[4];
@@ -95,12 +96,13 @@ public class InventoryBaubles implements IInventory {
if (this.stackList[par1].stackSize <= par2) {
itemstack = this.stackList[par1];
this.stackList[par1] = null;
if (itemstack != null && itemstack.getItem() instanceof IBauble) {
((IBauble) itemstack.getItem()).onUnequipped(itemstack,
player.get());
}
this.stackList[par1] = null;
if (eventHandler != null)
this.eventHandler.onCraftMatrixChanged(this);
@@ -108,15 +110,16 @@ public class InventoryBaubles implements IInventory {
return itemstack;
} else {
itemstack = this.stackList[par1].splitStack(par2);
if (this.stackList[par1].stackSize == 0) {
this.stackList[par1] = null;
}
if (itemstack != null && itemstack.getItem() instanceof IBauble) {
((IBauble) itemstack.getItem()).onUnequipped(itemstack,
player.get());
}
if (this.stackList[par1].stackSize == 0) {
this.stackList[par1] = null;
}
if (eventHandler != null)
this.eventHandler.onCraftMatrixChanged(this);
syncSlotToClients(par1);
@@ -133,11 +136,12 @@ public class InventoryBaubles implements IInventory {
*/
@Override
public void setInventorySlotContents(int par1, ItemStack stack) {
if(this.stackList[par1] != null) {
if(!blockEvents && this.stackList[par1] != null) {
((IBauble)stackList[par1].getItem()).onUnequipped(stackList[par1], player.get());
}
this.stackList[par1] = stack;
if (stack != null && stack.getItem() instanceof IBauble) {
if (!blockEvents && stack != null && stack.getItem() instanceof IBauble) {
((IBauble) stack.getItem()).onEquipped(stack, player.get());
}
if (eventHandler != null)