aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-15 15:19:05 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-15 15:19:05 +0000
commit86bf45662a877c8ce9ca9551b41c789c098dc698 (patch)
tree9cb2c65a914312afbbe7887966d43d5feed95505 /src/Java/gtPlusPlus/xmod/gregtech/common
parent05efaa691d2ebe9fd4811444dbf6f0de1ca142b6 (diff)
downloadGT5-Unofficial-86bf45662a877c8ce9ca9551b41c789c098dc698.tar.gz
GT5-Unofficial-86bf45662a877c8ce9ca9551b41c789c098dc698.tar.bz2
GT5-Unofficial-86bf45662a877c8ce9ca9551b41c789c098dc698.zip
+ Added recipes for the control cores and the respective module for multiblocks.
+ Added recipes for the Circuit Programmer, Lead Lined Chest & the RTG. % Adjust Computer Cube recipe to now require an assembler. % Adjusted recipes using MAX tier machine components to use the correct parts in GTNH. % Greatly reduced EU capacity for the Computer Cube. $ Mostly finished work on the Generator Array. (Still requires some fine tuning but the general result is solid) $ Fixed a weird bug with hand-pumps, causing crashes due to an invalid offset for IIcons.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java405
2 files changed, 318 insertions, 89 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
index 120f1aab9e..b54eb770ec 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
@@ -233,7 +233,7 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
MathUtils.roundToClosestInt(432/2));
//Computer Cube
GregtechItemList.Gregtech_Computer_Cube.set(this.addItem(tLastID = 55, "Gregtech Computer Cube", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)}));
- this.setElectricStats(32000 + tLastID, Integer.MAX_VALUE, GT_Values.V[5], 5L, -3L, true);
+ this.setElectricStats(32000 + tLastID, GT_Values.V[6]* 10 * 60 * 20, GT_Values.V[5], 5L, -3L, true);
//FOOOOOOOOOOOOOOD
GregtechItemList.Food_Baked_Raisin_Bread.set(this.addItem(tLastID = 60, "Raisin Bread", "Extra Raisins, Just for ImQ009", new Object[]{new GT_FoodStat(5, 0.5F, EnumAction.eat, null, false, true, false, new int[0]), getTcAspectStack(TC_Aspects.CORPUS, 1L), getTcAspectStack(TC_Aspects.FAMES, 1L), getTcAspectStack(TC_Aspects.IGNIS, 1L)}));
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
index c643cdc1a0..8446737017 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
@@ -4,21 +4,28 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
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.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
+import gregtech.common.GT_Pollution;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -77,34 +84,43 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc
}
@Override
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- if (mInventory[1] == null) return null;
- String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicgenerator\\.", "");
- if (tmp.startsWith("steamturbine")) {
- return Gregtech_Recipe_Map.sSteamTurbineFuels;
- }
- else if (tmp.startsWith("diesel")) {
- return GT_Recipe.GT_Recipe_Map.sDieselFuels;
- }
- else if (tmp.startsWith("gasturbine")) {
- return GT_Recipe.GT_Recipe_Map.sTurbineFuels;
- }
- else if (tmp.startsWith("semifluid")) {
- return GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels;
- }
- else if (tmp.startsWith("rtg")) {
- return Gregtech_Recipe_Map.sRTGFuels;
- }
-
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
- tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.advancedgenerator\\.", "");
- if (tmp.startsWith("rocket")) {
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ this.mMode = getModeFromInventorySlot(this.getGUIItemStack());
+ if (this.mMode == MODE_NONE) {
+ return null;
+ }
+ else if (this.mMode == MODE_STEAM) {
+ return Recipe_GT.Gregtech_Recipe_Map.sSteamTurbineFuels;
+ }
+ else if (this.mMode == MODE_DIESEL) {
return GT_Recipe.GT_Recipe_Map.sDieselFuels;
- }
- else if (tmp.startsWith("geothermalFuel")) {
- return Gregtech_Recipe_Map.sGeoThermalFuels;
- }
-
+ }
+ else if (this.mMode == MODE_GAS) {
+ return GT_Recipe.GT_Recipe_Map.sTurbineFuels;
+ }
+ else if (this.mMode == MODE_SEMIFLUID) {
+ return Recipe_GT.Gregtech_Recipe_Map.sSemiFluidLiquidFuels;
+ }
+ else if (this.mMode == MODE_GEOTHERMAL) {
+ return Recipe_GT.Gregtech_Recipe_Map.sThermalFuels;
+ }
+ else if (this.mMode == MODE_ROCKETFUEL) {
+ return Recipe_GT.Gregtech_Recipe_Map.sRocketFuels;
+ }
+ else if (this.mMode == MODE_MAGIC_A) {
+ return GT_Recipe.GT_Recipe_Map.sMagicFuels;
+ }
+ else if (this.mMode == MODE_PLASMA) {
+ return GT_Recipe.GT_Recipe_Map.sPlasmaFuels;
+ }
+ else if (this.mMode == MODE_NAQUADAH) {
+ return GT_Recipe.GT_Recipe_Map.sFluidNaquadahReactorFuels;
+ }
return null;
}
@@ -122,84 +138,173 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc
}
public String mMachine = "";
+ protected int fuelConsumption = 0;
+ protected int fuelValue = 0;
+ protected int fuelRemaining = 0;
+ protected boolean boostEu = false;
+
+ int mMode = 0;
+
+ private final static int MODE_STEAM = 0;
+ private final static int MODE_DIESEL = 1;
+ private final static int MODE_GAS = 2;
+ private final static int MODE_SEMIFLUID = 3;
+ private final static int MODE_GEOTHERMAL = 4;
+ private final static int MODE_ROCKETFUEL = 5;
+ private final static int MODE_MAGIC_A = 6;
+ private final static int MODE_MAGIC_B_DISABLED = 7;
+ private final static int MODE_PLASMA = 8;
+ private final static int MODE_NAQUADAH = 9;
+ private final static int MODE_NONE = 100;
+
+ private final static int[] ID_STEAM = new int[] {962, 1120, 1121, 1122};
+ private final static int[] ID_GAS = new int[] {961, 1115, 1116, 1117};
+ private final static int[] ID_DIESEL = new int[] {960, 1110, 1111, 1112};
+ private final static int[] ID_SEMIFLUID = new int[] {837, 838, 839};
+ private final static int[] ID_GEOTHERMAL = new int[] {830, 831, 832};
+ private final static int[] ID_ROCKETFUEL = new int[] {793, 794, 795};
+ private final static int[] ID_MAGIC_A = new int[] {1123, 1124, 1125};
+ private final static int[] ID_MAGIC_B_DISABLED = new int[] {1127, 1128, 1129, 1130};
+ private final static int[] ID_PLASMA = new int[] {1196, 1197, 1198};
+ private final static int[] ID_NAQUADAH = new int[] {1190, 1191, 1192};
+
+ private static final int getModeFromInventorySlot(ItemStack aStack) {
+
+ if (aStack == null) {
+ return MODE_NONE;
+ }
+
+ String aItemStackName = aStack == null ? "" : aStack.getUnlocalizedName();
+ //Logger.INFO("Item Name: "+aItemStackName+" ("+aStack.getItemDamage()+")");
+ if (aItemStackName.toLowerCase().contains("gt.blockmachines")) {
+ for (int g : ID_STEAM) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_STEAM;
+ }
+ }
+ for (int g : ID_GAS) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_GAS;
+ }
+ }
+ for (int g : ID_DIESEL) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_DIESEL;
+ }
+ }
+ for (int g : ID_SEMIFLUID) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_SEMIFLUID;
+ }
+ }
+ for (int g : ID_GEOTHERMAL) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_GEOTHERMAL;
+ }
+ }
+ for (int g : ID_ROCKETFUEL) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_ROCKETFUEL;
+ }
+ }
+ for (int g : ID_MAGIC_A) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_MAGIC_A;
+ }
+ }
+ for (int g : ID_PLASMA) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_PLASMA;
+ }
+ }
+ for (int g : ID_NAQUADAH) {
+ if (aStack.getItemDamage() == g) {
+ return MODE_NAQUADAH;
+ }
+ }
+ }
+ return MODE_NONE;
+ }
+
@Override
public boolean checkRecipe(ItemStack aStack) {
- if (!isCorrectMachinePart(mInventory[1])) {
+
+ this.resetRecipeMapForAllInputHatches();
+ this.mMode = getModeFromInventorySlot(aStack);
+ if (mMode == MODE_NONE) {
+ Logger.INFO("Did not find valid generator.");
return false;
}
- GT_Recipe.GT_Recipe_Map map = getRecipeMap();
- if (map == null) return false;
- ArrayList<ItemStack> tInputList = getStoredInputs();
- int tTier = 0;
- if (mInventory[1].getUnlocalizedName().endsWith("1")) {
- tTier = 1;
- }else if (mInventory[1].getUnlocalizedName().endsWith("2")) {
- tTier = 2;
- }else if (mInventory[1].getUnlocalizedName().endsWith("3")) {
- tTier = 3;
- }else if (mInventory[1].getUnlocalizedName().endsWith("4")) {
- tTier = 4;
- }else if (mInventory[1].getUnlocalizedName().endsWith("5")) {
- tTier = 5;
- }else if (mInventory[1].getUnlocalizedName().endsWith("6")) {
- tTier = 6;
- }else if (mInventory[1].getUnlocalizedName().endsWith("7")) {
- tTier = 7;
- }else if (mInventory[1].getUnlocalizedName().endsWith("8")) {
- tTier = 8;
+ else {
+ Logger.INFO("Changed Mode to "+mMode);
}
-
- int fuelConsumption = 0;
- int fuelValue = 0;
- int fuelRemaining = 0;
- boolean boostEu = false;
-
- if(!mMachine.equals(mInventory[1].getUnlocalizedName()))mLastRecipe=null;
- mMachine = mInventory[1].getUnlocalizedName();
- Logger.WARNING("mMachine: "+mMachine);
- ArrayList<FluidStack> tFluids = getStoredFluids();
+ int aMulti = this.getGUIItemStack() != null ? this.getGUIItemStack().stackSize : 0;
+ if (aMulti > 16 || aMulti == 0) {
+ return false;
+ }
+
+
+
+ ArrayList<FluidStack> tFluids = this.getStoredFluids();
+
Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
- Logger.WARNING("tRecipeList: "+tRecipeList);
-
- if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel?
- Logger.WARNING("1");
- for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
- Logger.WARNING("2");
- for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
- Logger.WARNING("3");
- /*if (aFuel != null){
- for (FluidStack x : aFuel.mFluidInputs){
- if (x != null){
- Utils.LOG_WARNING("Recipe: "+x.getLocalizedName());
+ Logger.INFO("Got Recipe Map");
+ if (tFluids.size() > 0 && tRecipeList != null) {
+ Logger.INFO("Found Fuels for Map.");
+ Iterator<FluidStack> arg3 = tFluids.iterator();
+ int aCount = 0;
+ while (arg3.hasNext()) {
+ FluidStack hatchFluid1 = (FluidStack) arg3.next();
+ Logger.INFO("Iterating Fluid Found "+(aCount++)+" | "+hatchFluid1.getLocalizedName());
+ Iterator<GT_Recipe> arg5 = tRecipeList.iterator();
+
+ int Hatch = 0;
+ int totalFuelValue = 0;
+ while (arg5.hasNext()) {
+ Logger.INFO("Iterating Recipe "+(Hatch++));
+ GT_Recipe aFuel = (GT_Recipe) arg5.next();
+ FluidStack tLiquid;
+ boolean addedFuelOnce = false;
+ for (int a = 0; a < aMulti; a++) {
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null
+ && hatchFluid1.isFluidEqual(tLiquid)) {
+ this.fuelConsumption = tLiquid.amount = this.boostEu
+ ? 4096 / aFuel.mSpecialValue
+ : 2048 / aFuel.mSpecialValue;
+ if (this.depleteInput(tLiquid)) {
+ Logger.INFO("Depleted Fuel");
+ this.boostEu = this.depleteInput(Materials.Oxygen.getGas(2L));
+ /*if (!tFluids.contains(Materials.Lubricant.getFluid(1L))) {
+ Logger.INFO("No Lube.");
+ return false;
+ }*/
+ if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
+ this.depleteInput(Materials.Lubricant.getFluid(this.boostEu ? 2L : 1L));
+ }
+ Logger.INFO("ADDING POWER");
+ this.fuelRemaining = hatchFluid1.amount;
+ totalFuelValue++;
}
}
- }*/
- FluidStack tLiquid;
- tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], aFuel.mFluidInputs[0].amount);
- Logger.WARNING("5");
- fuelConsumption = aFuel.mFluidInputs[0].amount;
- if(depleteInput(tLiquid)) { //Deplete that amount
- Logger.WARNING("6");
- boostEu = true;
- Logger.WARNING("7");
-
- fuelValue = aFuel.mEUt*aFuel.mDuration;
- fuelRemaining = hatchFluid1.amount; //Record available fuel
- this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20%
- //this.mProgresstime = 1;
- this.mMaxProgresstime = 20;
- this.mEfficiencyIncrease = 9500;
- Logger.WARNING("9");
+ }
+ //Do things after consuming Fuel
+ if (totalFuelValue == aMulti) {
+ this.fuelValue = aFuel.mSpecialValue*aMulti;
+ this.mEUt = this.mEfficiency < 2000 ? 0 : aFuel.mSpecialValue*aMulti;
+ this.mProgresstime = aMulti;
+ this.mMaxProgresstime = aMulti;
+ this.mEfficiencyIncrease = 15*aMulti;
return true;
}
}
- // }
- //}
}
}
+
this.mEUt = 0;
this.mEfficiency = 0;
return false;
+
+
}
public static ItemStack[] clean(final ItemStack[] v) {
@@ -274,4 +379,128 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc
public int getEuDiscountForParallelism() {
return 0;
}
+
+
+
+
+
+
+ /**
+ * Code from single blocks
+ */
+
+
+ public void tryProcessFuelItems(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a) {
+ if (a != null
+ && aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() * 20L + this.getMinimumStoredEU()
+ && GT_Utility.getFluidForFilledItem(a, true) == null) {
+ int tFuelValue;
+ tFuelValue = this.getFuelValue(a);
+ if (tFuelValue > 0) {
+ ItemStack tEmptyContainer1 = this.getEmptyContainer(a);
+ if (this.addOutput(tEmptyContainer1)) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true);
+ this.depleteInput(a);
+ GT_Pollution.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null));
+ }
+ }
+ }
+ }
+
+ public void tryProcessFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick, FluidStack mFluid) {
+ if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) {
+ int tFuelValue;
+ if (mFluid != null) {
+ tFuelValue = this.getFuelValue(mFluid);
+ int tEmptyContainer = this.consumedFluidPerOperation(mFluid);
+ if (tFuelValue > 0 && tEmptyContainer > 0 && mFluid.amount > tEmptyContainer) {
+ long tFluidAmountToUse = Math.min((long) (mFluid.amount / tEmptyContainer),
+ (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue);
+ if (tFluidAmountToUse > 0L && aBaseMetaTileEntity
+ .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) {
+ GT_Pollution.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null));
+ mFluid.amount = (int) ((long) mFluid.amount
+ - tFluidAmountToUse * (long) tEmptyContainer);
+ }
+ }
+ }
+
+ //Check items
+ }
+
+ if (aBaseMetaTileEntity.isServerSide()) {
+ aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity
+ .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU());
+ }
+
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return this.getFuelValue(aFluid) > 0;
+ }
+
+
+ public int consumedFluidPerOperation(FluidStack aLiquid) {
+ return 1;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid != null && this.getRecipeMap() != null) {
+ Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
+ if (tRecipeList != null) {
+ Iterator<GT_Recipe> arg3 = tRecipeList.iterator();
+
+ while (arg3.hasNext()) {
+ GT_Recipe tFuel = (GT_Recipe) arg3.next();
+ FluidStack tLiquid;
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null
+ && aLiquid.isFluidEqual(tLiquid)) {
+ return (int) ((long) tFuel.mSpecialValue * (long) this.mEfficiency
+ * (long) this.consumedFluidPerOperation(tLiquid) / 100L);
+ }
+ }
+ }
+
+ return 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public int getFuelValue(ItemStack aStack) {
+ if (!GT_Utility.isStackInvalid(aStack) && this.getRecipeMap() != null) {
+ GT_Recipe tFuel = this.getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
+ (FluidStack[]) null, new ItemStack[]{aStack});
+ return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.mEfficiency / 100L) : 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public ItemStack getEmptyContainer(ItemStack aStack) {
+ if (!GT_Utility.isStackInvalid(aStack) && this.getRecipeMap() != null) {
+ GT_Recipe tFuel = this.getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
+ (FluidStack[]) null, new ItemStack[]{aStack});
+ return tFuel != null
+ ? GT_Utility.copy(new Object[]{tFuel.getOutput(0)})
+ : GT_Utility.getContainerItem(aStack, true);
+ } else {
+ return null;
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}