Work on Formulaic Assemblicator, got a lot more of the core logic done than I was expecting to
This commit is contained in:
parent
2db6fde118
commit
a247a80d53
13 changed files with 619 additions and 7 deletions
|
@ -122,6 +122,7 @@ public class MekanismConfig
|
|||
public static double laserUsage;
|
||||
public static double gasCentrifugeUsage;
|
||||
public static double heavyWaterElectrolysisUsage;
|
||||
public static double formulaicAssemblicatorUsage;
|
||||
}
|
||||
|
||||
public static class generators
|
||||
|
|
|
@ -66,6 +66,7 @@ import mekanism.common.tile.TileEntityEnrichmentChamber;
|
|||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.tile.TileEntityFluidTank;
|
||||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
import mekanism.common.tile.TileEntityFormulaicAssemblicator;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
|
@ -1172,7 +1173,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
|||
SOLAR_NEUTRON_ACTIVATOR(MachineBlock.MACHINE_BLOCK_3, 1, "SolarNeutronActivator", 47, TileEntitySolarNeutronActivator.class, false, true, false),
|
||||
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false),
|
||||
OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false),
|
||||
RESISTIVE_HEATER(MachineBlock.MACHINE_BLOCK_3, 4, "ResistiveHeater", 53, TileEntityResistiveHeater.class, true, false, false);
|
||||
RESISTIVE_HEATER(MachineBlock.MACHINE_BLOCK_3, 4, "ResistiveHeater", 53, TileEntityResistiveHeater.class, true, false, false),
|
||||
FORMULAIC_ASSEMBLICATOR(MachineBlock.MACHINE_BLOCK_3, 5, "FormulaicAssemblicator", 56, TileEntityFormulaicAssemblicator.class, true, false, true);
|
||||
|
||||
public MachineBlock typeBlock;
|
||||
public int meta;
|
||||
|
@ -1223,7 +1225,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
|||
|
||||
for(MachineType type : MachineType.values())
|
||||
{
|
||||
if(type != AMBIENT_ACCUMULATOR)
|
||||
if(type != AMBIENT_ACCUMULATOR && type != FORMULAIC_ASSEMBLICATOR)
|
||||
{
|
||||
ret.add(type);
|
||||
}
|
||||
|
@ -1343,6 +1345,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
|||
return 0;
|
||||
case RESISTIVE_HEATER:
|
||||
return 100;
|
||||
case FORMULAIC_ASSEMBLICATOR:
|
||||
return usage.formulaicAssemblicatorUsage;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package mekanism.common.content.assemblicator;
|
||||
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.RecipeUtils;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RecipeFormula
|
||||
{
|
||||
public InventoryCrafting dummy = MekanismUtils.getDummyCraftingInv();
|
||||
|
||||
public ItemStack[] input = new ItemStack[9];
|
||||
|
||||
public RecipeFormula(ItemStack[] inv)
|
||||
{
|
||||
this(inv, 0);
|
||||
}
|
||||
|
||||
public RecipeFormula(ItemStack[] inv, int start)
|
||||
{
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
input[i] = StackUtils.size(inv[start+i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetToRecipe()
|
||||
{
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
dummy.setInventorySlotContents(i, input[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean matches(World world, ItemStack[] input, int start)
|
||||
{
|
||||
resetToRecipe();
|
||||
|
||||
IRecipe origRecipe = RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
dummy.setInventorySlotContents(i, input[start+i]);
|
||||
}
|
||||
|
||||
IRecipe newRecipe = RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
|
||||
return origRecipe == newRecipe;
|
||||
}
|
||||
|
||||
public boolean isIngredientInPos(World world, ItemStack stack, int i)
|
||||
{
|
||||
resetToRecipe();
|
||||
|
||||
IRecipe origRecipe = RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
dummy.setInventorySlotContents(i, stack);
|
||||
IRecipe newRecipe = RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
|
||||
return origRecipe == newRecipe;
|
||||
}
|
||||
|
||||
public boolean isIngredient(World world, ItemStack stack)
|
||||
{
|
||||
resetToRecipe();
|
||||
|
||||
IRecipe origRecipe = RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
dummy.setInventorySlotContents(i, stack);
|
||||
|
||||
IRecipe newRecipe = RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
|
||||
if(origRecipe == newRecipe)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
dummy.setInventorySlotContents(i, input[i]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isValidFormula(World world)
|
||||
{
|
||||
return getRecipe(world) != null;
|
||||
}
|
||||
|
||||
public IRecipe getRecipe(World world)
|
||||
{
|
||||
resetToRecipe();
|
||||
|
||||
return RecipeUtils.getRecipeFromGrid(dummy, world);
|
||||
}
|
||||
|
||||
public boolean isFormulaEqual(World world, RecipeFormula formula)
|
||||
{
|
||||
return formula.getRecipe(world) == getRecipe(world);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -18,7 +17,6 @@ public class ItemControlCircuit extends ItemMekanism
|
|||
{
|
||||
super();
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
17
src/main/java/mekanism/common/item/ItemRecipeFormula.java
Normal file
17
src/main/java/mekanism/common/item/ItemRecipeFormula.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package mekanism.common.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemRecipeFormula extends ItemMekanism
|
||||
{
|
||||
public ItemRecipeFormula()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,454 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigCardAccess;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.content.assemblicator.RecipeFormula;
|
||||
import mekanism.common.item.ItemRecipeFormula;
|
||||
import mekanism.common.tile.component.TileComponentConfig;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock implements ISideConfiguration, IUpgradeTile, IRedstoneControl, IConfigCardAccess
|
||||
{
|
||||
public InventoryCrafting dummyInv = MekanismUtils.getDummyCraftingInv();
|
||||
|
||||
public double BASE_ENERGY_PER_TICK = usage.metallurgicInfuserUsage;
|
||||
|
||||
public double energyPerTick = BASE_ENERGY_PER_TICK;
|
||||
|
||||
public int BASE_TICKS_REQUIRED = 100;
|
||||
|
||||
public int ticksRequired = BASE_TICKS_REQUIRED;
|
||||
|
||||
public int operatingTicks;
|
||||
|
||||
public boolean autoMode = false;
|
||||
|
||||
public RecipeFormula formula;
|
||||
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public TileComponentUpgrade upgradeComponent;
|
||||
public TileComponentEjector ejectorComponent;
|
||||
public TileComponentConfig configComponent;
|
||||
|
||||
public TileEntityFormulaicAssemblicator()
|
||||
{
|
||||
super("FormulaicAssemblicator", MachineType.FORMULAIC_ASSEMBLICATOR.baseEnergy);
|
||||
|
||||
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
|
||||
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED,
|
||||
new int[] {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}));
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {21, 22, 23, 24, 25, 26}));
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
|
||||
|
||||
configComponent.setConfig(TransmissionType.ITEM, new byte[] {0, 0, 0, 3, 1, 2});
|
||||
configComponent.setInputConfig(TransmissionType.ENERGY);
|
||||
|
||||
inventory = new ItemStack[35];
|
||||
|
||||
upgradeComponent = new TileComponentUpgrade(this, 0);
|
||||
|
||||
ejectorComponent = new TileComponentEjector(this);
|
||||
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChargeUtils.discharge(1, this);
|
||||
|
||||
if(inventory[2] != null && inventory[2].getItem() instanceof ItemRecipeFormula)
|
||||
{
|
||||
|
||||
}
|
||||
else {
|
||||
formula = null;
|
||||
}
|
||||
|
||||
if(autoMode && formula != null)
|
||||
{
|
||||
boolean canOperate = true;
|
||||
|
||||
if(!formula.matches(worldObj, inventory, 27))
|
||||
{
|
||||
canOperate = moveItemsToGrid();
|
||||
}
|
||||
|
||||
if(canOperate)
|
||||
{
|
||||
if(operatingTicks == ticksRequired)
|
||||
{
|
||||
if(MekanismUtils.canFunction(this))
|
||||
{
|
||||
doSingleCraft();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(getEnergy() >= energyPerTick)
|
||||
{
|
||||
operatingTicks++;
|
||||
setEnergy(getEnergy() - energyPerTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
operatingTicks = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
operatingTicks = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean doSingleCraft()
|
||||
{
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
dummyInv.setInventorySlotContents(i, inventory[27+i]);
|
||||
}
|
||||
|
||||
ItemStack output = MekanismUtils.findMatchingRecipe(dummyInv, worldObj);
|
||||
|
||||
if(output != null && tryMoveToOutput(output, false))
|
||||
{
|
||||
tryMoveToOutput(output, true);
|
||||
|
||||
for(int i = 27; i <= 35; i++)
|
||||
{
|
||||
inventory[i].stackSize--;
|
||||
|
||||
if(inventory[i].stackSize == 0)
|
||||
{
|
||||
inventory[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean craftSingle()
|
||||
{
|
||||
if(formula != null)
|
||||
{
|
||||
boolean canOperate = false;
|
||||
|
||||
if(!formula.matches(worldObj, inventory, 27))
|
||||
{
|
||||
canOperate = moveItemsToGrid();
|
||||
}
|
||||
|
||||
if(canOperate)
|
||||
{
|
||||
doSingleCraft();
|
||||
}
|
||||
}
|
||||
else {
|
||||
doSingleCraft();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean moveItemsToGrid()
|
||||
{
|
||||
for(int i = 27; i <= 35; i++)
|
||||
{
|
||||
if(formula.isIngredientInPos(worldObj, inventory[i], i-27))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(inventory[i] != null)
|
||||
{
|
||||
inventory[i] = tryMoveToInput(inventory[i]);
|
||||
|
||||
if(inventory[i] != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean found = false;
|
||||
|
||||
for(int j = 3; j <= 20; j++)
|
||||
{
|
||||
if(inventory[j] != null && formula.isIngredientInPos(worldObj, inventory[j], i-27))
|
||||
{
|
||||
inventory[i] = StackUtils.size(inventory[j], 1);
|
||||
inventory[j].stackSize--;
|
||||
|
||||
if(inventory[j].stackSize == 0)
|
||||
{
|
||||
inventory[j] = null;
|
||||
}
|
||||
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void craftAll()
|
||||
{
|
||||
while(craftSingle());
|
||||
}
|
||||
|
||||
private void toggleAutoMode()
|
||||
{
|
||||
if(autoMode)
|
||||
{
|
||||
operatingTicks = 0;
|
||||
autoMode = false;
|
||||
}
|
||||
else {
|
||||
for(int i = 27; i <= 35; i++)
|
||||
{
|
||||
inventory[i] = tryMoveToInput(inventory[i]);
|
||||
}
|
||||
|
||||
autoMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack tryMoveToInput(ItemStack stack)
|
||||
{
|
||||
stack = stack.copy();
|
||||
|
||||
for(int i = 3; i <= 20; i++)
|
||||
{
|
||||
if(inventory[i] == null)
|
||||
{
|
||||
inventory[i] = stack;
|
||||
|
||||
return null;
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(stack, inventory[i]) && inventory[i].stackSize < inventory[i].getMaxStackSize())
|
||||
{
|
||||
int toUse = Math.min(stack.stackSize, inventory[i].getMaxStackSize()-inventory[i].stackSize);
|
||||
|
||||
inventory[i].stackSize += toUse;
|
||||
stack.stackSize -= toUse;
|
||||
|
||||
if(stack.stackSize == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
private boolean tryMoveToOutput(ItemStack stack, boolean doMove)
|
||||
{
|
||||
stack = stack.copy();
|
||||
|
||||
for(int i = 21; i <= 26; i++)
|
||||
{
|
||||
if(inventory[i] == null)
|
||||
{
|
||||
if(doMove)
|
||||
{
|
||||
inventory[i] = stack;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(stack, inventory[i]) && inventory[i].stackSize < inventory[i].getMaxStackSize())
|
||||
{
|
||||
int toUse = Math.min(stack.stackSize, inventory[i].getMaxStackSize()-inventory[i].stackSize);
|
||||
|
||||
if(doMove)
|
||||
{
|
||||
inventory[i].stackSize += toUse;
|
||||
}
|
||||
|
||||
stack.stackSize -= toUse;
|
||||
|
||||
if(stack.stackSize == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void encodeFormula()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSetFacing(int side)
|
||||
{
|
||||
return side != 0 && side != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
autoMode = nbtTags.getBoolean("autoMode");
|
||||
operatingTicks = nbtTags.getInteger("operatingTicks");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("autoMode", autoMode);
|
||||
nbtTags.setInteger("operatingTicks", operatingTicks);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteBuf dataStream)
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
int type = dataStream.readInt();
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
toggleAutoMode();
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
encodeFormula();
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
craftSingle();
|
||||
}
|
||||
else if(type == 3)
|
||||
{
|
||||
craftAll();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
autoMode = dataStream.readBoolean();
|
||||
operatingTicks = dataStream.readInt();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(autoMode);
|
||||
data.add(operatingTicks);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControl getControlType()
|
||||
{
|
||||
return controlType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlType(RedstoneControl type)
|
||||
{
|
||||
controlType = type;
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPulse()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentConfig getConfig()
|
||||
{
|
||||
return configComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrientation()
|
||||
{
|
||||
return facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentUpgrade getComponent()
|
||||
{
|
||||
return upgradeComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculateUpgradables(Upgrade upgrade)
|
||||
{
|
||||
super.recalculateUpgradables(upgrade);
|
||||
|
||||
switch(upgrade)
|
||||
{
|
||||
case SPEED:
|
||||
ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED);
|
||||
case ENERGY:
|
||||
energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK);
|
||||
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -86,8 +86,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme
|
|||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if(collectedEnergy > 0)
|
||||
{
|
||||
double firing = collectedEnergy;
|
||||
|
|
|
@ -115,6 +115,12 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSetFacing(int side)
|
||||
{
|
||||
return side != 0 && side != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getVolume()
|
||||
{
|
||||
|
|
|
@ -62,6 +62,7 @@ import net.minecraft.client.gui.FontRenderer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -1355,9 +1356,22 @@ public final class MekanismUtils
|
|||
|
||||
return tank;
|
||||
}
|
||||
|
||||
public static InventoryCrafting getDummyCraftingInv()
|
||||
{
|
||||
Container tempContainer = new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
return new InventoryCrafting(tempContainer, 3, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the output of a defined InventoryCrafting grid. Taken from CofhCore.
|
||||
* Finds the output of a defined InventoryCrafting grid.
|
||||
* @param inv - InventoryCrafting to check
|
||||
* @param world - world reference
|
||||
* @return output ItemStack
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class RecipeUtils
|
||||
|
@ -263,4 +264,17 @@ public class RecipeUtils
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IRecipe getRecipeFromGrid(InventoryCrafting inv, World world)
|
||||
{
|
||||
for(IRecipe recipe : (List<IRecipe>)CraftingManager.getInstance().getRecipeList())
|
||||
{
|
||||
if(recipe.matches(inv, world))
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.2 KiB |
|
@ -151,6 +151,7 @@ tile.MachineBlock3.QuantumEntangloporter.name=Quantum Entangloporter
|
|||
tile.MachineBlock3.SolarNeutronActivator.name=Solar Neutron Activator
|
||||
tile.MachineBlock3.Oredictionificator.name=Oredictionificator
|
||||
tile.MachineBlock3.ResistiveHeater.name=Resistive Heater
|
||||
tile.MachineBlock3.FormulaicAssemblicator.name=Formulaic Assemblicator
|
||||
|
||||
//Plastic
|
||||
tile.PlasticBlock.name=Plastic Block
|
||||
|
|
Loading…
Reference in a new issue