Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development
This commit is contained in:
commit
5c976f1b3c
10 changed files with 208 additions and 13 deletions
|
@ -305,11 +305,6 @@ public class CommonProxy
|
|||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
switch(ID)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -9,12 +9,17 @@ import net.minecraft.inventory.ISidedInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IEnergyTile, IStrictEnergyStorage, IEnergyHandler
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IEnergyTile, IStrictEnergyStorage, IEnergyHandler, IPeripheral
|
||||
{
|
||||
public int[] getBoundSlots(Coord4D location, int side);
|
||||
|
||||
public boolean canBoundInsert(Coord4D location, int i, ItemStack itemstack);
|
||||
|
||||
public boolean canBoundExtract(Coord4D location, int i, ItemStack itemstack, int j);
|
||||
|
||||
public void onPower();
|
||||
|
||||
public void onNoPower();
|
||||
}
|
||||
|
|
|
@ -547,6 +547,15 @@ public class Mekanism
|
|||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BasicBlock2, 1, 0), new Object[] {
|
||||
"CCC", "CTC", "CCC", Character.valueOf('C'), "ingotCopper", Character.valueOf('T'), new ItemStack(BasicBlock, 1, 9)
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 6), new Object[] {
|
||||
"CGC", "EAE", "CGC", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(), Character.valueOf('C'), "circuitBasic", Character.valueOf('A'), AtomicCore, Character.valueOf('E'), EnrichedAlloy
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 7), new Object[] {
|
||||
"CWC", "EIE", "CGC", Character.valueOf('W'), Item.bucketWater, Character.valueOf('C'), "circuitBasic", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('G'), MekanismUtils.getEmptyGasTank(), Character.valueOf('I'), new ItemStack(BasicBlock, 1, 8)
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 8), new Object[] {
|
||||
"CGC", "ASA", "CGC", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(), Character.valueOf('C'), "circuitBasic", Character.valueOf('A'), AtomicCore, Character.valueOf('S'), new ItemStack(BasicBlock, 1, 8)
|
||||
}));
|
||||
|
||||
for(RecipeType type : RecipeType.values())
|
||||
{
|
||||
|
|
|
@ -60,6 +60,16 @@ public class BlockBounding extends Block
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int id)
|
||||
{
|
||||
try {
|
||||
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getBlockTileEntity(x, y, z);
|
||||
tileEntity.onNeighborChange(id);
|
||||
Block.blocksList[world.getBlockId(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ)].onNeighborBlockChange(world, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ, id);
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
|
|
|
@ -49,6 +49,14 @@ public final class OreDictManager
|
|||
}
|
||||
}
|
||||
|
||||
if(OreDictionary.getOres("itemRubber").size() > 0)
|
||||
{
|
||||
for(ItemStack ore : OreDictionary.getOres("woodRubber"))
|
||||
{
|
||||
RecipeHandler.addPrecisionSawmillRecipe(MekanismUtils.size(ore, 1), new ChanceOutput(new ItemStack(Block.planks, 4), MekanismUtils.size(OreDictionary.getOres("itemRubber").get(0), 1), 1F));
|
||||
}
|
||||
}
|
||||
|
||||
for(ItemStack ore : OreDictionary.getOres("dustSulfur"))
|
||||
{
|
||||
RecipeHandler.addChemicalOxidizerRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 100));
|
||||
|
|
|
@ -12,15 +12,15 @@ public class ContainerDictionary extends Container
|
|||
{
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
for(int slotY = 0; slotY < 9; slotY++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
|
|
@ -17,8 +17,11 @@ import buildcraft.api.power.IPowerReceptor;
|
|||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IEnergyTile, IStrictEnergyStorage, IEnergyHandler
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IPowerReceptor, IEnergyTile, IStrictEnergyStorage, IEnergyHandler, IPeripheral
|
||||
{
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
|
@ -379,4 +382,92 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
|||
|
||||
return (IAdvancedBoundingBlock)new Coord4D(mainX, mainY, mainZ, worldObj.provider.dimensionId).getTileEntity(worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPower()
|
||||
{
|
||||
super.onPower();
|
||||
|
||||
if(getInv() != null)
|
||||
{
|
||||
getInv().onPower();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoPower()
|
||||
{
|
||||
super.onNoPower();
|
||||
|
||||
if(getInv() != null)
|
||||
{
|
||||
getInv().onNoPower();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getInv().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getInv().getMethodNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getInv().callMethod(computer, context, method, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttachToSide(int side)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return getInv().canAttachToSide(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attach(IComputerAccess computer)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getInv().attach(computer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getInv().detach(computer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
|
|||
public int mainX;
|
||||
public int mainY;
|
||||
public int mainZ;
|
||||
|
||||
public boolean prevPower;
|
||||
|
||||
public void setMainLocation(int x, int y, int z)
|
||||
{
|
||||
|
@ -47,6 +49,36 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onNeighborChange(int id)
|
||||
{
|
||||
TileEntity tile = worldObj.getBlockTileEntity(mainX, mainY, mainZ);
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)tile;
|
||||
|
||||
boolean power = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
|
||||
if(prevPower != power)
|
||||
{
|
||||
if(power)
|
||||
{
|
||||
onPower();
|
||||
}
|
||||
else {
|
||||
onNoPower();
|
||||
}
|
||||
|
||||
prevPower = power;
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketTileEntity().setParams(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), tileEntity.worldObj.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPower() {}
|
||||
|
||||
public void onNoPower() {}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
|
@ -54,6 +86,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
|
|||
mainX = dataStream.readInt();
|
||||
mainY = dataStream.readInt();
|
||||
mainZ = dataStream.readInt();
|
||||
prevPower = dataStream.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,6 +97,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
|
|||
mainX = nbtTags.getInteger("mainX");
|
||||
mainY = nbtTags.getInteger("mainY");
|
||||
mainZ = nbtTags.getInteger("mainZ");
|
||||
prevPower = nbtTags.getBoolean("prevPower");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,6 +108,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
|
|||
nbtTags.setInteger("mainX", mainX);
|
||||
nbtTags.setInteger("mainY", mainY);
|
||||
nbtTags.setInteger("mainZ", mainZ);
|
||||
nbtTags.setBoolean("prevPower", prevPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,6 +117,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
|
|||
data.add(mainX);
|
||||
data.add(mainY);
|
||||
data.add(mainZ);
|
||||
data.add(prevPower);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
|
||||
public boolean initCalc = false;
|
||||
|
||||
public int numPowering;
|
||||
|
||||
/** This machine's current RedstoneControl type. */
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
|
@ -135,7 +137,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
|
||||
ChargeUtils.discharge(27, this);
|
||||
|
||||
if(running && getEnergy() >= getPerTick() && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
||||
if(MekanismUtils.canFunction(this) && running && getEnergy() >= getPerTick() && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
||||
{
|
||||
setActive(true);
|
||||
|
||||
|
@ -512,6 +514,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
running = nbtTags.getBoolean("running");
|
||||
delay = nbtTags.getInteger("delay");
|
||||
silkTouch = nbtTags.getBoolean("silkTouch");
|
||||
numPowering = nbtTags.getInteger("numPowering");
|
||||
searcher.state = State.values()[nbtTags.getInteger("state")];
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
inverse = nbtTags.getBoolean("inverse");
|
||||
|
@ -551,6 +554,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
nbtTags.setBoolean("running", running);
|
||||
nbtTags.setInteger("delay", delay);
|
||||
nbtTags.setBoolean("silkTouch", silkTouch);
|
||||
nbtTags.setInteger("numPowering", numPowering);
|
||||
nbtTags.setInteger("state", searcher.state.ordinal());
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
nbtTags.setBoolean("inverse", inverse);
|
||||
|
@ -655,6 +659,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
isActive = dataStream.readBoolean();
|
||||
running = dataStream.readBoolean();
|
||||
silkTouch = dataStream.readBoolean();
|
||||
numPowering = dataStream.readInt();
|
||||
searcher.state = State.values()[dataStream.readInt()];
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
|
@ -688,6 +693,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
isActive = dataStream.readBoolean();
|
||||
running = dataStream.readBoolean();
|
||||
silkTouch = dataStream.readBoolean();
|
||||
numPowering = dataStream.readInt();
|
||||
searcher.state = State.values()[dataStream.readInt()];
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
|
@ -736,6 +742,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
data.add(isActive);
|
||||
data.add(running);
|
||||
data.add(silkTouch);
|
||||
data.add(numPowering);
|
||||
data.add(searcher.state.ordinal());
|
||||
|
||||
if(replaceStack != null)
|
||||
|
@ -789,6 +796,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
data.add(isActive);
|
||||
data.add(running);
|
||||
data.add(silkTouch);
|
||||
data.add(numPowering);
|
||||
data.add(searcher.state.ordinal());
|
||||
|
||||
if(replaceStack != null)
|
||||
|
@ -830,6 +838,12 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
return MekanismUtils.getMaxEnergy(getEnergyMultiplier(), MAX_ELECTRICITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowered()
|
||||
{
|
||||
return redstone || numPowering > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControl getControlType()
|
||||
{
|
||||
|
@ -1046,14 +1060,26 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPower()
|
||||
{
|
||||
numPowering++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoPower()
|
||||
{
|
||||
numPowering--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "Digital Miner";
|
||||
return getInvName();
|
||||
}
|
||||
|
||||
public String[] names = {"setRadius", "setMin", "setMax", "setReplace", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter"};
|
||||
public String[] names = {"setRadius", "setMin", "setMax", "setReplace", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop"};
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames()
|
||||
|
@ -1170,6 +1196,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(method == 8)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
else if(method == 9)
|
||||
{
|
||||
start();
|
||||
}
|
||||
else if(method == 10)
|
||||
{
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,9 @@ tile.MachineBlock2.ChemicalCombiner.name=Chemischer Kombinierer
|
|||
tile.MachineBlock2.ChemicalInjectionChamber.name=Chemische Injektionskammer
|
||||
tile.MachineBlock2.ElectrolyticSeparator.name=Elektrolytischer Separator
|
||||
tile.MachineBlock2.PrecisionSawmill.name=Präzisionssägewerk
|
||||
tile.MachineBlock2.ChemicalDissolutionChamber.name=Chemische Auflösungskammer
|
||||
tile.MachineBlock2.ChemicalWasher.name=Chemische Waschanlage
|
||||
tile.MachineBlock2.ChemicalCrystalizer.name=Chemischer Kristallisierer
|
||||
|
||||
//Infuse types
|
||||
infuse.carbon=Kohlenstoff
|
||||
|
|
Loading…
Reference in a new issue