From 2892fd9b9b414fd256a25975d2c0984cfd1089f2 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Thu, 27 Feb 2014 16:40:39 +0800 Subject: [PATCH] Fixed #311 - Fixed mixer results from other mods --- .../mechanical/process/purifier/TileMixer.java | 6 ++++-- .../java/resonantinduction/api/recipe/RecipeResource.java | 7 ++----- .../resonantinduction/core/resource/ResourceGenerator.java | 5 +++++ .../assets/resonantinduction/languages/en_US.properties | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mechanical/src/main/java/resonantinduction/mechanical/process/purifier/TileMixer.java b/mechanical/src/main/java/resonantinduction/mechanical/process/purifier/TileMixer.java index 190469cf..60f553f3 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/process/purifier/TileMixer.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/process/purifier/TileMixer.java @@ -4,12 +4,14 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import calclavia.lib.utility.LanguageUtility; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.oredict.OreDictionary; import resonantinduction.api.mechanical.IMechanical; import resonantinduction.api.recipe.MachineRecipes; import resonantinduction.api.recipe.MachineRecipes.RecipeType; @@ -151,9 +153,9 @@ public class TileMixer extends TileMechanical return true; } } - else if (worldObj.isAirBlock(mixPosition.intX(), mixPosition.intY(), mixPosition.intZ()) || block.blockID == Block.waterStill.blockID || block.blockID == Block.waterMoving.blockID) + else if (block != null && (block.blockID == Block.waterStill.blockID || block.blockID == Block.waterMoving.blockID)) { - mixPosition.setBlock(worldObj, ResourceGenerator.getMixture(ResourceGenerator.getName(entity.getEntityItem().getItemDamage())).blockID); + mixPosition.setBlock(worldObj, ResourceGenerator.getMixture(ResourceGenerator.materialNameToMixture(ResourceGenerator.getName(entity.getEntityItem()))).blockID); } return false; diff --git a/src/main/java/resonantinduction/api/recipe/RecipeResource.java b/src/main/java/resonantinduction/api/recipe/RecipeResource.java index b4a3e80f..e14ce405 100644 --- a/src/main/java/resonantinduction/api/recipe/RecipeResource.java +++ b/src/main/java/resonantinduction/api/recipe/RecipeResource.java @@ -103,14 +103,12 @@ public abstract class RecipeResource { if (obj instanceof OreDictResource) { - return this.name.equals(((OreDictResource) obj).name); + return name.equals(((OreDictResource) obj).name); } if (obj instanceof ItemStackResource) { - for (ItemStack is : OreDictionary.getOres(name).toArray(new ItemStack[0])) - if (is.isItemEqual(((ItemStackResource) obj).itemStack)) - return true; + return equals(((ItemStackResource) obj).itemStack); } if (obj instanceof ItemStack) @@ -118,7 +116,6 @@ public abstract class RecipeResource for (ItemStack is : OreDictionary.getOres(name).toArray(new ItemStack[0])) if (is.isItemEqual((ItemStack) obj)) return true; - return false; } return false; diff --git a/src/main/java/resonantinduction/core/resource/ResourceGenerator.java b/src/main/java/resonantinduction/core/resource/ResourceGenerator.java index d9ff3618..7937ab3f 100644 --- a/src/main/java/resonantinduction/core/resource/ResourceGenerator.java +++ b/src/main/java/resonantinduction/core/resource/ResourceGenerator.java @@ -326,6 +326,11 @@ public class ResourceGenerator implements IVirtualObject { return materials.inverse().get(id); } + + public static String getName(ItemStack itemStack) + { + return LanguageUtility.decapitalizeFirst(OreDictionary.getOreName(OreDictionary.getOreID(itemStack)).replace("dust", "").replace("ore", "").replace("ingot", "")); + } public static int getColor(String name) { diff --git a/src/main/resources/assets/resonantinduction/languages/en_US.properties b/src/main/resources/assets/resonantinduction/languages/en_US.properties index d188cd7c..de8af4c7 100644 --- a/src/main/resources/assets/resonantinduction/languages/en_US.properties +++ b/src/main/resources/assets/resonantinduction/languages/en_US.properties @@ -43,7 +43,7 @@ item.resonantinduction\:hammer.name=Hammer item.resonantinduction\:handCrank.name=Hand Crank ## Machines -tile.resonantinduction\:castingMold.name=Metal Caster +tile.resonantinduction\:castingMold.name=Casting Mold tile.resonantinduction\:castingMold.tooltip=Pour molten metal into the cast to form an ingot. tile.resonantinduction\:millstone.name=Millstone tile.resonantinduction\:millstone.tooltip=Put some rubble in the millstone and start configuring to grind rubble into dust.