Fixed #311 - Fixed mixer results from other mods

This commit is contained in:
Calclavia 2014-02-27 16:40:39 +08:00
parent 95f5aaf572
commit 2892fd9b9b
4 changed files with 12 additions and 8 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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)
{

View file

@ -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.