Resolved #404 - Added OreDict recipe config

This commit is contained in:
Calclavia 2014-03-11 22:09:18 +08:00
parent 79e9fc8f6d
commit 5d10f1412f
3 changed files with 42 additions and 14 deletions

View file

@ -28,7 +28,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class TileGrate extends TilePressureNode implements IRotatable
{
@Config(comment = "The multiplier for the influence of the grate. This is multiplied by the pressure applied.")
private static final double grateEffectMultiplier = 10;
private static double grateEffectMultiplier = 10;
@SideOnly(Side.CLIENT)
private static Icon iconFront, iconSide;

View file

@ -170,26 +170,26 @@ public class TileTesla extends TileElectrical implements IMultiBlockStructure<Ti
}
});
for (ITesla teslaReceiver : TeslaGrid.instance().get())
for (ITesla otherTesla : TeslaGrid.instance().get())
{
if (new Vector3((TileEntity) teslaReceiver).distance(new Vector3(this)) < this.getRange() && teslaReceiver != this)
if (new Vector3((TileEntity) otherTesla).distance(new Vector3(this)) < this.getRange() && otherTesla != this)
{
if (teslaReceiver instanceof TileTesla)
if (otherTesla instanceof TileTesla)
{
if (((TileTesla) teslaReceiver).getHeight() <= 1)
if (((TileTesla) otherTesla).getHeight() <= 1)
{
continue;
}
teslaReceiver = ((TileTesla) teslaReceiver).getMultiBlock().get();
otherTesla = ((TileTesla) otherTesla).getMultiBlock().get();
}
/**
* Make sure Tesla is not part of this tower.
*/
if (!this.connectedTeslas.contains(teslaReceiver) && teslaReceiver.canTeslaTransfer(this))
if (!this.connectedTeslas.contains(otherTesla) && otherTesla.canTeslaTransfer(this))
{
teslaToTransfer.add(teslaReceiver);
teslaToTransfer.add(otherTesla);
}
}
}
@ -275,6 +275,17 @@ public class TileTesla extends TileElectrical implements IMultiBlockStructure<Ti
@Override
public boolean canTeslaTransfer(TileEntity tileEntity)
{
if (tileEntity instanceof TileTesla)
{
TileTesla otherTesla = (TileTesla) tileEntity;
// Make sure Tesla is the same color
if (!(otherTesla.dyeID == dyeID || (otherTesla.dyeID == DEFAULT_COLOR || dyeID == DEFAULT_COLOR)))
{
return false;
}
}
return canReceive && tileEntity != getMultiBlock().get() && !this.outputBlacklist.contains(tileEntity);
}

View file

@ -37,6 +37,7 @@ import resonantinduction.core.Settings;
import resonantinduction.core.fluid.FluidColored;
import resonantinduction.core.resource.fluid.BlockFluidMaterial;
import resonantinduction.core.resource.fluid.BlockFluidMixture;
import calclavia.lib.configurable.Config;
import calclavia.lib.utility.LanguageUtility;
import calclavia.lib.utility.nbt.IVirtualObject;
import calclavia.lib.utility.nbt.NBTUtility;
@ -54,6 +55,9 @@ public class ResourceGenerator implements IVirtualObject
{
public static final ResourceGenerator INSTANCE = new ResourceGenerator();
@Config(comment = " Allow the Resource Generator to make ore dictionary compatible recipes?")
private static boolean allowOreDictCompatibility = true;
/**
* A list of material names. They are all camelCase reference of ore dictionary names without
* the "ore" or "ingot" prefix.
@ -156,13 +160,26 @@ 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));
if (allowOreDictCompatibility)
{
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);
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);
}
else
{
ItemStack dust = ResonantInduction.itemDust.getStackFromMaterial(materialName);
ItemStack rubble = ResonantInduction.itemRubble.getStackFromMaterial(materialName);
ItemStack refinedDust = ResonantInduction.itemRefinedDust.getStackFromMaterial(materialName);
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, rubble, dust, dust);
MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, dust, refinedDust);
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);