From d6baa4fb647d0d0b755835c4759a16df831a64e7 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Fri, 3 Jul 2015 00:04:51 -0400 Subject: [PATCH 01/12] Fix dupe bug with Steve's Factory Manager --- .../minecraft/storagedrawers/inventory/InventoryStack.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/inventory/InventoryStack.java b/src/com/jaquadro/minecraft/storagedrawers/inventory/InventoryStack.java index bca15e963..e3fb0514d 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/inventory/InventoryStack.java +++ b/src/com/jaquadro/minecraft/storagedrawers/inventory/InventoryStack.java @@ -43,9 +43,10 @@ public void setInStack (ItemStack stack) { applyDiff(stack.stackSize - inCount); } - inStack = stack; + inStack = null; syncInStack(); - syncOutStack(); + + setOutStack(outStack); } private void syncInStack () { From ea80bc03dce93f0a05b1567fc3de0eb485096057 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Fri, 3 Jul 2015 00:41:37 -0400 Subject: [PATCH 02/12] Render labels with polygon offset (may reduce flicker) --- build.gradle | 2 +- .../client/renderer/TileEntityDrawersRenderer.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 0bca0a23c..921d09cb0 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.5.9" +version = "1.7.10-1.5.10" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" diff --git a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java index 71ba26f11..b0694fa39 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java +++ b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java @@ -101,6 +101,9 @@ public void renderItemIntoGUI (FontRenderer fontRenderer, TextureManager texMana if (renderWithColor) GL11.glColor4f(r, g, b, 1.0F); + GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); + GL11.glPolygonOffset(-1f, -1); + GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -113,9 +116,9 @@ public void renderItemIntoGUI (FontRenderer fontRenderer, TextureManager texMana if (renderEffect && itemStack.hasEffect(i)) renderEffect(texManager, x, y); - } - + GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); + } } @Override @@ -201,11 +204,15 @@ private void renderItemIntoGUIBlock (FontRenderer fontRenderer, TextureManager t GL11.glColor4f(r * 1, g * 1, b * 1, 1.0F); GL11.glRotatef(-90, 0, 1, 0); + GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); + GL11.glPolygonOffset(0, 1f); this.renderBlocksRi.useInventoryTint = this.renderWithColor; this.renderBlocksRi.renderBlockAsItem(block, itemStack.getItemDamage(), 1); this.renderBlocksRi.useInventoryTint = true; + GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); + if (block.getRenderBlockPass() == 0) GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); @@ -460,7 +467,7 @@ private void renderFastItem (ItemStack itemStack, TileEntityDrawers tile, int sl GL11.glPushMatrix(); alignRendering(side); - moveRendering(size, getOffsetXForSide(side, xunit) * 16 - (8 * size), 12.25f - yunit, .999f - depth + block.trimDepth); + moveRendering(size, getOffsetXForSide(side, xunit) * 16 - (8 * size), 12.25f - yunit, 1f - depth + block.trimDepth); List renderHandlers = StorageDrawers.renderRegistry.getRenderHandlers(); for (int i = 0, n = renderHandlers.size(); i < n; i++) { From db064d0cb6bb561291b7ee4e8ef4e05cfeaad451 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Wed, 8 Jul 2015 23:36:23 -0400 Subject: [PATCH 03/12] Fix thaumcraft label flicker --- build.gradle | 4 ++-- .../minecraft/storagedrawers/integration/Thaumcraft.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 921d09cb0..0bb356edc 100644 --- a/build.gradle +++ b/build.gradle @@ -17,12 +17,12 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.5.10" +version = "1.7.10-1.5.11" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" minecraft { - version = "1.7.10-10.13.3.1408-1.7.10" + version = "1.7.10-10.13.4.1481-1.7.10" assetDir = "runtime/assets" replace '@VERSION@', project.version diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/Thaumcraft.java b/src/com/jaquadro/minecraft/storagedrawers/integration/Thaumcraft.java index 4d56ef6c6..7d8c2a266 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/integration/Thaumcraft.java +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/Thaumcraft.java @@ -173,6 +173,9 @@ public void render (TileEntity tileEntity, IDrawerGroup drawerGroup, int slot, f GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); + GL11.glPolygonOffset(-1f, -1); + ResourceLocation aspectResource = aspect.getImage(); Minecraft.getMinecraft().renderEngine.bindTexture(aspectResource); @@ -184,6 +187,8 @@ public void render (TileEntity tileEntity, IDrawerGroup drawerGroup, int slot, f tessellator.addVertexWithUV(x, y, 0, 0, 0); tessellator.draw(); + GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); + GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); From eb0fe3fda91ce54da16ef311ef928ba1a9d37226 Mon Sep 17 00:00:00 2001 From: ganymedes01 Date: Fri, 10 Jul 2015 12:22:36 -0300 Subject: [PATCH 04/12] OreDictionary all the things. Closes #118 --- .../storagedrawers/core/ModRecipes.java | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java index 1fa9b8338..1124113a4 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java @@ -15,24 +15,26 @@ public class ModRecipes { public void init () { + OreDictionary.registerOre("chestWood", new ItemStack(Blocks.chest)); // Remove when porting to 1.8 + ConfigManager config = StorageDrawers.config; for (int i = 0; i < BlockWood.field_150096_a.length; i++) { if (config.isBlockEnabled("fulldrawers1")) - GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), i), "xxx", " y ", "xxx", - 'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), i), "xxx", " y ", "xxx", + 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); if (config.isBlockEnabled("fulldrawers2")) - GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), i), "xyx", "xxx", "xyx", - 'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), i), "xyx", "xxx", "xyx", + 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); if (config.isBlockEnabled("halfdrawers2")) - GameRegistry.addRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), i), "xyx", "xxx", "xyx", - 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', Blocks.chest); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), i), "xyx", "xxx", "xyx", + 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', "chestWood")); if (config.isBlockEnabled("fulldrawers4")) - GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), i), "yxy", "xxx", "yxy", - 'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), i), "yxy", "xxx", "yxy", + 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); if (config.isBlockEnabled("halfdrawers4")) - GameRegistry.addRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), i), "yxy", "xxx", "yxy", - 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', Blocks.chest); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), i), "yxy", "xxx", "yxy", + 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', "chestWood")); if (config.isBlockEnabled("trim")) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), i), "xyx", "yyy", "xyx", 'x', "stickWood", 'y', new ItemStack(Blocks.planks, 1, i))); @@ -42,61 +44,61 @@ public void init () { // Fallback recipes if (config.isBlockEnabled("fulldrawers1")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), 0), "xxx", " y ", "xxx", - 'x', "plankWood", 'y', Blocks.chest)); + 'x', "plankWood", 'y', "chestWood")); if (config.isBlockEnabled("fulldrawers2")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), 0), "xyx", "xxx", "xyx", - 'x', "plankWood", 'y', Blocks.chest)); + 'x', "plankWood", 'y', "chestWood")); if (config.isBlockEnabled("halfdrawers2")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), 0), "xyx", "xxx", "xyx", - 'x', "plankWood", 'y', Blocks.chest)); + 'x', "plankWood", 'y', "chestWood")); if (config.isBlockEnabled("fulldrawers4")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), 0), "yxy", "xxx", "yxy", - 'x', "slabWood", 'y', Blocks.chest)); + 'x', "slabWood", 'y', "chestWood")); if (config.isBlockEnabled("halfdrawers4")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), 0), "yxy", "xxx", "yxy", - 'x', "slabWood", 'y', Blocks.chest)); + 'x', "slabWood", 'y', "chestWood")); if (config.isBlockEnabled("trim")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), 0), "xyx", "yyy", "xyx", 'x', "stickWood", 'y', "plankWood")); if (config.isBlockEnabled("compdrawers")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.compDrawers, config.getBlockRecipeOutput("compdrawers")), "xxx", "zwz", "xyx", - 'x', new ItemStack(Blocks.stone), 'y', Items.iron_ingot, 'z', new ItemStack(Blocks.piston), 'w', "drawerBasic")); + 'x', new ItemStack(Blocks.stone), 'y', "ingotIron", 'z', new ItemStack(Blocks.piston), 'w', "drawerBasic")); if (config.isBlockEnabled("controller")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.controller), "xxx", "yzy", "xwx", - 'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', "drawerBasic", 'w', Items.diamond)); + 'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', "drawerBasic", 'w', "gemDiamond")); if (config.isBlockEnabled("controllerSlave")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.controllerSlave), "xxx", "yzy", "xwx", - 'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', "drawerBasic", 'w', Items.gold_ingot)); + 'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', "drawerBasic", 'w', "ingotGold")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx", 'x', "stickWood", 'y', "drawerBasic")); if (config.cache.enableStorageUpgrades) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 2), "xyx", "yzy", "xyx", - 'x', Items.iron_ingot, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + 'x', "ingotIron", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 3), "xyx", "yzy", "xyx", - 'x', Items.gold_ingot, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + 'x', "ingotGold", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 4), "xyx", "yzy", "xyx", 'x', Blocks.obsidian, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 5), "xyx", "yzy", "xyx", - 'x', Items.diamond, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + 'x', "gemDiamond", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 6), "xyx", "yzy", "xyx", - 'x', Items.emerald, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + 'x', "gemEmerald", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); } if (config.cache.enableIndicatorUpgrades) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeStatus, 1, 1), "wyw", "yzy", "xyx", - 'w', new ItemStack(Blocks.redstone_torch), 'x', Items.redstone, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + 'w', new ItemStack(Blocks.redstone_torch), 'x', "dustRedstone", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeStatus, 1, 2), "wyw", "yzy", "xyx", - 'w', Items.comparator, 'x', Items.redstone, 'y', "stickWood", 'z', ModItems.upgradeTemplate)); + 'w', Items.comparator, 'x', "dustRedstone", 'y', "stickWood", 'z', ModItems.upgradeTemplate)); } if (config.cache.enableLockUpgrades) { - GameRegistry.addRecipe(new ItemStack(ModItems.upgradeLock), "xy ", " y ", " z ", - 'x', Items.gold_nugget, 'y', Items.gold_ingot, 'z', ModItems.upgradeTemplate); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeLock), "xy ", " y ", " z ", + 'x', "nuggetGold", 'y', "ingotGold", 'z', ModItems.upgradeTemplate)); } if (config.cache.enableVoidUpgrades) { From f4ea33db4e196e094373eee261c2b49790a756f0 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 12 Jul 2015 02:21:59 -0400 Subject: [PATCH 05/12] Fix conversion rate bug in compacting drawers for some descending lookups; add more debug logging. --- build.gradle | 2 +- .../block/tile/TileEntityDrawersComp.java | 27 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 0bb356edc..38ec38031 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.5.11" +version = "1.7.10-1.5.12" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java index a55eb1927..6b37560cd 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java @@ -9,6 +9,7 @@ import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; import com.jaquadro.minecraft.storagedrawers.network.CountUpdateMessage; import com.jaquadro.minecraft.storagedrawers.storage.*; +import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.registry.GameData; @@ -19,9 +20,12 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; +import org.apache.logging.log4j.Level; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class TileEntityDrawersComp extends TileEntityDrawers { @@ -181,6 +185,9 @@ private void populateSlots (ItemStack stack) { ItemStack lTier1 = findLowerTier(stack); if (lTier1 != null) { + if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) + FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Picked candidate " + lTier1.toString() + " with conv=" + lookupSizeResult); + populateSlot(index++, lTier1, 1); for (int i = 0; i < index - 1; i++) convRate[i] *= lookupSizeResult; @@ -191,6 +198,9 @@ private void populateSlots (ItemStack stack) { ItemStack lTier2 = findLowerTier(lTier1); if (lTier2 != null) { + if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) + FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Picked candidate " + lTier2.toString() + " with conv=" + lookupSizeResult); + populateSlot(index++, lTier2, 1); for (int i = 0; i < index - 1; i++) convRate[i] *= lookupSizeResult; @@ -246,6 +256,7 @@ private ItemStack findLowerTier (ItemStack stack) { List recipeList = cm.getRecipeList(); List candidates = new ArrayList(); + Map candidatesRate = new HashMap(); for (int i = 0, n = recipeList.size(); i < n; i++) { IRecipe recipe = (IRecipe) recipeList.get(i); @@ -278,16 +289,26 @@ private ItemStack findLowerTier (ItemStack stack) { if (DrawerData.areItemsEqual(match, comp) && comp.stackSize == recipe.getRecipeSize()) { lookupSizeResult = recipe.getRecipeSize(); candidates.add(match); + candidatesRate.put(match, lookupSizeResult); + + if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) + FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Found descending candidate for " + stack.toString() + ": " + match.toString() + " size=" + lookupSizeResult + ", inverse=" + comp.toString()); } } } ItemStack modMatch = findMatchingModCandidate(stack, candidates); - if (modMatch != null) + if (modMatch != null) { + lookupSizeResult = candidatesRate.get(modMatch); return modMatch; + } + + if (candidates.size() > 0) { + ItemStack match = candidates.get(0); + lookupSizeResult = candidatesRate.get(match); - if (candidates.size() > 0) - return candidates.get(0); + return match; + } return null; } From 453fded95e034cf65b28895c5010899ca6360b16 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 12 Jul 2015 02:24:38 -0400 Subject: [PATCH 06/12] Whitelist a few more nuggets because TCon oreberries. --- .../minecraft/storagedrawers/config/OreDictRegistry.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java b/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java index b603f6935..1cf2dcb04 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java @@ -52,6 +52,10 @@ public OreDictRegistry () { addBlacklistPrefix("dye"); addWhitelist("nuggetIron"); + addWhitelist("nuggetAluminum"); + addWhitelist("nuggetAluminium"); + addWhitelist("nuggetTin"); + addWhitelist("nuggetCopper"); } public boolean addBlacklist (String entry) { From 183fbb8477084b3f3035809a7b3added914aaed4 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 15 Aug 2015 01:26:09 -0400 Subject: [PATCH 07/12] Use ExU compressed sand in comp drawers if mod is loaded --- .../minecraft/storagedrawers/config/CompTierRegistry.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/CompTierRegistry.java b/src/com/jaquadro/minecraft/storagedrawers/config/CompTierRegistry.java index de1633943..bf93694cf 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/CompTierRegistry.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/CompTierRegistry.java @@ -1,5 +1,6 @@ package com.jaquadro.minecraft.storagedrawers.config; +import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -25,7 +26,9 @@ public CompTierRegistry () { register(new ItemStack(Blocks.nether_brick), new ItemStack(Items.netherbrick), 4); register(new ItemStack(Blocks.quartz_block), new ItemStack(Items.quartz), 4); register(new ItemStack(Blocks.melon_block), new ItemStack(Items.melon), 9); - register(new ItemStack(Blocks.sandstone), new ItemStack(Blocks.sand), 4); + + if (!Loader.isModLoaded("ExtraUtilities")) + register(new ItemStack(Blocks.sandstone), new ItemStack(Blocks.sand), 4); } public boolean register (ItemStack upper, ItemStack lower, int convRate) { From e8788c179fb0ea81b00ddcf3bf6749e6f5228e95 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 15 Aug 2015 01:26:45 -0400 Subject: [PATCH 08/12] Add common metals (nugget, ingot, block, ore) to conversion whitelist --- .../storagedrawers/config/OreDictRegistry.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java b/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java index 1cf2dcb04..169b038cf 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/OreDictRegistry.java @@ -51,11 +51,17 @@ public OreDictRegistry () { addBlacklistPrefix("list"); addBlacklistPrefix("dye"); - addWhitelist("nuggetIron"); - addWhitelist("nuggetAluminum"); - addWhitelist("nuggetAluminium"); - addWhitelist("nuggetTin"); - addWhitelist("nuggetCopper"); + for (String item : new String[] { "oreIron", "oreGold", "oreAluminum", "oreAluminium", "oreTin", "oreCopper", "oreLead", "oreSilver", "orePlatinum", "oreNickel" }) + addWhitelist(item); + + for (String item : new String[] { "blockIron", "blockGold", "blockAluminum", "blockAluminium", "blockTin", "blockCopper", "blockLead", "blockSilver", "blockPlatinum", "blockeNickel" }) + addWhitelist(item); + + for (String item : new String[] { "ingotIron", "ingotGold", "ingotAluminum", "ingotAluminium", "ingotTin", "ingotCopper", "ingotLead", "ingotSilver", "ingotPlatinum", "ingotNickel" }) + addWhitelist(item); + + for (String item : new String[] { "nuggetIron", "nuggetGold", "nuggetAluminum", "nuggetAluminium", "nuggetTin", "nuggetCopper", "nuggetLead", "nuggetSilver", "nuggetPlatinum", "nuggetNickel" }) + addWhitelist(item); } public boolean addBlacklist (String entry) { From d7997d312992877c1e270e2c4892548f71fe6bfd Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 15 Aug 2015 01:28:30 -0400 Subject: [PATCH 09/12] Make ore dictionary matching non-strict for comp tier lookups; ascending lookups also prefer same-mod candidates --- build.gradle | 2 +- .../block/tile/TileEntityDrawersComp.java | 64 +++++++++++++++---- .../storage/BaseDrawerData.java | 6 +- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 38ec38031..dae56c9d4 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.5.12" +version = "1.7.10-1.5.13" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java index 6b37560cd..9f1e3fd1f 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersComp.java @@ -222,27 +222,69 @@ private ItemStack findHigherTier (ItemStack stack) { } CraftingManager cm = CraftingManager.getInstance(); + List candidates = new ArrayList(); setupLookup(lookup3, stack); - ItemStack match = cm.findMatchingRecipe(lookup3, worldObj); + List fwdCandidates = findAllMatchingRecipes(lookup3); - if (match == null || match.getItem() == null) { + if (fwdCandidates.size() == 0) { setupLookup(lookup2, stack); - match = cm.findMatchingRecipe(lookup2, worldObj); + fwdCandidates = findAllMatchingRecipes(lookup2); } - if (match != null && match.getItem() != null) { + if (fwdCandidates.size() > 0) { int size = lookupSizeResult; - setupLookup(lookup1, match); - ItemStack comp = cm.findMatchingRecipe(lookup1, worldObj); - if (!DrawerData.areItemsEqual(comp, stack) || comp.stackSize != size) - return null; + for (int i = 0, n1 = fwdCandidates.size(); i < n1; i++) { + ItemStack match = fwdCandidates.get(i); + setupLookup(lookup1, match); + List backCandidates = findAllMatchingRecipes(lookup1); + + for (int j = 0, n2 = backCandidates.size(); j < n2; j++) { + ItemStack comp = backCandidates.get(j); + if (comp.stackSize != size) + continue; + + if (!DrawerData.areItemsEqual(comp, stack, false)) + continue; + + candidates.add(match); + if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) + FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "Found ascending candidate for " + stack.toString() + ": " + match.toString() + " size=" + lookupSizeResult + ", inverse=" + comp.toString()); + + break; + } + } lookupSizeResult = size; } - return match; + ItemStack modMatch = findMatchingModCandidate(stack, candidates); + if (modMatch != null) + return modMatch; + + if (candidates.size() > 0) + return candidates.get(0); + + return null; + } + + private List findAllMatchingRecipes (InventoryCrafting crafting) { + List candidates = new ArrayList(); + + CraftingManager cm = CraftingManager.getInstance(); + List recipeList = cm.getRecipeList(); + + for (int i = 0, n = recipeList.size(); i < n; i++) { + IRecipe recipe = (IRecipe) recipeList.get(i); + if (recipe.matches(crafting, worldObj)) { + ItemStack result = recipe.getCraftingResult(crafting); + if (result != null && result.getItem() != null) + candidates.add(result); + } + } + + return candidates; } private ItemStack findLowerTier (ItemStack stack) { @@ -263,7 +305,7 @@ private ItemStack findLowerTier (ItemStack stack) { ItemStack match = null; ItemStack output = recipe.getRecipeOutput(); - if (!DrawerData.areItemsEqual(stack, output)) + if (!DrawerData.areItemsEqual(stack, output, false)) continue; IRecipeHandler handler = StorageDrawers.recipeHandlerRegistry.getRecipeHandler(recipe.getClass()); @@ -286,7 +328,7 @@ private ItemStack findLowerTier (ItemStack stack) { if (match != null) { setupLookup(lookup1, stack); ItemStack comp = cm.findMatchingRecipe(lookup1, worldObj); - if (DrawerData.areItemsEqual(match, comp) && comp.stackSize == recipe.getRecipeSize()) { + if (DrawerData.areItemsEqual(match, comp, false) && comp.stackSize == recipe.getRecipeSize()) { lookupSizeResult = recipe.getRecipeSize(); candidates.add(match); candidatesRate.put(match, lookupSizeResult); diff --git a/src/com/jaquadro/minecraft/storagedrawers/storage/BaseDrawerData.java b/src/com/jaquadro/minecraft/storagedrawers/storage/BaseDrawerData.java index fb8a86068..ab1ee761e 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/storage/BaseDrawerData.java +++ b/src/com/jaquadro/minecraft/storagedrawers/storage/BaseDrawerData.java @@ -150,6 +150,10 @@ public boolean areItemsEqual (ItemStack item) { } public static boolean areItemsEqual (ItemStack stack1, ItemStack stack2) { + return areItemsEqual(stack1, stack2, true); + } + + public static boolean areItemsEqual (ItemStack stack1, ItemStack stack2, boolean oreDictStrictMode) { if (stack1 == null || stack2 == null) return false; if (stack1.getItem() == null || stack2.getItem() == null) @@ -175,7 +179,7 @@ public static boolean areItemsEqual (ItemStack stack1, ItemStack stack2) { continue; String name = OreDictionary.getOreName(id1); - if (StorageDrawers.oreDictRegistry.isEntryValid(name)) { + if (!oreDictStrictMode || StorageDrawers.oreDictRegistry.isEntryValid(name)) { oreMatch = true; break; } From 4aa1ba1081a452ce69fa3b184a1f7b29038be1d0 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 15 Aug 2015 23:00:39 -0400 Subject: [PATCH 10/12] Make gui digits readable for unicode font. --- build.gradle | 2 +- .../client/renderer/StorageRenderItem.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index dae56c9d4..15a5e2671 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.5.13" +version = "1.7.10-1.5.14" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" diff --git a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java index 3581a676c..b1508f821 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java +++ b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java @@ -22,17 +22,26 @@ public void renderItemOverlayIntoGUI (FontRenderer font, TextureManager texManag if (item != null) { float scale = .5f; + float xoff = 0; + if (font.getUnicodeFlag()) { + scale = 1f; + xoff = 1; + } if (item.stackSize > 1 || text != null) { - if (item.stackSize >= 10000) - text = (text == null) ? String.format("%.1fK", item.stackSize / 1000f) : text; + if (item.stackSize >= 100000000 || (item.stackSize >= 1000000 && font.getUnicodeFlag())) + text = (text == null) ? String.format("%.0fM", item.stackSize / 1000000f) : text; else if (item.stackSize >= 1000000) text = (text == null) ? String.format("%.1fM", item.stackSize / 1000000f) : text; + else if (item.stackSize >= 100000 || (item.stackSize >= 10000 && font.getUnicodeFlag())) + text = (text == null) ? String.format("%.0fK", item.stackSize / 1000f) : text; + else if (item.stackSize >= 10000) + text = (text == null) ? String.format("%.1fK", item.stackSize / 1000f) : text; else text = (text == null) ? String.valueOf(item.stackSize) : text; - int textX = (int)((x + 16 - font.getStringWidth(text) * scale) / scale) - 1; + int textX = (int)((x + 16 + xoff - font.getStringWidth(text) * scale) / scale) - 1; int textY = (int)((y + 16 - 7 * scale) / scale) - 1; GL11.glDisable(GL11.GL_LIGHTING); From 375d2d4d4f32b6848f72a60c22435ee0f7fb6a05 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 16 Aug 2015 01:36:31 -0400 Subject: [PATCH 11/12] Fix block label rendering for some users. --- .../client/renderer/TileEntityDrawersRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java index b0694fa39..1c393a793 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java +++ b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java @@ -205,7 +205,7 @@ private void renderItemIntoGUIBlock (FontRenderer fontRenderer, TextureManager t GL11.glRotatef(-90, 0, 1, 0); GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); - GL11.glPolygonOffset(0, 1f); + GL11.glPolygonOffset(-1f, -1f); this.renderBlocksRi.useInventoryTint = this.renderWithColor; this.renderBlocksRi.renderBlockAsItem(block, itemStack.getItemDamage(), 1); From dc54c29f842d283c31df1a4142c17379a0649a7c Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 16 Aug 2015 01:40:50 -0400 Subject: [PATCH 12/12] Fix refined relocation comp drawer recipe --- .../minecraft/storagedrawers/integration/RefinedRelocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java b/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java index 58c33f873..f7a942878 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/RefinedRelocation.java @@ -113,7 +113,7 @@ public void postInit () { if (config.isBlockEnabled("compdrawers")) GameRegistry.addRecipe(new ItemStack(compDrawers, 1), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(compDrawers, 1)); + 'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.compDrawers, 1)); if (config.cache.enableSortingUpgrades) GameRegistry.addRecipe(new ItemStack(upgradeSorting), "y y", " z ", "y y",