Lots of refactoring and setup for the slice'n'dice.

This commit is contained in:
CrazyPants committed 2014-09-05 01:07:04 +08:00
1 parent 365c34ff3f
commit 48cc9b4bd5
33 files changed
+798 -476

No files matched your search

+25 -21
View File
@@ -92,6 +92,8 @@ import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.BlockPainter;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.reservoir.BlockReservoir;
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
import crazypants.enderio.machine.solar.BlockSolarPanel;
import crazypants.enderio.machine.soul.BlockSoulBinder;
import crazypants.enderio.machine.spawner.BlockPoweredSpawner;
@@ -197,6 +199,7 @@ public class EnderIO {
public static BlockCrafter blockCrafter;
public static BlockPoweredSpawner blockPoweredSpawner;
public static ItemBrokenSpawner itemBrokenSpawner;
public static BlockSliceAndSplice blockSliceAndSplice;
public static BlockSoulBinder blockSoulFuser;
public static BlockKillerJoe blockKillerJoe;
@@ -252,23 +255,15 @@ public class EnderIO {
ConduitGeometryUtil.setupBounds((float) Config.conduitScale);
blockEnderIo = BlockEnderIO.create();
blockTravelPlatform = BlockTravelAnchor.create();
blockSolarPanel = BlockSolarPanel.create();
blockStirlingGenerator = BlockStirlingGenerator.create();
blockCombustionGenerator = BlockCombustionGenerator.create();
blockZombieGenerator = BlockZombieGenerator.create();
blockSolarPanel = BlockSolarPanel.create();
blockCrusher = BlockCrusher.create();
blockAlloySmelter = BlockAlloySmelter.create();
blockVat = BlockVat.create();
blockPowerMonitor = BlockPowerMonitor.create();
blockFarmStation = BlockFarmStation.create();
blockCapacitorBank = BlockCapacitorBank.create();
blockWirelessCharger = BlockWirelessCharger.create();
blockPainter = BlockPainter.create();
blockPaintedFence = BlockPaintedFence.create();
blockPaintedFenceGate = BlockPaintedFenceGate.create();
@@ -281,32 +276,40 @@ public class EnderIO {
blockCrafter = BlockCrafter.create();
blockPaintedGlowstone = BlockPaintedGlowstone.create();
blockPaintedCarpet = BlockPaintedCarpet.create();
blockVat = BlockVat.create();
blockPowerMonitor = BlockPowerMonitor.create();
blockFarmStation = BlockFarmStation.create();
blockWirelessCharger = BlockWirelessCharger.create();
blockHyperCube = BlockHyperCube.create();
blockElectricLight = BlockElectricLight.create();
blockLightNode = BlockLightNode.create();
blockTank = BlockTank.create();
blockReservoir = BlockReservoir.create();
blockVacuumChest = BlockVacuumChest.create();
blockEnderIo = BlockEnderIO.create();
blockTravelPlatform = BlockTravelAnchor.create();
blockEnchanter = BlockEnchanter.create();
blockSliceAndSplice = BlockSliceAndSplice.create();
blockSoulFuser = BlockSoulBinder.create();
blockPoweredSpawner = BlockPoweredSpawner.create();
blockKillerJoe = BlockKillerJoe.create();
blockEnchanter = BlockEnchanter.create();
blockDarkSteelPressurePlate = BlockDarkSteelPressurePlate.create();
blockElectricLight = BlockElectricLight.create();
blockLightNode = BlockLightNode.create();
blockReinforcedObsidian = BlockReinforcedObsidian.create();
blockFusedQuartz = BlockFusedQuartz.create();
itemFusedQuartzFrame = ItemFusedQuartzFrame.create();
blockConduitBundle = BlockConduitBundle.create();
blockConduitFacade = BlockConduitFacade.create();
itemConduitFacade = ItemConduitFacade.create();
blockPoweredSpawner = BlockPoweredSpawner.create();
itemBrokenSpawner = ItemBrokenSpawner.create();
blockSoulFuser = BlockSoulBinder.create();
itemBrokenSpawner = ItemBrokenSpawner.create();
itemRedstoneConduit = ItemRedstoneConduit.create();
itemPowerConduit = ItemPowerConduit.create();
@@ -469,6 +472,7 @@ public class EnderIO {
CrusherRecipeManager.getInstance().loadRecipesFromConfig();
AlloyRecipeManager.getInstance().loadRecipesFromConfig();
SliceAndSpliceRecipeManager.getInstance().loadRecipesFromConfig();
VatRecipeManager.getInstance().loadRecipesFromConfig();
EnchanterRecipeManager.getInstance().loadRecipesFromConfig();
FarmersRegistry.addFarmers();
@@ -44,6 +44,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI_ID_ENCHANTER = 91;
public static final int GUI_ID_KILLER_JOE = 92;
public static final int GUI_ID_SOUL_BINDER = 93;
public static final int GUI_ID_SLICE_N_SPLICE = 94;
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
@@ -52,6 +52,7 @@ public enum ModObject {
blockWirelessCharger,
blockEnchanter,
blockSoulBinder,
blockSliceAndSplice,
blockPoweredSpawner,
itemBrokenSpawner,
@@ -237,19 +237,18 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
return 0;
}
protected MachineRecipeInput[] getInputs() {
protected MachineRecipeInput[] getRecipeInputs() {
MachineRecipeInput[] res = new MachineRecipeInput[slotDefinition.getNumInputSlots()];
int fromSlot = slotDefinition.minInputSlot;
for (int i = 0; i < res.length; i++) {
res[i] = new MachineRecipeInput(fromSlot, inventory[fromSlot]);
fromSlot++;
}
return res;
}
protected IMachineRecipe canStartNextTask(float chance) {
IMachineRecipe nextRecipe = MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), getInputs());
IMachineRecipe nextRecipe = MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), getRecipeInputs());
if(nextRecipe == null) {
return null; // no template
}
@@ -259,7 +258,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
protected boolean canInsertResult(float chance, IMachineRecipe nextRecipe) {
ResultStack[] nextResults = nextRecipe.getCompletedResult(chance, getInputs());
ResultStack[] nextResults = nextRecipe.getCompletedResult(chance, getRecipeInputs());
List<ItemStack> outputStacks = new ArrayList<ItemStack>(slotDefinition.getNumOutputSlots());
if(slotDefinition.getNumOutputSlots() > 0) {
boolean allFull = true;
@@ -314,10 +313,10 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
}
protected boolean startNextTask(IMachineRecipe nextRecipe, float chance) {
if(hasPower() && nextRecipe.isRecipe(getInputs())) {
if(hasPower() && nextRecipe.isRecipe(getRecipeInputs())) {
// then get our recipe and take away the source items
currentTask = createTask(nextRecipe, chance);
List<MachineRecipeInput> consumed = nextRecipe.getQuantitiesConsumed(getInputs());
List<MachineRecipeInput> consumed = nextRecipe.getQuantitiesConsumed(getRecipeInputs());
for (MachineRecipeInput item : consumed) {
if(item != null) {
if(item.item != null && item.item.stackSize > 0) {
@@ -334,7 +333,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
}
protected IPoweredTask createTask(IMachineRecipe nextRecipe, float chance) {
return new PoweredTask(nextRecipe, chance, getInputs());
return new PoweredTask(nextRecipe, chance, getRecipeInputs());
}
@Override
@@ -1,42 +0,0 @@
package crazypants.enderio.machine.alloy;
import net.minecraft.item.ItemStack;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.recipe.AbstractMachineRecipe;
import crazypants.enderio.machine.recipe.IRecipe;
public class AlloyMachineRecipe extends AbstractMachineRecipe {
@Override
public String getUid() {
return "AlloySmelterRecipe";
}
@Override
public IRecipe getRecipeForInputs(MachineRecipeInput[] inputs) {
return AlloyRecipeManager.instance.getRecipeForInputs(inputs);
}
@Override
public boolean isValidInput(MachineRecipeInput input) {
if(input == null) {
return false;
}
return AlloyRecipeManager.instance.isValidInput(input);
}
@Override
public String getMachineName() {
return ModObject.blockAlloySmelter.unlocalisedName;
}
@Override
public float getExperianceForOutput(ItemStack output) {
return AlloyRecipeManager.instance.getExperianceForOutput(output);
}
public boolean isValidRecipeComponents(ItemStack[] resultInv) {
return AlloyRecipeManager.instance.isValidRecipeComponents(resultInv);
}
}
@@ -14,15 +14,19 @@ import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.recipe.BasicManyToOneRecipe;
import crazypants.enderio.machine.recipe.CustomTagHandler;
import crazypants.enderio.machine.recipe.IManyToOneRecipe;
import crazypants.enderio.machine.recipe.IRecipe;
import crazypants.enderio.machine.recipe.ManyToOneMachineRecipe;
import crazypants.enderio.machine.recipe.ManyToOneRecipeManager;
import crazypants.enderio.machine.recipe.Recipe;
import crazypants.enderio.machine.recipe.RecipeConfig;
import crazypants.enderio.machine.recipe.RecipeConfigParser;
import crazypants.enderio.machine.recipe.RecipeInput;
import crazypants.util.Util;
public class AlloyRecipeManager {
public class AlloyRecipeManager extends ManyToOneRecipeManager {
private static final String CORE_FILE_NAME = "AlloySmelterRecipes_Core.xml";
private static final String CUSTOM_FILE_NAME = "AlloySmelterRecipes_User.xml";
@@ -33,11 +37,10 @@ public class AlloyRecipeManager {
return instance;
}
private final List<IAlloyRecipe> recipes = new ArrayList<IAlloyRecipe>();
VanillaSmeltingRecipe vanillaRecipe = new VanillaSmeltingRecipe();
public AlloyRecipeManager() {
super(CORE_FILE_NAME, CUSTOM_FILE_NAME, "Alloy Smelter");
}
public VanillaSmeltingRecipe getVanillaRecipe() {
@@ -47,136 +50,22 @@ public class AlloyRecipeManager {
public void setVanillaRecipe(VanillaSmeltingRecipe vanillaRecipe) {
this.vanillaRecipe = vanillaRecipe;
}
protected CustomTagHandler createCustomTagHandler() {
return new VanillaFurnaceTagHandler();
}
public void loadRecipesFromConfig() {
VanillaFurnaceTagHandler tagHandler = new VanillaFurnaceTagHandler();
RecipeConfig config = RecipeConfig.loadRecipeConfig(CORE_FILE_NAME, CUSTOM_FILE_NAME, tagHandler);
if(config != null) {
processConfig(config, tagHandler);
} else {
Log.error("Could not load recipes for Alloy Smelter.");
}
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockAlloySmelter.unlocalisedName, new AlloyMachineRecipe());
super.loadRecipesFromConfig();
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockAlloySmelter.unlocalisedName, new ManyToOneMachineRecipe("AlloySmelterRecipe", ModObject.blockAlloySmelter.unlocalisedName, this));
//vanilla alloy furnace recipes
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockAlloySmelter.unlocalisedName, vanillaRecipe);
}
public void addCustumRecipes(String xmlDef) {
RecipeConfig config;
VanillaFurnaceTagHandler tagHandler = new VanillaFurnaceTagHandler();
try {
config = RecipeConfigParser.parse(xmlDef, tagHandler);
} catch (Exception e) {
Log.error("Error parsing custom xml");
return;
}
if(config == null) {
Log.error("Could process custom XML");
return;
}
processConfig(config, tagHandler);
}
public List<IAlloyRecipe> getRecipes() {
return recipes;
}
private void processConfig(RecipeConfig config, VanillaFurnaceTagHandler tagHandler) {
if(config.isDumpItemRegistery()) {
Util.dumpModObjects(new File(Config.configDirectory, "modObjectsRegistery.txt"));
}
if(config.isDumpOreDictionary()) {
Util.dumpOreNames(new File(Config.configDirectory, "oreDictionaryRegistery.txt"));
}
List<Recipe> newRecipes = config.getRecipes(false);
Log.info("Found " + newRecipes.size() + " valid Alloy Smelter recipes in config.");
for (Recipe rec : newRecipes) {
addRecipe(new BasicAlloyRecipe(rec));
}
tagHandler.apply();
Log.info("Finished processing Alloy Smelter recipes. " + recipes.size() + " recipes avaliable.");
}
public void addRecipe(IAlloyRecipe recipe) {
if(recipe == null) {
Log.debug("Could not add invalid recipe: " + recipe);
return;
}
IRecipe rec = getRecipeForInputs(recipe.getInputStacks());
if(rec != null) {
Log.warn("Not adding supplied recipe as a recipe already exists for the input: " + recipe);
return;
}
recipes.add(recipe);
}
private IRecipe getRecipeForInputs(List<ItemStack> inputs) {
MachineRecipeInput[] ins = new MachineRecipeInput[inputs.size()];
for (int i = 0; i < inputs.size(); i++) {
ins[i] = new MachineRecipeInput(-1, inputs.get(i));
}
return getRecipeForInputs(ins);
}
IRecipe getRecipeForInputs(MachineRecipeInput[] inputs) {
for (IAlloyRecipe rec : recipes) {
if(rec.isInputForRecipe(inputs)) {
return rec;
}
}
return null;
}
public boolean isValidInput(MachineRecipeInput input) {
if(input == null || input.item == null) {
return false;
}
for (IAlloyRecipe recipe : recipes) {
for (RecipeInput ri : recipe.getInputs()) {
if(ri.isInput(input.item)) {
return true;
}
}
}
return false;
}
public boolean isValidRecipeComponents(ItemStack[] inputs) {
if(inputs == null || inputs.length == 0) {
return false;
}
for (IAlloyRecipe recipe : recipes) {
if(recipe.isValidRecipeComponents(inputs)) {
return true;
}
}
return false;
}
public float getExperianceForOutput(ItemStack output) {
for (IAlloyRecipe recipe : recipes) {
if(recipe.getOutput().getItem() == output.getItem() && recipe.getOutput().getItemDamage() == output.getItemDamage()) {
return recipe.getOutputs()[0].getExperiance();
}
}
return 0;
}
private static final String ELEMENT_ROOT = "vanillaFurnaceRecipes";
private static final String ELEMENT_EXCLUDE = "exclude";
//private static final String AT_EXCLUDE = "exclude";
private class VanillaFurnaceTagHandler implements CustomTagHandler {
@@ -218,8 +107,8 @@ public class AlloyRecipeManager {
return inTag;
}
public void apply() {
@Override
public void configProcessed() {
if(enabled != null) {
Log.info("AlloyRecipeManager: Vannila smelting in AlloySmelting enabled=" + enabled);
vanillaRecipe.setEnabled(enabled.booleanValue());
@@ -1,230 +0,0 @@
package crazypants.enderio.machine.alloy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.recipe.Recipe;
import crazypants.enderio.machine.recipe.RecipeInput;
import crazypants.enderio.machine.recipe.RecipeOutput;
public class BasicAlloyRecipe implements IAlloyRecipe {
public static final int DEFAULT_ENERGY_USE = 1200;
private int energyRequired = DEFAULT_ENERGY_USE;
private ItemStack output;
private float expPerItem;
private final Recipe recipe;
public BasicAlloyRecipe(Recipe recipe) {
this.recipe = recipe;
this.output = recipe.getOutputs()[0].getOutput().copy();
expPerItem = recipe.getOutputs()[0].getExperiance();
energyRequired = recipe.getEnergyRequired();
}
@Override
public boolean isValidRecipeComponents(ItemStack... items) {
List<RecipeInput> inputs = new ArrayList<RecipeInput>(Arrays.asList(recipe.getInputs()));
for (ItemStack is : items) {
if(is != null) {
RecipeInput remove = null;
for (RecipeInput ri : inputs) {
if(ri.isInput(is)) {
remove = ri;
break;
}
}
if(remove != null) {
inputs.remove(remove);
} else {
return false;
}
}
}
return true;
}
@Override
public ItemStack getOutput() {
return output;
}
private ItemStack[] getNonNullInputStacks(ItemStack[] checking) {
if(checking == null) {
return new ItemStack[0];
}
List<ItemStack> result = new ArrayList<ItemStack>(checking.length);
for (ItemStack st : checking) {
if(st != null) {
result.add(st);
}
}
return result.toArray(new ItemStack[result.size()]);
}
private MachineRecipeInput[] getNonNullInputs(MachineRecipeInput[] checking) {
int numNonNulls = 0;
for (int i = 0; i < checking.length; i++) {
if(checking[i] != null && checking[i].item != null) {
numNonNulls++;
}
}
MachineRecipeInput[] result = new MachineRecipeInput[numNonNulls];
int index = 0;
for (int i = 0; i < checking.length; i++) {
if(checking[i] != null && checking[i].item != null) {
result[index] = checking[i];
index++;
}
}
return result;
}
//@Override
public ItemStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) {
return new ItemStack[] { output.copy() };
}
@Override
public boolean isValidInput(int slot, ItemStack input) {
if(input == null) {
return false;
}
return getRecipeComponentFromInput(input) != null;
}
@Override
public boolean isValidInput(FluidStack fluid) {
return false;
}
//@Override
public String getMachineName() {
return ModObject.blockAlloySmelter.unlocalisedName;
}
public int getQuantityConsumed(MachineRecipeInput input) {
ItemStack ing = getRecipeComponentFromInput(input.item);
return ing == null ? 0 : ing.stackSize;
}
private ItemStack getRecipeComponentFromInput(ItemStack input) {
if(input == null) {
return null;
}
for (RecipeInput ri : recipe.getInputs()) {
if(ri.isInput(input)) {
return ri.getInput();
}
}
return null;
}
//@Override
public MachineRecipeInput[] getQuantitiesConsumed(MachineRecipeInput[] inputs) {
List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();
for (MachineRecipeInput input : inputs) {
int numConsumed = getQuantityConsumed(input);
if(numConsumed > 0) {
ItemStack consumed = input.item.copy();
consumed.stackSize = numConsumed;
result.add(new MachineRecipeInput(input.slotNumber, consumed));
}
}
if(result.isEmpty()) {
return null;
}
return result.toArray(new MachineRecipeInput[result.size()]);
}
static class InputKey {
int itemID;
int damage;
InputKey(int itemID, int damage) {
this.itemID = itemID;
this.damage = damage;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + damage;
result = prime * result + itemID;
return result;
}
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(obj == null) {
return false;
}
if(getClass() != obj.getClass()) {
return false;
}
InputKey other = (InputKey) obj;
if(damage != other.damage) {
return false;
}
if(itemID != other.itemID) {
return false;
}
return true;
}
}
@Override
public boolean isValid() {
return recipe != null && recipe.isValid();
}
@Override
public int getEnergyRequired() {
return energyRequired;
}
@Override
public RecipeOutput[] getOutputs() {
return recipe.getOutputs();
}
@Override
public List<ItemStack> getInputStacks() {
return recipe.getInputStacks();
}
@Override
public boolean isInputForRecipe(MachineRecipeInput... inputs) {
if(inputs == null) {
return false;
}
return recipe.isInputForRecipe(inputs);
}
@Override
public RecipeInput[] getInputs() {
return recipe.getInputs();
}
@Override
public List<FluidStack> getInputFluidStacks() {
return Collections.emptyList();
}
}
@@ -1,12 +0,0 @@
package crazypants.enderio.machine.alloy;
import net.minecraft.item.ItemStack;
import crazypants.enderio.machine.recipe.IRecipe;
public interface IAlloyRecipe extends IRecipe {
boolean isValidRecipeComponents(ItemStack... items);
ItemStack getOutput();
}
@@ -12,6 +12,7 @@ import crazypants.enderio.machine.IMachineRecipe.ResultStack;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.machine.recipe.ManyToOneMachineRecipe;
public class TileAlloySmelter extends AbstractPoweredTaskEntity {
@@ -60,8 +61,8 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
protected IMachineRecipe canStartNextTask(float chance) {
if(mode == Mode.FURNACE) {
VanillaSmeltingRecipe vr = AlloyRecipeManager.getInstance().vanillaRecipe;
if(vr.isRecipe(getInputs())) {
ResultStack[] res = vr.getCompletedResult(chance, getInputs());
if(vr.isRecipe(getRecipeInputs())) {
ResultStack[] res = vr.getCompletedResult(chance, getRecipeInputs());
if(res == null || res.length == 0) {
return null;
}
@@ -70,7 +71,7 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
return null;
}
IMachineRecipe nextRecipe = MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), getInputs());
IMachineRecipe nextRecipe = MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), getRecipeInputs());
if(mode == Mode.ALLOY && nextRecipe instanceof VanillaSmeltingRecipe) {
nextRecipe = null;
}
@@ -123,7 +124,7 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
for (IMachineRecipe recipe : recipes) {
if(!(recipe instanceof VanillaSmeltingRecipe)) {
if(recipe instanceof AlloyMachineRecipe) {
if(recipe instanceof ManyToOneMachineRecipe) {
ItemStack[] resultInv = new ItemStack[slotDefinition.getNumInputSlots()];
for (int i = slotDefinition.getMinInputSlot(); i <= slotDefinition.getMaxInputSlot(); i++) {
if(i >= 0 && i < inventory.length) {
@@ -134,7 +135,7 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
}
}
}
if(((AlloyMachineRecipe) recipe).isValidRecipeComponents(resultInv)) {
if(((ManyToOneMachineRecipe) recipe).isValidRecipeComponents(resultInv)) {
return true;
}
@@ -33,8 +33,6 @@ public class CrusherRecipeManager {
static final CrusherRecipeManager instance = new CrusherRecipeManager();
public static CrusherRecipeManager getInstance() {
return instance;
}
@@ -47,14 +45,7 @@ public class CrusherRecipeManager {
private Set<ItemStack> excludedStacks = new HashSet<ItemStack>();
public CrusherRecipeManager() {
// GrindingBall gb = new GrindingBall(new ItemStack(Items.flint));
// gb.setGrindingMultiplier(1.25f);
// gb.setChanceMultiplier(1.25f);
// gb.setPowerMultiplier(0.75f);
// gb.setDurationMJ(ORE_ENERGY_COST * 6);
//
// balls.add(gb);
public CrusherRecipeManager() {
}
public boolean isValidSagBall(ItemStack stack) {
@@ -78,4 +78,10 @@ public class GrindingBallTagHandler implements CustomTagHandler {
return false;
}
@Override
public void configProcessed() {
}
}
@@ -101,15 +101,15 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
PoweredTask res;
useGrindingBall = false;
if(gb != null) {
useGrindingBall = !CrusherRecipeManager.getInstance().isExcludedFromBallBonus(getInputs());
useGrindingBall = !CrusherRecipeManager.getInstance().isExcludedFromBallBonus(getRecipeInputs());
if(useGrindingBall) {
res = new PoweredTask(nextRecipe, chance * gb.getChanceMultiplier(), getInputs());
res = new PoweredTask(nextRecipe, chance * gb.getChanceMultiplier(), getRecipeInputs());
res.setRequiredEnergy(res.getRequiredEnergy() * gb.getPowerMultiplier());
} else {
res = new PoweredTask(nextRecipe, chance, getInputs());
res = new PoweredTask(nextRecipe, chance, getRecipeInputs());
}
} else {
res = new PoweredTask(nextRecipe, chance, getInputs());
res = new PoweredTask(nextRecipe, chance, getRecipeInputs());
}
return res;
}
@@ -23,11 +23,11 @@ public abstract class AbstractMachineRecipe implements IMachineRecipe {
@Override
public List<MachineRecipeInput> getQuantitiesConsumed(MachineRecipeInput[] inputs) {
IRecipe rec = getRecipeForInputs(inputs);
List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();
List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();
for (RecipeInput ri : rec.getInputs()) {
for (MachineRecipeInput input : inputs) {
if(input != null && (input.item != null || input.fluid != null)) {
if(ri.isInput(input.item)) {
if(ri.isInput(input.item) && (ri.getSlotNumber() == -1 || ri.getSlotNumber() == input.slotNumber)) {
result.add(new MachineRecipeInput(input.slotNumber, ri.getInput().copy()));
break;
} else if(ri.isInput(input.fluid)) {
@@ -0,0 +1,120 @@
package crazypants.enderio.machine.recipe;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.MachineRecipeInput;
public class BasicManyToOneRecipe implements IManyToOneRecipe {
private final int energyRequired;
private final ItemStack output;
private final float expPerItem;
private final Recipe recipe;
public BasicManyToOneRecipe(Recipe recipe) {
this.recipe = recipe;
this.output = recipe.getOutputs()[0].getOutput().copy();
expPerItem = recipe.getOutputs()[0].getExperiance();
energyRequired = recipe.getEnergyRequired();
}
@Override
public boolean isValidRecipeComponents(ItemStack... items) {
List<RecipeInput> inputs = new ArrayList<RecipeInput>(Arrays.asList(recipe.getInputs()));
for (ItemStack is : items) {
if(is != null) {
RecipeInput remove = null;
for (RecipeInput ri : inputs) {
if(ri.isInput(is)) {
remove = ri;
break;
}
}
if(remove != null) {
inputs.remove(remove);
} else {
return false;
}
}
}
return true;
}
@Override
public ItemStack getOutput() {
return output;
}
@Override
public boolean isValidInput(int slot, ItemStack input) {
if(input == null) {
return false;
}
return getRecipeComponentFromInput(input) != null;
}
@Override
public boolean isValidInput(FluidStack fluid) {
return false;
}
@Override
public boolean isValid() {
return recipe != null && recipe.isValid();
}
@Override
public int getEnergyRequired() {
return energyRequired;
}
@Override
public RecipeOutput[] getOutputs() {
return recipe.getOutputs();
}
@Override
public List<ItemStack> getInputStacks() {
return recipe.getInputStacks();
}
@Override
public boolean isInputForRecipe(MachineRecipeInput... inputs) {
if(inputs == null) {
return false;
}
return recipe.isInputForRecipe(inputs);
}
@Override
public RecipeInput[] getInputs() {
return recipe.getInputs();
}
@Override
public List<FluidStack> getInputFluidStacks() {
return Collections.emptyList();
}
private ItemStack getRecipeComponentFromInput(ItemStack input) {
if(input == null) {
return null;
}
for (RecipeInput ri : recipe.getInputs()) {
if(ri.isInput(input)) {
return ri.getInput();
}
}
return null;
}
}
@@ -8,5 +8,7 @@ public interface CustomTagHandler {
boolean endElement(String uri, String localName, String qName) throws SAXException;
boolean startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException;
void configProcessed();
}
@@ -0,0 +1,11 @@
package crazypants.enderio.machine.recipe;
import net.minecraft.item.ItemStack;
public interface IManyToOneRecipe extends IRecipe {
boolean isValidRecipeComponents(ItemStack... items);
ItemStack getOutput();
}
@@ -0,0 +1,52 @@
package crazypants.enderio.machine.recipe;
import net.minecraft.item.ItemStack;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
public class ManyToOneMachineRecipe extends AbstractMachineRecipe {
private final String uid;
private final String machineName;
private final ManyToOneRecipeManager recipeManager;
public ManyToOneMachineRecipe(String uid, String machineName, ManyToOneRecipeManager recipeManager) {
this.uid = uid;
this.machineName = machineName;
this.recipeManager = recipeManager;
}
@Override
public String getUid() {
return uid;
}
@Override
public IRecipe getRecipeForInputs(MachineRecipeInput[] inputs) {
return recipeManager.getRecipeForInputs(inputs);
}
@Override
public boolean isValidInput(MachineRecipeInput input) {
if(input == null) {
return false;
}
return recipeManager.isValidInput(input);
}
@Override
public String getMachineName() {
return machineName;
}
@Override
public float getExperianceForOutput(ItemStack output) {
return recipeManager.getExperianceForOutput(output);
}
public boolean isValidRecipeComponents(ItemStack[] resultInv) {
return recipeManager.isValidRecipeComponents(resultInv);
}
}
@@ -0,0 +1,150 @@
package crazypants.enderio.machine.recipe;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import crazypants.enderio.Log;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.util.Util;
public class ManyToOneRecipeManager {
private final List<IManyToOneRecipe> recipes = new ArrayList<IManyToOneRecipe>();
private final String coreFileName;
private final String customFileName;
private final String managerName;
public ManyToOneRecipeManager(String coreFileName, String custonFileName, String managerName) {
this.coreFileName = coreFileName;
this.customFileName = custonFileName;
this.managerName = managerName;
}
public void loadRecipesFromConfig() {
CustomTagHandler tagHandler = createCustomTagHandler();
RecipeConfig config = RecipeConfig.loadRecipeConfig(coreFileName, customFileName, tagHandler);
if(config != null) {
processConfig(config);
if(tagHandler != null) {
tagHandler.configProcessed();
}
} else {
Log.error("Could not load recipes for " + managerName + ".");
}
}
protected CustomTagHandler createCustomTagHandler() {
return null;
}
public void addCustumRecipes(String xmlDef) {
RecipeConfig config;
CustomTagHandler tagHandler = createCustomTagHandler();
try {
config = RecipeConfigParser.parse(xmlDef, tagHandler);
} catch (Exception e) {
Log.error("Error parsing custom xml for " + managerName );
return;
}
if(config == null) {
Log.error("Could not process custom XML " + managerName);
return;
}
processConfig(config);
if(tagHandler != null) {
tagHandler.configProcessed();
}
}
public List<IManyToOneRecipe> getRecipes() {
return recipes;
}
private void processConfig(RecipeConfig config) {
if(config.isDumpItemRegistery()) {
Util.dumpModObjects(new File(Config.configDirectory, "modObjectsRegistery.txt"));
}
if(config.isDumpOreDictionary()) {
Util.dumpOreNames(new File(Config.configDirectory, "oreDictionaryRegistery.txt"));
}
List<Recipe> newRecipes = config.getRecipes(false);
Log.info("Found " + newRecipes.size() + " valid " + managerName + " recipes in config.");
for (Recipe rec : newRecipes) {
addRecipe(new BasicManyToOneRecipe(rec));
}
Log.info("Finished processing " + managerName + " recipes. " + recipes.size() + " recipes avaliable.");
}
public void addRecipe(IManyToOneRecipe recipe) {
if(recipe == null) {
Log.debug("Could not add invalid recipe: " + recipe + " for " + managerName );
return;
}
IRecipe rec = getRecipeForInputs(recipe.getInputStacks());
if(rec != null) {
Log.warn("Not adding supplied recipe to " + managerName + " as a recipe already exists for the inputs: " + recipe);
return;
}
recipes.add(recipe);
}
private IRecipe getRecipeForInputs(List<ItemStack> inputs) {
MachineRecipeInput[] ins = new MachineRecipeInput[inputs.size()];
for (int i = 0; i < inputs.size(); i++) {
ins[i] = new MachineRecipeInput(-1, inputs.get(i));
}
return getRecipeForInputs(ins);
}
public IRecipe getRecipeForInputs(MachineRecipeInput[] inputs) {
for (IManyToOneRecipe rec : recipes) {
if(rec.isInputForRecipe(inputs)) {
return rec;
}
}
return null;
}
public boolean isValidInput(MachineRecipeInput input) {
if(input == null || input.item == null) {
return false;
}
for (IManyToOneRecipe recipe : recipes) {
for (RecipeInput ri : recipe.getInputs()) {
if(ri.isInput(input.item) && (ri.getSlotNumber() == -1 || input.slotNumber == ri.getSlotNumber())) {
return true;
}
}
}
return false;
}
public boolean isValidRecipeComponents(ItemStack[] inputs) {
if(inputs == null || inputs.length == 0) {
return false;
}
for (IManyToOneRecipe recipe : recipes) {
if(recipe.isValidRecipeComponents(inputs)) {
return true;
}
}
return false;
}
public float getExperianceForOutput(ItemStack output) {
for (IManyToOneRecipe recipe : recipes) {
if(recipe.getOutput().getItem() == output.getItem() && recipe.getOutput().getItemDamage() == output.getItemDamage()) {
return recipe.getOutputs()[0].getExperiance();
}
}
return 0;
}
}
@@ -47,7 +47,7 @@ public class Recipe implements IRecipe {
RecipeInput required = null;
for(int i=0;i<requiredInputs.size() && required == null;i++) {
RecipeInput tst = requiredInputs.get(i);
if(tst.isInput(input.item) || tst.isInput(input.fluid)) {
if( (tst.isInput(input.item) && tst.getInput().stackSize > 0) || tst.isInput(input.fluid)) {
required = tst;
}
}
@@ -34,7 +34,6 @@ import crazypants.enderio.machine.recipe.RecipeConfig.RecipeGroup;
public class RecipeConfigParser extends DefaultHandler {
//public static final String ELEMENT_ROOT = "SAGMillRecipes";
public static final String ELEMENT_RECIPE_GROUP = "recipeGroup";
public static final String ELEMENT_RECIPE = "recipe";
public static final String ELEMENT_INPUT = "input";
@@ -322,7 +321,7 @@ public class RecipeConfigParser extends DefaultHandler {
//TODO: What a hack!
private boolean isElementRoot(String str) {
return "AlloySmelterRecipes".equals(str) || "SAGMillRecipes".equals(str) || "VatRecipes".equals(str);
return "AlloySmelterRecipes".equals(str) || "SAGMillRecipes".equals(str) || "VatRecipes".equals(str) || "SliceAndSpliceRecipes".equals(str);
}
private void addOutputStack(Attributes attributes) {
@@ -0,0 +1,75 @@
package crazypants.enderio.machine.slicensplice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineBlock;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.soul.BlockSoulBinder;
import crazypants.enderio.machine.soul.ContainerSoulBinder;
import crazypants.enderio.machine.soul.GuiSoulBinder;
import crazypants.enderio.machine.soul.SoulBinderSpawnerRecipe;
import crazypants.enderio.machine.soul.TileSoulBinder;
public class BlockSliceAndSplice extends AbstractMachineBlock<TileSliceAndSplice> {
public static int renderId;
public static BlockSliceAndSplice create() {
BlockSliceAndSplice result = new BlockSliceAndSplice();
result.init();
return result;
}
protected BlockSliceAndSplice() {
super(ModObject.blockSliceAndSplice, TileSliceAndSplice.class);
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileSliceAndSplice) {
return new ContainerSliceAndSplice(player.inventory, (AbstractMachineEntity) te);
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileSliceAndSplice) {
return new GuiSliceAndSplice(player.inventory, (AbstractMachineEntity) te);
}
return null;
}
@Override
protected int getGuiId() {
return GuiHandler.GUI_ID_SLICE_N_SPLICE;
}
@Override
protected String getMachineFrontIconKey(boolean active) {
return "enderio:blankMachinePanel";
}
// @Override
// public boolean renderAsNormalBlock() {
// return false;
// }
//
// @Override
// public boolean isOpaqueCube() {
// return false;
// }
//
// @Override
// public int getLightOpacity() {
// return 7;
// }
}
@@ -0,0 +1,52 @@
package crazypants.enderio.machine.slicensplice;
import java.awt.Point;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import crazypants.enderio.machine.AbstractMachineContainer;
import crazypants.enderio.machine.AbstractMachineEntity;
public class ContainerSliceAndSplice extends AbstractMachineContainer {
private static final Point[] inputLocs = new Point[] {
new Point(44,40),
new Point(62,40),
new Point(80,40),
new Point(44,58),
new Point(62,58),
new Point(80,58),
new Point(54,16),
new Point(72,16)
};
public ContainerSliceAndSplice(InventoryPlayer playerInv, AbstractMachineEntity te) {
super(playerInv, te);
}
@Override
protected void addMachineSlots(InventoryPlayer playerInv) {
for(int i=0;i<inputLocs.length;i++) {
Point p = inputLocs[i];
final int slot = i;
addSlotToContainer(new Slot(tileEntity, i, p.x, p.y) {
@Override
public boolean isItemValid(ItemStack itemStack) {
return tileEntity.isItemValidForSlot(slot, itemStack);
}
});
}
addSlotToContainer(new Slot(tileEntity, 8, 134, 48) {
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
return false;
}
});
}
}
@@ -0,0 +1,46 @@
package crazypants.enderio.machine.slicensplice;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.opengl.GL11;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.GuiMachineBase;
import crazypants.enderio.machine.soul.ContainerSoulBinder;
import crazypants.render.RenderUtil;
public class GuiSliceAndSplice extends GuiMachineBase {
private AbstractMachineEntity tileEntity;
public GuiSliceAndSplice(InventoryPlayer par1InventoryPlayer, AbstractMachineEntity te) {
super(te, new ContainerSliceAndSplice(par1InventoryPlayer, te));
tileEntity = te;
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderUtil.bindTexture("enderio:textures/gui/sliceAndSplice.png");
int k = (width - xSize) / 2;
int l = (height - ySize) / 2;
drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int i1;
// i1 = tileEntity.getProgressScaled(24);
// drawTexturedModalRect(k + 80, l + 34, 176, 14, i1 + 1, 16);
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
}
@Override
protected boolean showRecipeButton() {
return false;
}
}
@@ -0,0 +1,29 @@
package crazypants.enderio.machine.slicensplice;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.recipe.ManyToOneMachineRecipe;
import crazypants.enderio.machine.recipe.ManyToOneRecipeManager;
public class SliceAndSpliceRecipeManager extends ManyToOneRecipeManager {
static final SliceAndSpliceRecipeManager instance = new SliceAndSpliceRecipeManager();
public static SliceAndSpliceRecipeManager getInstance() {
return instance;
}
public SliceAndSpliceRecipeManager() {
super("SliceAndSpliceRecipes_Core.xml", "SliceAndSpliceRecipes_User.xml", "Slice'N'Splice");
}
@Override
public void loadRecipesFromConfig() {
super.loadRecipesFromConfig();
MachineRecipeRegistry.instance.registerRecipe(
ModObject.blockSliceAndSplice.unlocalisedName,
new ManyToOneMachineRecipe("SpliceAndSpliceRecipe",
ModObject.blockAlloySmelter.unlocalisedName, this));
}
}
@@ -0,0 +1,160 @@
package crazypants.enderio.machine.slicensplice;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemShears;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.util.FakePlayerFactory;
import crazypants.enderio.Log;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractPoweredTaskEntity;
import crazypants.enderio.machine.IMachineRecipe;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.machine.alloy.VanillaSmeltingRecipe;
import crazypants.enderio.machine.recipe.ManyToOneMachineRecipe;
public class TileSliceAndSplice extends AbstractPoweredTaskEntity {
private int axeIndex = 6;
private int shearsIndex = 7;
private EntityLivingBase fakePlayer;
public TileSliceAndSplice() {
super(new SlotDefinition(8, 1));
}
@Override
public String getMachineName() {
return ModObject.blockSliceAndSplice.unlocalisedName;
}
@Override
public int getInventoryStackLimit() {
return 1;
}
@Override
protected IMachineRecipe canStartNextTask(float chance) {
if(getAxe() == null || getShears() == null) {
return null;
}
return super.canStartNextTask(chance);
}
private ItemStack getAxe() {
return inventory[axeIndex];
}
private ItemStack getShears() {
return inventory[shearsIndex];
}
@Override
protected void taskComplete() {
super.taskComplete();
damageTool(getAxe(), axeIndex);
damageTool(getShears(), shearsIndex);
}
private void damageTool(ItemStack tool, int toolIndex) {
if(tool != null && tool.isItemStackDamageable()) {
tool.damageItem(1, getFakePlayer());
if(tool.getItemDamage() >= tool.getMaxDamage()) {
inventory[toolIndex] = null;
}
}
}
private EntityLivingBase getFakePlayer() {
if(fakePlayer == null) {
fakePlayer = FakePlayerFactory.getMinecraft(MinecraftServer.getServer().worldServerForDimension(worldObj.provider.dimensionId));
}
return fakePlayer;
}
protected MachineRecipeInput[] getRecipeInputs() {
MachineRecipeInput[] res = new MachineRecipeInput[slotDefinition.getNumInputSlots() - 2];
int fromSlot = slotDefinition.minInputSlot;
for (int i = 0; i < res.length; i++) {
res[i] = new MachineRecipeInput(fromSlot, inventory[fromSlot]);
fromSlot++;
}
return res;
}
@Override
protected boolean isMachineItemValidForSlot(int slot, ItemStack itemstack) {
if(itemstack == null || itemstack.getItem() == null) {
return false;
}
if(!slotDefinition.isInputSlot(slot)) {
return false;
}
if(slot == axeIndex) {
return itemstack.getItem() instanceof ItemAxe;
}
if(slot == shearsIndex) {
return itemstack.getItem() instanceof ItemShears;
}
ItemStack currentStackInSlot = inventory[slot];
if(currentStackInSlot != null) {
return currentStackInSlot.isItemEqual(itemstack);
}
int numSlotsFilled = 0;
for (int i = slotDefinition.getMinInputSlot(); i <= slotDefinition.getMaxInputSlot(); i++) {
if(i >= 0 && i < inventory.length && i != axeIndex && i != shearsIndex) {
if(inventory[i] != null && inventory[i].stackSize > 0) {
numSlotsFilled++;
}
}
}
List<IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForInput(getMachineName(), MachineRecipeInput.create(slot, itemstack));
if(numSlotsFilled == 0 && !recipes.isEmpty()) {
return true;
}
return isValidInputForAlloyRecipe(slot, itemstack, numSlotsFilled, recipes);
}
private boolean isValidInputForAlloyRecipe(int slot, ItemStack itemstack, int numSlotsFilled, List<IMachineRecipe> recipes) {
ItemStack[] resultInv = new ItemStack[slotDefinition.getNumInputSlots()];
for (int i = slotDefinition.getMinInputSlot(); i <= slotDefinition.getMaxInputSlot(); i++) {
if(i >= 0 && i < inventory.length && i != axeIndex && i != shearsIndex) {
if(i == slot) {
resultInv[i] = itemstack;
} else {
resultInv[i] = inventory[i];
}
}
}
for (IMachineRecipe recipe : recipes) {
if(recipe instanceof ManyToOneMachineRecipe) {
if(((ManyToOneMachineRecipe) recipe).isValidRecipeComponents(resultInv)) {
return true;
}
}
}
return false;
}
private boolean isItemAlreadyInASlot(ItemStack itemstack) {
ItemStack currentStackType = null;
for (int i = slotDefinition.getMinInputSlot(); i <= slotDefinition.getMaxInputSlot() && currentStackType == null; i++) {
currentStackType = inventory[i];
if(currentStackType != null && currentStackType.isItemEqual(itemstack)) {
return true;
}
}
return false;
}
}
@@ -44,13 +44,4 @@ public class GuiSoulBinder extends GuiMachineBase {
return false;
}
// @Override
// protected void renderSlotHighlight(int slot, Vector4f col) {
// if(tileEntity.getSlotDefinition().isOutputSlot(slot)) {
// renderSlotHighlight(col, 117,31,24,24);
// } else if(slot != 1) {
// super.renderSlotHighlight(slot, col);
// }
// }
}
@@ -177,7 +177,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
@Override
protected IPoweredTask createTask(IMachineRecipe nextRecipe, float chance) {
PoweredTask res = new PoweredTask(nextRecipe, chance, getInputs());
PoweredTask res = new PoweredTask(nextRecipe, chance, getRecipeInputs());
int ticksDelay = TilePoweredSpawner.MIN_SPAWN_DELAY_BASE
+ (int) Math.round((TilePoweredSpawner.MAX_SPAWN_DELAY_BASE - TilePoweredSpawner.MIN_SPAWN_DELAY_BASE) * Math.random());
@@ -50,7 +50,7 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler
@Override
protected boolean isMachineItemValidForSlot(int i, ItemStack itemstack) {
MachineRecipeInput[] inputs = getInputs();
MachineRecipeInput[] inputs = getRecipeInputs();
inputs[i] = new MachineRecipeInput(i, itemstack);
return VatRecipeManager.getInstance().isValidInput(inputs);
}
@@ -205,7 +205,7 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler
}
@Override
protected MachineRecipeInput[] getInputs() {
protected MachineRecipeInput[] getRecipeInputs() {
MachineRecipeInput[] res = new MachineRecipeInput[slotDefinition.getNumInputSlots() + 1];
int fromSlot = slotDefinition.minInputSlot;
for (int i = 0; i < res.length - 1; i++) {
@@ -227,7 +227,7 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler
return false;
}
MachineRecipeInput[] inputs = getInputs();
MachineRecipeInput[] inputs = getRecipeInputs();
if(inputTank.getFluidAmount() <= 0) {
inputs[inputs.length - 1] = new MachineRecipeInput(0, new FluidStack(fluid, 1));
}
@@ -12,9 +12,9 @@ import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
import crazypants.enderio.machine.alloy.GuiAlloySmelter;
import crazypants.enderio.machine.alloy.IAlloyRecipe;
import crazypants.enderio.machine.alloy.VanillaSmeltingRecipe;
import crazypants.enderio.machine.power.PowerDisplayUtil;
import crazypants.enderio.machine.recipe.IManyToOneRecipe;
import crazypants.enderio.machine.recipe.IRecipe;
import crazypants.enderio.machine.recipe.RecipeInput;