aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-17 10:58:02 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-17 10:58:02 +1000
commit94389c154e4d517e4fcdebdacc3da9be414e8c75 (patch)
tree5c00c6c8689caf1dc4e0cba3f4363296279bb5b4 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities
parentd7897d548e0d377df56a33b4be4a60717d97dd97 (diff)
downloadGT5-Unofficial-94389c154e4d517e4fcdebdacc3da9be414e8c75.tar.gz
GT5-Unofficial-94389c154e4d517e4fcdebdacc3da9be414e8c75.tar.bz2
GT5-Unofficial-94389c154e4d517e4fcdebdacc3da9be414e8c75.zip
+ Added the Cutting Factory Multiblock.
+ Added a config for the Cutting Factory. % Hid Generator Array Logging.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java254
2 files changed, 264 insertions, 10 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
index e6c82e203b..3923f65f29 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
@@ -138,32 +138,32 @@ public class GregtechMetaTileEntityGeneratorArray extends GT_MetaTileEntity_Mult
if(!mMachine.equals(mInventory[1].getUnlocalizedName()))mLastRecipe=null;
mMachine = mInventory[1].getUnlocalizedName();
- Utils.LOG_INFO("mMachine: "+mMachine);
+ Utils.LOG_WARNING("mMachine: "+mMachine);
ArrayList<FluidStack> tFluids = getStoredFluids();
Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
- Utils.LOG_INFO("tRecipeList: "+tRecipeList);
+ Utils.LOG_WARNING("tRecipeList: "+tRecipeList);
if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel?
- Utils.LOG_INFO("1");
+ Utils.LOG_WARNING("1");
for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
- Utils.LOG_INFO("2");
+ Utils.LOG_WARNING("2");
for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
- Utils.LOG_INFO("3");
+ Utils.LOG_WARNING("3");
/*if (aFuel != null){
for (FluidStack x : aFuel.mFluidInputs){
if (x != null){
- Utils.LOG_INFO("Recipe: "+x.getLocalizedName());
+ Utils.LOG_WARNING("Recipe: "+x.getLocalizedName());
}
}
}*/
FluidStack tLiquid;
tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], aFuel.mFluidInputs[0].amount);
- Utils.LOG_INFO("5");
+ Utils.LOG_WARNING("5");
fuelConsumption = aFuel.mFluidInputs[0].amount;
if(depleteInput(tLiquid)) { //Deplete that amount
- Utils.LOG_INFO("6");
+ Utils.LOG_WARNING("6");
boostEu = true;
- Utils.LOG_INFO("7");
+ Utils.LOG_WARNING("7");
fuelValue = aFuel.mEUt*aFuel.mDuration;
fuelRemaining = hatchFluid1.amount; //Record available fuel
@@ -171,7 +171,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GT_MetaTileEntity_Mult
//this.mProgresstime = 1;
this.mMaxProgresstime = 20;
this.mEfficiencyIncrease = 9500;
- Utils.LOG_INFO("9");
+ Utils.LOG_WARNING("9");
return true;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java
new file mode 100644
index 0000000000..ad1b9cc635
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -0,0 +1,254 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialCuttingMachine
+extends GregtechMeta_MultiBlockBase {
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialCuttingMachine(this.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Industrial Cutting Factory",
+ "60% faster than using single block machines of the same voltage",
+ "Size: 3x3x5 [WxHxL] (Hollow)", "Controller (front centered)",
+ "2x Input Bus (side centered)",
+ "2x Output Bus (side centered)",
+ "1x Energy Hatch (top or bottom centered)",
+ "1x Input Hatch (top or bottom centered)",
+ "1x Maintenance Hatch (back centered)",
+ "Cutting Factory Frames for the rest (32 at least!)",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(29)], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(29)]};
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sCutterRecipes;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ for (final ItemStack tInput : tInputList) {
+ for (final FluidStack tFluid : tFluidList) {
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCutterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluid}, new ItemStack[]{tInput});
+ //tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F);
+ if (tRecipe != null) {
+
+ //More than or one input
+ if (tInputList.size() > 0) {
+
+ if (tRecipe.isRecipeInputEqual(true, new FluidStack[]{tFluid}, new ItemStack[]{tInput})) {
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+ if (tRecipe.mEUt <= 16) {
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ } else {
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ ItemStack[] mOutputStacks = new ItemStack[9];
+ for (int i=0;i<9;i++){
+ if (tRecipe.getOutput(i) != null){
+ mOutputStacks[i] = tRecipe.getOutput(i);
+ }
+ }
+ this.mOutputItems = mOutputStacks.clone();
+ //this.updateSlots();
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ final byte tSide = this.getBaseMetaTileEntity().getBackFacing();
+ if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) {
+ int tAirCount = 0;
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ for (byte k = -1; k < 2; k = (byte) (k + 1)) {
+ if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) {
+ tAirCount++;
+ }
+ }
+ }
+ }
+ if (tAirCount != 10) {
+ Utils.LOG_INFO("False 1");
+ return false;
+ }
+ for (byte i = 2; i < 6; i = (byte) (i + 1)) {
+ IGregTechTileEntity tTileEntity;
+ if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) &&
+ (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) &&
+ ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialCuttingMachine))) {
+ //Utils.LOG_INFO("False 1");
+ return false;
+ }
+ }
+ final int tX = this.getBaseMetaTileEntity().getXCoord();
+ final int tY = this.getBaseMetaTileEntity().getYCoord();
+ final int tZ = this.getBaseMetaTileEntity().getZCoord();
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ if ((i != 0) || (j != 0)) {
+ for (byte k = 0; k < 5; k = (byte) (k + 1)) {
+ if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) {
+ if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) {
+ Utils.LOG_INFO("False 2");
+ return false;
+ }
+ }
+ else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else {
+ Utils.LOG_INFO("False 3");
+ return false;
+ }
+ }
+ }
+ }
+ }
+ if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() < 0)) {
+ Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output.");
+ return false;
+ }
+ if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) {
+ Utils.LOG_INFO("Incorrect amount of Input & Output busses.");
+ return false;
+ }
+ this.mMaintenanceHatches.clear();
+ final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4);
+ if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
+ if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) {
+ this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity());
+ ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex();
+ } else {
+ Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back.");
+ return false;
+ }
+ }
+ if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) {
+ Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches.");
+ return false;
+ }
+ } else {
+ Utils.LOG_INFO("False 5");
+ return false;
+ }
+ Utils.LOG_INFO("True");
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 80;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 2;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 13;
+ }
+
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(29);
+ }
+
+ private boolean addToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+
+ private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+} \ No newline at end of file