From a41c3c7117ec1671e9b60364b21ec54e2bbb5baa Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Wed, 18 Sep 2013 03:33:30 -0400 Subject: [PATCH] Changed Fluid item handler to return right The item handler for FluidHelper fluid item interaction now returns true only if the itemStack changed. This way right click with non-fluid container items will work. --- src/dark/core/common/DarkMain.java | 16 ++++++++-------- src/dark/core/prefab/helpers/FluidHelper.java | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/dark/core/common/DarkMain.java b/src/dark/core/common/DarkMain.java index baaeefe6..31984d85 100644 --- a/src/dark/core/common/DarkMain.java +++ b/src/dark/core/common/DarkMain.java @@ -202,17 +202,12 @@ public class DarkMain extends ModPrefab dataList.add(new BlockData(CoreRecipeLoader.blockDebug, ItemBlockHolder.class, "DMDebug")); dataList.add(new BlockData(blockMulti, "DMDMultiBlock").addTileEntity("DMMultiBlock", TileEntityMulti.class).canDisable(false)); /* ITEMS */ + CoreRecipeLoader.itemTool = new ItemTools(ITEM_ID_PREFIX++, DarkMain.CONFIGURATION); + if (CONFIGURATION.get("general", "LoadOreItems", true, "Only disable ore items if you have another mod that provides metal dust, ingots, and plates").getBoolean(true)) { CoreRecipeLoader.itemMetals = new ItemOreDirv(ITEM_ID_PREFIX++, CONFIGURATION); } - if (CONFIGURATION.get("general", "LoadCraftingParts", true, "Only disable this if you do not plan to craft, or are not using any mods that need these parts.").getBoolean(true)) - { - CoreRecipeLoader.itemParts = new ItemParts(ITEM_ID_PREFIX++, CONFIGURATION); - CoreRecipeLoader.itemRefinedSand = new ItemColoredDust(CONFIGURATION.getItem(Configuration.CATEGORY_ITEM, "RefinedSandItemID", ITEM_ID_PREFIX++).getInt(), "RefinedSand"); - CoreRecipeLoader.itemGlowingSand = new ItemColoredDust(CONFIGURATION.getItem(Configuration.CATEGORY_ITEM, "GlowingRefinedSandItemID", ITEM_ID_PREFIX++).getInt(), "GlowRefinedSand"); - - } if (CONFIGURATION.get("general", "EnableBattery", true).getBoolean(true)) { CoreRecipeLoader.battery = new ItemBattery("Battery", ITEM_ID_PREFIX++); @@ -221,8 +216,13 @@ public class DarkMain extends ModPrefab { CoreRecipeLoader.wrench = new ItemWrench(ITEM_ID_PREFIX++, DarkMain.CONFIGURATION); } - CoreRecipeLoader.itemTool = new ItemTools(ITEM_ID_PREFIX++, DarkMain.CONFIGURATION); + if (CONFIGURATION.get("general", "LoadCraftingParts", true, "Only disable this if you do not plan to craft, or are not using any mods that need these parts.").getBoolean(true)) + { + CoreRecipeLoader.itemParts = new ItemParts(ITEM_ID_PREFIX++, CONFIGURATION); + CoreRecipeLoader.itemRefinedSand = new ItemColoredDust(CONFIGURATION.getItem(Configuration.CATEGORY_ITEM, "RefinedSandItemID", ITEM_ID_PREFIX++).getInt(), "RefinedSand"); + CoreRecipeLoader.itemGlowingSand = new ItemColoredDust(CONFIGURATION.getItem(Configuration.CATEGORY_ITEM, "GlowingRefinedSandItemID", ITEM_ID_PREFIX++).getInt(), "GlowRefinedSand"); + } CONFIGURATION.save(); /* CONFIG END */ return dataList; diff --git a/src/dark/core/prefab/helpers/FluidHelper.java b/src/dark/core/prefab/helpers/FluidHelper.java index 0d4dc2cb..1afef69a 100644 --- a/src/dark/core/prefab/helpers/FluidHelper.java +++ b/src/dark/core/prefab/helpers/FluidHelper.java @@ -307,11 +307,13 @@ public class FluidHelper { IFluidHandler tank = (IFluidHandler) world.getBlockTileEntity(x, y, z); ItemStack reStack = FluidHelper.drainItem(current, tank, ForgeDirection.getOrientation(side), !entityplayer.capabilities.isCreativeMode); + boolean stackChanged = false; if (reStack != null && reStack.isItemEqual(current)) { reStack = FluidHelper.fillItem(current, tank, ForgeDirection.getOrientation(side), !entityplayer.capabilities.isCreativeMode); } - if (!entityplayer.capabilities.isCreativeMode && (reStack == null || !reStack.isItemEqual(current))) + stackChanged = reStack == null || !reStack.isItemEqual(current); + if (!entityplayer.capabilities.isCreativeMode && stackChanged) { if (current.stackSize > 1) { @@ -327,7 +329,7 @@ public class FluidHelper entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, reStack); } } - return true; + return stackChanged; } } return false;