Fixed molten bucket giving out mixture fluids

This commit is contained in:
Calclavia 2014-02-26 17:59:37 +08:00
parent 80fb43a23c
commit 3d6d6b889a
4 changed files with 29 additions and 25 deletions

View file

@ -77,7 +77,7 @@ public class ResonantInduction
public static final HashMap<Integer, BlockFluidFinite> blockMixtureFluids = new HashMap<Integer, BlockFluidFinite>();
public static final HashMap<Integer, BlockFluidFinite> blockMoltenFluid = new HashMap<Integer, BlockFluidFinite>();
public static Block blockMachinePart;
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, Settings.idManager, ID).setPrefix(Reference.PREFIX).setTab(TabRI.CORE);
@EventHandler
@ -104,8 +104,8 @@ public class ResonantInduction
itemRubble = new ItemOreResource(Settings.getNextItemID("oreRubble"), "oreRubble");
itemDust = new ItemOreResource(Settings.getNextItemID("oreDust"), "oreDust");
itemRefinedDust = new ItemOreResource(Settings.getNextItemID("oreRefinedDust"), "oreRefinedDust");
itemBucketMixture = new ItemOreResourceBucket(Settings.getNextItemID("bucketMixture"), "bucketMixture");
itemBucketMolten = new ItemOreResourceBucket(Settings.getNextItemID("bucketMolten"), "bucketMolten");
itemBucketMixture = new ItemOreResourceBucket(Settings.getNextItemID("bucketMixture"), "bucketMixture", false);
itemBucketMolten = new ItemOreResourceBucket(Settings.getNextItemID("bucketMolten"), "bucketMolten", true);
GameRegistry.registerItem(itemRubble, itemRubble.getUnlocalizedName());
GameRegistry.registerItem(itemDust, itemDust.getUnlocalizedName());
@ -116,7 +116,7 @@ public class ResonantInduction
// Already registered with ContentRegistry
// GameRegistry.registerTileEntity(TileMaterial.class, "ri_material");
GameRegistry.registerTileEntity(TileFluidMixture.class, "ri_fluid_mixture");
proxy.preInit();
TabRI.ITEMSTACK = new ItemStack(blockMachinePart);
}
@ -128,13 +128,13 @@ public class ResonantInduction
ResonantInduction.LOGGER.fine("Languages Loaded:" + LanguageUtility.loadLanguages(Reference.LANGUAGE_DIRECTORY, Reference.LANGUAGES));
// Set Mod Metadata
Settings.setModMetadata(metadata, ID, NAME);
// Generate Resources
ResourceGenerator.generateOreResources();
}
@EventHandler
public void postInit(FMLPostInitializationEvent evt)
{
Settings.save();
// Generate Resources
ResourceGenerator.generateOreResources();
}
}

View file

