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.
This commit is contained in:
DarkGuardsman 2013-09-18 03:33:30 -04:00
parent 03ca8bde35
commit a41c3c7117
2 changed files with 12 additions and 10 deletions

View file

@ -202,17 +202,12 @@ public class DarkMain extends ModPrefab
dataList.add(new BlockData(CoreRecipeLoader.blockDebug, ItemBlockHolder.class, "DMDebug")); dataList.add(new BlockData(CoreRecipeLoader.blockDebug, ItemBlockHolder.class, "DMDebug"));
dataList.add(new BlockData(blockMulti, "DMDMultiBlock").addTileEntity("DMMultiBlock", TileEntityMulti.class).canDisable(false)); dataList.add(new BlockData(blockMulti, "DMDMultiBlock").addTileEntity("DMMultiBlock", TileEntityMulti.class).canDisable(false));
/* ITEMS */ /* 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)) 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); 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)) if (CONFIGURATION.get("general", "EnableBattery", true).getBoolean(true))
{ {
CoreRecipeLoader.battery = new ItemBattery("Battery", ITEM_ID_PREFIX++); 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.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(); CONFIGURATION.save();
/* CONFIG END */ /* CONFIG END */
return dataList; return dataList;

View file

@ -307,11 +307,13 @@ public class FluidHelper
{ {
IFluidHandler tank = (IFluidHandler) world.getBlockTileEntity(x, y, z); IFluidHandler tank = (IFluidHandler) world.getBlockTileEntity(x, y, z);
ItemStack reStack = FluidHelper.drainItem(current, tank, ForgeDirection.getOrientation(side), !entityplayer.capabilities.isCreativeMode); ItemStack reStack = FluidHelper.drainItem(current, tank, ForgeDirection.getOrientation(side), !entityplayer.capabilities.isCreativeMode);
boolean stackChanged = false;
if (reStack != null && reStack.isItemEqual(current)) if (reStack != null && reStack.isItemEqual(current))
{ {
reStack = FluidHelper.fillItem(current, tank, ForgeDirection.getOrientation(side), !entityplayer.capabilities.isCreativeMode); 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) if (current.stackSize > 1)
{ {
@ -327,7 +329,7 @@ public class FluidHelper
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, reStack); entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, reStack);
} }
} }
return true; return stackChanged;
} }
} }
return false; return false;