From 3e3bf2c25c459a67968520a175be21c7a6525a77 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sun, 13 Jul 2014 19:53:05 +0100 Subject: [PATCH 1/2] Fix Iron Dust smelting issue. Close #1478 --- src/main/java/mekanism/common/integration/OreDictManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/mekanism/common/integration/OreDictManager.java b/src/main/java/mekanism/common/integration/OreDictManager.java index cd6880eb1..4e45cd55b 100644 --- a/src/main/java/mekanism/common/integration/OreDictManager.java +++ b/src/main/java/mekanism/common/integration/OreDictManager.java @@ -365,11 +365,11 @@ public final class OreDictManager } catch(Exception e) {} try { - FurnaceRecipes.smelting().func_151394_a(new ItemStack(Mekanism.Dust, 8), MekanismUtils.size(OreDictionary.getOres("ingotSilver").get(0), 1), 0.0F); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(Mekanism.Dust, 1, 8), MekanismUtils.size(OreDictionary.getOres("ingotSilver").get(0), 1), 0.0F); } catch(Exception e) {} try { - FurnaceRecipes.smelting().func_151394_a(new ItemStack(Mekanism.Dust, 9), MekanismUtils.size(OreDictionary.getOres("ingotLead").get(0), 1), 0.0F); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(Mekanism.Dust, 1, 9), MekanismUtils.size(OreDictionary.getOres("ingotLead").get(0), 1), 0.0F); } catch(Exception e) {} try { From c560bdc2e101585b3b20e15f077d5ee730a43bae Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sun, 13 Jul 2014 19:53:24 +0100 Subject: [PATCH 2/2] Fix a different, unrelated OreDict issue. --- src/main/java/mekanism/api/BlockInfo.java | 38 +++++++++++++++++++ src/main/java/mekanism/api/ItemInfo.java | 18 ++++----- src/main/java/mekanism/api/MekanismAPI.java | 10 ++--- .../java/mekanism/common/OreDictCache.java | 3 +- .../common/miner/ThreadMinerSearch.java | 8 ++-- .../common/network/PacketBoxBlacklist.java | 6 +-- 6 files changed, 60 insertions(+), 23 deletions(-) create mode 100644 src/main/java/mekanism/api/BlockInfo.java diff --git a/src/main/java/mekanism/api/BlockInfo.java b/src/main/java/mekanism/api/BlockInfo.java new file mode 100644 index 000000000..50c990f27 --- /dev/null +++ b/src/main/java/mekanism/api/BlockInfo.java @@ -0,0 +1,38 @@ +package mekanism.api; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +public class BlockInfo +{ + public Block block; + public int meta; + + public BlockInfo(Block b, int j) + { + block = b; + meta = j; + } + + public static BlockInfo get(ItemStack stack) + { + return new BlockInfo(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); + } + + @Override + public boolean equals(Object obj) + { + return obj instanceof BlockInfo && + ((BlockInfo)obj).block == block && + ((BlockInfo)obj).meta == meta; + } + + @Override + public int hashCode() + { + int code = 1; + code = 31 * code + block.getUnlocalizedName().hashCode(); + code = 31 * code + meta; + return code; + } +} \ No newline at end of file diff --git a/src/main/java/mekanism/api/ItemInfo.java b/src/main/java/mekanism/api/ItemInfo.java index 4fee46e69..2c45f0cfe 100644 --- a/src/main/java/mekanism/api/ItemInfo.java +++ b/src/main/java/mekanism/api/ItemInfo.java @@ -1,29 +1,29 @@ package mekanism.api; -import net.minecraft.block.Block; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ItemInfo { - public Block block; + public Item item; public int meta; - public ItemInfo(Block b, int j) + public ItemInfo(Item i, int j) { - block = b; + item = i; meta = j; } public static ItemInfo get(ItemStack stack) { - return new ItemInfo(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); + return new ItemInfo(stack.getItem(), stack.getItemDamage()); } @Override public boolean equals(Object obj) { - return obj instanceof ItemInfo && - ((ItemInfo)obj).block == block && + return obj instanceof BlockInfo && + ((ItemInfo)obj).item == item && ((ItemInfo)obj).meta == meta; } @@ -31,8 +31,8 @@ public class ItemInfo public int hashCode() { int code = 1; - code = 31 * code + block.getUnlocalizedName().hashCode(); + code = 31 * code + item.getUnlocalizedName().hashCode(); code = 31 * code + meta; return code; } -} \ No newline at end of file +} diff --git a/src/main/java/mekanism/api/MekanismAPI.java b/src/main/java/mekanism/api/MekanismAPI.java index 37a5cb9af..4f4cef4a9 100644 --- a/src/main/java/mekanism/api/MekanismAPI.java +++ b/src/main/java/mekanism/api/MekanismAPI.java @@ -11,11 +11,11 @@ import net.minecraftforge.oredict.OreDictionary; public class MekanismAPI { //Add a BlockInfo value here if you don't want a certain block to be picked up by cardboard boxes - private static Set cardboardBoxIgnore = new HashSet(); + private static Set cardboardBoxIgnore = new HashSet(); public static boolean isBlockCompatible(Item item, int meta) { - for(ItemInfo i : cardboardBoxIgnore) + for(BlockInfo i : cardboardBoxIgnore) { if(i.block == Block.getBlockFromItem(item) && (i.meta == OreDictionary.WILDCARD_VALUE || i.meta == meta)) { @@ -28,15 +28,15 @@ public class MekanismAPI public static void addBoxBlacklist(Block block, int meta) { - cardboardBoxIgnore.add(new ItemInfo(block, meta)); + cardboardBoxIgnore.add(new BlockInfo(block, meta)); } public static void removeBoxBlacklist(Block block, int meta) { - cardboardBoxIgnore.remove(new ItemInfo(block, meta)); + cardboardBoxIgnore.remove(new BlockInfo(block, meta)); } - public static Set getBoxIgnore() + public static Set getBoxIgnore() { return cardboardBoxIgnore; } diff --git a/src/main/java/mekanism/common/OreDictCache.java b/src/main/java/mekanism/common/OreDictCache.java index aacd9793e..572b45c0e 100644 --- a/src/main/java/mekanism/common/OreDictCache.java +++ b/src/main/java/mekanism/common/OreDictCache.java @@ -3,11 +3,10 @@ package mekanism.common; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import mekanism.api.ItemInfo; import mekanism.common.util.MekanismUtils; -import mekanism.common.util.StackUtils; + import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/mekanism/common/miner/ThreadMinerSearch.java b/src/main/java/mekanism/common/miner/ThreadMinerSearch.java index 969cb9b79..1560e4695 100644 --- a/src/main/java/mekanism/common/miner/ThreadMinerSearch.java +++ b/src/main/java/mekanism/common/miner/ThreadMinerSearch.java @@ -4,12 +4,12 @@ import java.util.BitSet; import java.util.HashMap; import java.util.Map; +import mekanism.api.BlockInfo; import mekanism.api.Coord4D; -import mekanism.api.ItemInfo; import mekanism.common.tile.TileEntityBoundingBlock; import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.util.MekanismUtils; -import net.minecraft.init.Blocks; + import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -21,7 +21,7 @@ public class ThreadMinerSearch extends Thread public BitSet oresToMine = new BitSet(); - public Map acceptedItems = new HashMap(); + public Map acceptedItems = new HashMap(); public int found = 0; @@ -44,7 +44,7 @@ public class ThreadMinerSearch extends Thread Coord4D coord = tileEntity.getStartingCoord(); int diameter = tileEntity.getDiameter(); int size = tileEntity.getTotalSize(); - ItemInfo info = new ItemInfo(null, 0); + BlockInfo info = new BlockInfo(null, 0); for(int i = 0; i < size; i++) { diff --git a/src/main/java/mekanism/common/network/PacketBoxBlacklist.java b/src/main/java/mekanism/common/network/PacketBoxBlacklist.java index fee67dc73..2855a18a0 100644 --- a/src/main/java/mekanism/common/network/PacketBoxBlacklist.java +++ b/src/main/java/mekanism/common/network/PacketBoxBlacklist.java @@ -1,12 +1,12 @@ package mekanism.common.network; import io.netty.buffer.ByteBuf; -import mekanism.api.ItemInfo; + +import mekanism.api.BlockInfo; import mekanism.api.MekanismAPI; import mekanism.common.Mekanism; import mekanism.common.network.PacketBoxBlacklist.BoxBlacklistMessage; import net.minecraft.block.Block; -import net.minecraft.world.World; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -28,7 +28,7 @@ public class PacketBoxBlacklist implements IMessageHandler