@ -139,23 +139,24 @@ public class ResourceGenerator implements IVirtualObject
ResonantInduction.blockMixtureFluids.put(getID(materialName), blockFluidMixture);
FluidContainerRegistry.registerFluidContainer(fluidMixture, ResonantInduction.itemBucketMixture.getStackFromMaterial(materialName));
OreDictionary.registerOre("dust" + nameCaps, ResonantInduction.itemDust.getStackFromMaterial(materialName));
OreDictionary.registerOre("rubble" + nameCaps, ResonantInduction.itemRubble.getStackFromMaterial(materialName));
OreDictionary.registerOre("dustRefined" + nameCaps, ResonantInduction.itemRefinedDust.getStackFromMaterial(materialName));
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, "rubble" + nameCaps, "dust" + nameCaps, "dust" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, "dust" + nameCaps, "dustRefined" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, new FluidStack(fluidMolten, FluidContainerRegistry.BUCKET_VOLUME), "ingot" + nameCaps);
ItemStack dust = ResonantInduction.itemDust.getStackFromMaterial(materialName);
FurnaceRecipes.smelting().addSmelting(dust.itemID, dust.getItemDamage(), OreDictionary.getOres("ingot" + nameCaps).get(0).copy(), 0.7f);
ItemStack refinedDust = ResonantInduction.itemRefinedDust.getStackFromMaterial(materialName);
ItemStack smeltResult = OreDictionary.getOres("ingot" + nameCaps).get(0).copy();
smeltResult.stackSize = 2;
FurnaceRecipes.smelting().addSmelting(refinedDust.itemID, refinedDust.getItemDamage(), smeltResult, 0.7f);
if (OreDictionary.getOres("ore" + nameCaps).size() > 0)
{
OreDictionary.registerOre("dust" + nameCaps, ResonantInduction.itemDust.getStackFromMaterial(materialName));
OreDictionary.registerOre("rubble" + nameCaps, ResonantInduction.itemRubble.getStackFromMaterial(materialName));
OreDictionary.registerOre("dustRefined" + nameCaps, ResonantInduction.itemRefinedDust.getStackFromMaterial(materialName));
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, "ore" + nameCaps, "rubble" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, "rubble" + nameCaps, "dust" + nameCaps, "dust" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, "dust" + nameCaps, "dustRefined" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, new FluidStack(fluidMolten, FluidContainerRegistry.BUCKET_VOLUME), "ingot" + nameCaps);
ItemStack dust = ResonantInduction.itemDust.getStackFromMaterial(materialName);
FurnaceRecipes.smelting().addSmelting(dust.itemID, dust.getItemDamage(), OreDictionary.getOres("ingot" + nameCaps).get(0).copy(), 0.7f);
ItemStack refinedDust = ResonantInduction.itemRefinedDust.getStackFromMaterial(materialName);
ItemStack smeltResult = OreDictionary.getOres("ingot" + nameCaps).get(0).copy();
smeltResult.stackSize = 2;
FurnaceRecipes.smelting().addSmelting(refinedDust.itemID, refinedDust.getItemDamage(), smeltResult, 0.7f);
}
}
}

View file

@ -50,7 +50,7 @@ public class BlockFluidMaterial extends BlockFluidFinite
@Override
public int colorMultiplier(IBlockAccess access, int x, int y, int z)
{
return ResourceGenerator.getColor(getFluid().getName().replace("molten", "").toLowerCase());
return ResourceGenerator.getColor(ResourceGenerator.moltenToMaterial(getFluid().getName()));
}
@Override

View file

@ -30,9 +30,12 @@ import cpw.mods.fml.relauncher.SideOnly;
*/
public class ItemOreResourceBucket extends Item
{
public ItemOreResourceBucket(int id, String name)
final boolean isMolten;
public ItemOreResourceBucket(int id, String name, boolean isMolten)
{
super(id);
this.isMolten = isMolten;
setMaxStackSize(1);
setUnlocalizedName(Reference.PREFIX + name);
setTextureName(Reference.PREFIX + name);
@ -44,7 +47,6 @@ public class ItemOreResourceBucket extends Item
@Override
public String getItemDisplayName(ItemStack is)
{
if (getMaterialFromStack(is) != null)
{
String dustName = getMaterialFromStack(is);
@ -62,7 +64,7 @@ public class ItemOreResourceBucket extends Item
}
}
return (FluidRegistry.getFluid(ResourceGenerator.materialNameToMixture(getMaterialFromStack(is))).getLocalizedName() + " Bucket");
return (FluidRegistry.getFluid(isMolten ? ResourceGenerator.materialNameToMolten(getMaterialFromStack(is)) : ResourceGenerator.materialNameToMixture(getMaterialFromStack(is))).getLocalizedName() + " Bucket");
}
return null;
}
@ -73,7 +75,8 @@ public class ItemOreResourceBucket extends Item
*/
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
{
int fluidID = ResourceGenerator.getMixture(ResourceGenerator.getName(itemStack.getItemDamage())).blockID;
String materialName = ResourceGenerator.getName(itemStack.getItemDamage());
int fluidID = isMolten ? ResourceGenerator.getMolten(materialName).blockID : ResourceGenerator.getMixture(materialName).blockID;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, false);