Changed the Primitive Blast Furnace so that it uses the new Recipe Map
This commit is contained in:
parent
7982374b38
commit
b3e0b41ee6
1 changed files with 271 additions and 273 deletions
|
@ -9,6 +9,7 @@ import gregtech.api.metatileentity.MetaTileEntity;
|
|||
import gregtech.api.objects.GT_ItemStack;
|
||||
import gregtech.api.objects.XSTR;
|
||||
import gregtech.api.util.GT_OreDictUnificator;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import gregtech.common.gui.GT_Container_BronzeBlastFurnace;
|
||||
|
@ -22,310 +23,307 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace
|
||||
extends MetaTileEntity {
|
||||
public int mMaxProgresstime = 0;
|
||||
public int mUpdate = 5;
|
||||
public int mProgresstime = 0;
|
||||
public boolean mMachine = false;
|
||||
public ItemStack mOutputItem1;
|
||||
public ItemStack mOutputItem2;
|
||||
public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEntity {
|
||||
private static final int INPUT_SLOTS = 2, OUTPUT_SLOTS = 2;
|
||||
|
||||
public GT_MetaTileEntity_PrimitiveBlastFurnace(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional, 4);
|
||||
}
|
||||
public int mMaxProgresstime = 0;
|
||||
public int mUpdate = 5;
|
||||
public int mProgresstime = 0;
|
||||
public boolean mMachine = false;
|
||||
|
||||
public GT_MetaTileEntity_PrimitiveBlastFurnace(String aName) {
|
||||
super(aName, 4);
|
||||
}
|
||||
public ItemStack[] mOutputItems = new ItemStack[OUTPUT_SLOTS];
|
||||
|
||||
public boolean isSteampowered() {
|
||||
return false;
|
||||
}
|
||||
@Deprecated
|
||||
public ItemStack mOutputItem1;
|
||||
@Deprecated
|
||||
public ItemStack mOutputItem2;
|
||||
|
||||
public boolean isElectric() {
|
||||
return false;
|
||||
}
|
||||
public GT_MetaTileEntity_PrimitiveBlastFurnace(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional, INPUT_SLOTS + OUTPUT_SLOTS);
|
||||
}
|
||||
|
||||
public boolean isPneumatic() {
|
||||
return false;
|
||||
}
|
||||
public GT_MetaTileEntity_PrimitiveBlastFurnace(String aName) {
|
||||
super(aName, INPUT_SLOTS + OUTPUT_SLOTS);
|
||||
}
|
||||
|
||||
public boolean isEnetInput() {
|
||||
return false;
|
||||
}
|
||||
public boolean isSteampowered() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isEnetOutput() {
|
||||
return false;
|
||||
}
|
||||
public boolean isElectric() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInputFacing(byte aSide) {
|
||||
return false;
|
||||
}
|
||||
public boolean isPneumatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOutputFacing(byte aSide) {
|
||||
return false;
|
||||
}
|
||||
public boolean isEnetInput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTeleporterCompatible() {
|
||||
return false;
|
||||
}
|
||||
public boolean isEnetOutput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFacingValid(byte aFacing) {
|
||||
return aFacing > 1;
|
||||
}
|
||||
public boolean isInputFacing(byte aSide) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isAccessAllowed(EntityPlayer aPlayer) {
|
||||
return true;
|
||||
}
|
||||
public boolean isOutputFacing(byte aSide) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getProgresstime() {
|
||||
return this.mProgresstime;
|
||||
}
|
||||
public boolean isTeleporterCompatible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int maxProgresstime() {
|
||||
return this.mMaxProgresstime;
|
||||
}
|
||||
public boolean isFacingValid(byte aFacing) {
|
||||
return aFacing > 1;
|
||||
}
|
||||
|
||||
public int increaseProgress(int aProgress) {
|
||||
this.mProgresstime += aProgress;
|
||||
return this.mMaxProgresstime - this.mProgresstime;
|
||||
}
|
||||
public boolean isAccessAllowed(EntityPlayer aPlayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
|
||||
return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID));
|
||||
}
|
||||
public int getProgresstime() {
|
||||
return this.mProgresstime;
|
||||
}
|
||||
|
||||
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
|
||||
return new GT_MetaTileEntity_BronzeBlastFurnace(this.mName);
|
||||
}
|
||||
public int maxProgresstime() {
|
||||
return this.mMaxProgresstime;
|
||||
}
|
||||
|
||||
public void saveNBTData(NBTTagCompound aNBT) {
|
||||
aNBT.setInteger("mProgresstime", this.mProgresstime);
|
||||
aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime);
|
||||
if (this.mOutputItem1 != null) {
|
||||
NBTTagCompound tNBT = new NBTTagCompound();
|
||||
this.mOutputItem1.writeToNBT(tNBT);
|
||||
aNBT.setTag("mOutputItem1", tNBT);
|
||||
}
|
||||
if (this.mOutputItem2 != null) {
|
||||
NBTTagCompound tNBT = new NBTTagCompound();
|
||||
this.mOutputItem2.writeToNBT(tNBT);
|
||||
aNBT.setTag("mOutputItem2", tNBT);
|
||||
}
|
||||
}
|
||||
public int increaseProgress(int aProgress) {
|
||||
this.mProgresstime += aProgress;
|
||||
return this.mMaxProgresstime - this.mProgresstime;
|
||||
}
|
||||
|
||||
public void loadNBTData(NBTTagCompound aNBT) {
|
||||
this.mUpdate = 5;
|
||||
this.mProgresstime = aNBT.getInteger("mProgresstime");
|
||||
this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
|
||||
this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1");
|
||||
this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2");
|
||||
}
|
||||
public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
|
||||
return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID));
|
||||
}
|
||||
|
||||
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
|
||||
if (aBaseMetaTileEntity.isClientSide()) {
|
||||
return true;
|
||||
}
|
||||
aBaseMetaTileEntity.openGUI(aPlayer);
|
||||
return true;
|
||||
}
|
||||
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
|
||||
return new GT_MetaTileEntity_BronzeBlastFurnace(this.mName);
|
||||
}
|
||||
|
||||
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
return new GT_Container_BronzeBlastFurnace(aPlayerInventory, aBaseMetaTileEntity);
|
||||
}
|
||||
public void saveNBTData(NBTTagCompound aNBT) {
|
||||
aNBT.setInteger("mProgresstime", this.mProgresstime);
|
||||
aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime);
|
||||
if (this.mOutputItems != null) {
|
||||
for (int i = 0; i < mOutputItems.length; i++) {
|
||||
if (this.mOutputItems[i] != null) {
|
||||
NBTTagCompound tNBT = new NBTTagCompound();
|
||||
this.mOutputItems[i].writeToNBT(tNBT);
|
||||
aNBT.setTag("mOutputItem" + i, tNBT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
return new GT_GUIContainer_BronzeBlastFurnace(aPlayerInventory, aBaseMetaTileEntity);
|
||||
}
|
||||
public void loadNBTData(NBTTagCompound aNBT) {
|
||||
this.mUpdate = 5;
|
||||
this.mProgresstime = aNBT.getInteger("mProgresstime");
|
||||
this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
|
||||
this.mOutputItems = new ItemStack[OUTPUT_SLOTS];
|
||||
for (int i = 0; i < OUTPUT_SLOTS; i++) {
|
||||
this.mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMachine() {
|
||||
int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX;
|
||||
int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ;
|
||||
for (int i = -1; i < 2; i++) {
|
||||
for (int j = -1; j < 3; j++) {
|
||||
for (int k = -1; k < 2; k++) {
|
||||
if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) {
|
||||
if ((i != 0) || (j == -1) || (k != 0)) {
|
||||
if (!isCorrectCasingBlock(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k)) || !isCorrectCasingMetaID(getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k))) {
|
||||
return false;
|
||||
}
|
||||
} else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
|
||||
if (aBaseMetaTileEntity.isClientSide()) {
|
||||
return true;
|
||||
}
|
||||
aBaseMetaTileEntity.openGUI(aPlayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract boolean isCorrectCasingBlock(Block block);
|
||||
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
return new GT_Container_BronzeBlastFurnace(aPlayerInventory, aBaseMetaTileEntity);
|
||||
}
|
||||
|
||||
protected abstract boolean isCorrectCasingMetaID(int metaID);
|
||||
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
||||
return new GT_GUIContainer_BronzeBlastFurnace(aPlayerInventory, aBaseMetaTileEntity);
|
||||
}
|
||||
|
||||
public void onMachineBlockUpdate() {
|
||||
this.mUpdate = 5;
|
||||
}
|
||||
private boolean checkMachine() {
|
||||
int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX;
|
||||
int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ;
|
||||
for (int i = -1; i < 2; i++) {
|
||||
for (int j = -1; j < 3; j++) {
|
||||
for (int k = -1; k < 2; k++) {
|
||||
if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) {
|
||||
if ((i != 0) || (j == -1) || (k != 0)) {
|
||||
if (!isCorrectCasingBlock(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k))
|
||||
|| !isCorrectCasingMetaID(getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k))) {
|
||||
return false;
|
||||
}
|
||||
} else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k),
|
||||
new Object[] { Blocks.lava, Blocks.flowing_lava, null }))
|
||||
&& (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
|
||||
if ((aBaseMetaTileEntity.isClientSide()) &&
|
||||
(aBaseMetaTileEntity.isActive())) {
|
||||
aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D);
|
||||
}
|
||||
if (aBaseMetaTileEntity.isServerSide()) {
|
||||
if (this.mUpdate-- == 0) {
|
||||
this.mMachine = checkMachine();
|
||||
}
|
||||
if (this.mMachine) {
|
||||
if (this.mMaxProgresstime > 0) {
|
||||
if (++this.mProgresstime >= this.mMaxProgresstime) {
|
||||
addOutputProducts();
|
||||
this.mOutputItem1 = null;
|
||||
this.mOutputItem2 = null;
|
||||
this.mProgresstime = 0;
|
||||
this.mMaxProgresstime = 0;
|
||||
GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel");
|
||||
}
|
||||
} else if (aBaseMetaTileEntity.isAllowedToWork()) {
|
||||
checkRecipe();
|
||||
}
|
||||
}
|
||||
if(this.mMaxProgresstime>0 && (aTimer % 20L == 0L)){
|
||||
GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 50);
|
||||
}
|
||||
protected abstract boolean isCorrectCasingBlock(Block block);
|
||||
|
||||
aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine));
|
||||
if (aBaseMetaTileEntity.isActive()) {
|
||||
if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
} else {
|
||||
if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected abstract boolean isCorrectCasingMetaID(int metaID);
|
||||
|
||||
private void addOutputProducts() {
|
||||
if (this.mOutputItem1 != null) {
|
||||
if (this.mInventory[2] == null) {
|
||||
this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1});
|
||||
} else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) {
|
||||
this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize);
|
||||
}
|
||||
}
|
||||
if (this.mOutputItem2 != null) {
|
||||
if (this.mInventory[3] == null) {
|
||||
this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2});
|
||||
} else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) {
|
||||
this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onMachineBlockUpdate() {
|
||||
this.mUpdate = 5;
|
||||
}
|
||||
|
||||
private boolean spaceForOutput(ItemStack aStack1, ItemStack aStack2) {
|
||||
if (((this.mInventory[2] == null) || (aStack1 == null) || ((this.mInventory[2].stackSize + aStack1.stackSize <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && (
|
||||
(this.mInventory[3] == null) || (aStack2 == null) || ((this.mInventory[3].stackSize + aStack2.stackSize <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
|
||||
if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) {
|
||||
aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke",
|
||||
aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(),
|
||||
aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D);
|
||||
}
|
||||
if (aBaseMetaTileEntity.isServerSide()) {
|
||||
if (this.mUpdate-- == 0) {
|
||||
this.mMachine = checkMachine();
|
||||
}
|
||||
if (this.mMachine) {
|
||||
if (this.mMaxProgresstime > 0) {
|
||||
if (++this.mProgresstime >= this.mMaxProgresstime) {
|
||||
addOutputProducts();
|
||||
this.mOutputItems = null;
|
||||
this.mProgresstime = 0;
|
||||
this.mMaxProgresstime = 0;
|
||||
GT_Mod.achievements.issueAchievement(
|
||||
aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel");
|
||||
}
|
||||
} else if (aBaseMetaTileEntity.isAllowedToWork()) {
|
||||
checkRecipe();
|
||||
}
|
||||
}
|
||||
if (this.mMaxProgresstime > 0 && (aTimer % 20L == 0L)) {
|
||||
GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(),
|
||||
new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(),
|
||||
this.getBaseMetaTileEntity().getZCoord()),
|
||||
50);
|
||||
}
|
||||
|
||||
private boolean checkRecipe() {
|
||||
if (!this.mMachine) {
|
||||
return false;
|
||||
}
|
||||
if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) {
|
||||
if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) {
|
||||
if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 4);
|
||||
this.mMaxProgresstime = 7200;
|
||||
return true;
|
||||
}
|
||||
if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 2);
|
||||
this.mMaxProgresstime = 4800;
|
||||
return true;
|
||||
}
|
||||
if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 9);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 4);
|
||||
this.mMaxProgresstime = 64800;
|
||||
return true;
|
||||
}
|
||||
} else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) {
|
||||
if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 2);
|
||||
this.mMaxProgresstime = 3600;
|
||||
return true;
|
||||
}
|
||||
if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 1);
|
||||
this.mMaxProgresstime = 2400;
|
||||
return true;
|
||||
}
|
||||
if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 9);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 2);
|
||||
this.mMaxProgresstime = 32400;
|
||||
return true;
|
||||
}
|
||||
} else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) {
|
||||
if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 36);
|
||||
this.mMaxProgresstime = 64800;
|
||||
return true;
|
||||
}
|
||||
if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 18);
|
||||
this.mMaxProgresstime = 43200;
|
||||
return true;
|
||||
}
|
||||
if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) {
|
||||
getBaseMetaTileEntity().decrStackSize(0, 1);
|
||||
getBaseMetaTileEntity().decrStackSize(1, 4);
|
||||
this.mMaxProgresstime = 64800;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mOutputItem1 = null;
|
||||
this.mOutputItem2 = null;
|
||||
return false;
|
||||
}
|
||||
aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine));
|
||||
if (aBaseMetaTileEntity.isActive()) {
|
||||
if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
Blocks.lava, 1, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
Blocks.lava, 1, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
} else {
|
||||
if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord(),
|
||||
aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
Blocks.air, 0, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord() + 1,
|
||||
aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) {
|
||||
aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1),
|
||||
Blocks.air, 0, 2);
|
||||
this.mUpdate = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isGivingInformation() {
|
||||
return false;
|
||||
}
|
||||
private void addOutputProducts() {
|
||||
if (this.mOutputItems == null) {
|
||||
return;
|
||||
}
|
||||
int limit = Math.min(mOutputItems.length, OUTPUT_SLOTS);
|
||||
for (int i = 0; i < limit; i++) {
|
||||
int absi = INPUT_SLOTS + i;
|
||||
if (this.mInventory[absi] == null) {
|
||||
this.mInventory[absi] = GT_Utility.copy(this.mOutputItems[i]);
|
||||
} else if (GT_Utility.areStacksEqual(this.mInventory[absi], this.mOutputItems[i])) {
|
||||
this.mInventory[absi].stackSize = Math.min(this.mInventory[absi].getMaxStackSize(),
|
||||
this.mInventory[absi].stackSize + this.mOutputItems[i].stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
||||
return aIndex > 1;
|
||||
}
|
||||
private boolean spaceForOutput(ItemStack outputStack, int relativeOutputSlot) {
|
||||
int absoluteSlot = relativeOutputSlot + INPUT_SLOTS;
|
||||
if (this.mInventory[absoluteSlot] == null || outputStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (((this.mInventory[absoluteSlot].stackSize + outputStack.stackSize <= this.mInventory[absoluteSlot].getMaxStackSize())
|
||||
&& (GT_Utility.areStacksEqual(this.mInventory[absoluteSlot], outputStack)))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
||||
return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]);
|
||||
}
|
||||
private boolean checkRecipe() {
|
||||
if (!this.mMachine) {
|
||||
return false;
|
||||
}
|
||||
ItemStack[] inputs = new ItemStack[INPUT_SLOTS];
|
||||
System.arraycopy(mInventory, 0, inputs, 0, INPUT_SLOTS);
|
||||
GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, 0, null, inputs);
|
||||
if (recipe == null) {
|
||||
this.mOutputItems = null;
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < OUTPUT_SLOTS; i++) {
|
||||
if (!spaceForOutput(recipe.getOutput(i), i)) {
|
||||
this.mOutputItems = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public byte getTileEntityBaseType() {
|
||||
return 0;
|
||||
}
|
||||
if (!recipe.isRecipeInputEqual(true, null, inputs)) {
|
||||
this.mOutputItems = null;
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < INPUT_SLOTS; i++) {
|
||||
if (mInventory[i] != null && mInventory[i].stackSize == 0) {
|
||||
mInventory[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.mMaxProgresstime = recipe.mDuration;
|
||||
this.mOutputItems = recipe.mOutputs;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isGivingInformation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
||||
return aIndex > INPUT_SLOTS;
|
||||
}
|
||||
|
||||
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
||||
return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]);
|
||||
}
|
||||
|
||||
public byte getTileEntityBaseType() {
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue