From 406ba2588c9e450a023a4721a6d2aded25f40875 Mon Sep 17 00:00:00 2001 From: Azanor Date: Tue, 1 Aug 2017 13:18:54 +0200 Subject: [PATCH] fixes to shift clicking (closes #194) --- build.gradle | 4 ++-- src/main/java/baubles/common/Baubles.java | 2 +- .../common/container/ContainerPlayerExpanded.java | 10 ++++++---- src/main/java/baubles/common/container/SlotBauble.java | 9 ++++++--- src/main/resources/changelog.txt | 3 +++ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index c7ce5eeb..cf6a96cd 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle.forge' -version = "1.11-1.4.5" +version = "1.11-1.4.6" group= "com.azanor.baubles" archivesBaseName = "Baubles" @@ -21,7 +21,7 @@ srcCompat = JavaVersion.VERSION_1_8 targetCompat = JavaVersion.VERSION_1_8 minecraft { - version = "1.11-13.19.0.2180" + version = "1.11-13.19.1.2189" runDir = "run" mappings = "snapshot_20170502" makeObfSourceJar = false diff --git a/src/main/java/baubles/common/Baubles.java b/src/main/java/baubles/common/Baubles.java index 4d03a6b0..1dc9c7f9 100644 --- a/src/main/java/baubles/common/Baubles.java +++ b/src/main/java/baubles/common/Baubles.java @@ -39,7 +39,7 @@ public class Baubles { public static final String MODID = "baubles"; public static final String MODNAME = "Baubles"; - public static final String VERSION = "1.4.5"; + public static final String VERSION = "1.4.6"; @SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy") public static CommonProxy proxy; diff --git a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java index dc4e551d..c9e67743 100644 --- a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java +++ b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java @@ -121,7 +121,6 @@ public String getSlotTexture() }); this.onCraftMatrixChanged(this.craftMatrix); - } /** @@ -276,11 +275,14 @@ else if (!this.mergeItemStack(itemstack1, 9+ slotShift, 45+ slotShift, false)) { return ItemStack.EMPTY; } - - slot.onTake(playerIn, itemstack1); + + if (itemstack1.isEmpty() && !baubles.isEventBlocked() && slot instanceof SlotBauble && + itemstack.hasCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null)) { + itemstack.getCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null).onUnequipped(itemstack, playerIn); + } ItemStack itemstack2 = slot.onTake(playerIn, itemstack1); - + if (index == 0) { playerIn.dropItem(itemstack2, false); diff --git a/src/main/java/baubles/common/container/SlotBauble.java b/src/main/java/baubles/common/container/SlotBauble.java index 56cfcdc7..008f4dde 100644 --- a/src/main/java/baubles/common/container/SlotBauble.java +++ b/src/main/java/baubles/common/container/SlotBauble.java @@ -42,7 +42,6 @@ public boolean canTakeStack(EntityPlayer player) { @Override public ItemStack onTake(EntityPlayer playerIn, ItemStack stack) { - if (!getHasStack() && !((IBaublesItemHandler)getItemHandler()).isEventBlocked() && stack.hasCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null)) { stack.getCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null).onUnequipped(stack, playerIn); @@ -53,14 +52,18 @@ public ItemStack onTake(EntityPlayer playerIn, ItemStack stack) { @Override public void putStack(ItemStack stack) { - if (getHasStack() && !((IBaublesItemHandler)getItemHandler()).isEventBlocked() && + if (getHasStack() && !ItemStack.areItemStacksEqual(stack,getStack()) && + !((IBaublesItemHandler)getItemHandler()).isEventBlocked() && getStack().hasCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null)) { getStack().getCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null).onUnequipped(getStack(), player); } + + ItemStack oldstack = getStack().copy(); super.putStack(stack); - if (this.getHasStack() && !((IBaublesItemHandler)getItemHandler()).isEventBlocked() && + if (this.getHasStack() && !ItemStack.areItemStacksEqual(oldstack,getStack()) && + !((IBaublesItemHandler)getItemHandler()).isEventBlocked() && getStack().hasCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null)) { getStack().getCapability(BaublesCapabilities.CAPABILITY_ITEM_BAUBLE, null).onEquipped(getStack(), player); } diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index da1fd590..ac8b7478 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,3 +1,6 @@ +1.4.6 +- added IBauble as a capability (see https://github.com/Azanor/Baubles/pull/208) + 1.4.5 - fixes for localization bug