aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java669
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java33
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java376
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java99
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java7
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java319
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java27
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java19
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java269
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java18
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java19
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java64
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java566
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java69
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java25
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java26
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java163
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java99
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java1045
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java9
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java100
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java27
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java1050
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java13
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java170
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java262
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java79
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java82
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java1043
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java70
52 files changed, 4676 insertions, 2248 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java
new file mode 100644
index 0000000000..01d5ef88c8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java
@@ -0,0 +1,669 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_Container_CropHarvestor;
+import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_GUIContainer_CropHarvestor;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import ic2.api.crops.CropCard;
+import ic2.api.crops.ICropTile;
+import ic2.core.item.DamageHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank {
+
+ protected String mLocalName;
+
+ private static final int SLOT_WEEDEX_1 = 1;
+ private static final int SLOT_WEEDEX_2 = 2;
+ private static final int SLOT_FERT_1 = 3;
+ private static final int SLOT_FERT_4 = 6;
+ private static final int SLOT_OUTPUT_START = 7;
+
+ public boolean mModeAlternative = false;
+
+ public GT_MetaTileEntity_CropHarvestor(final int aID, final int aTier, final String aDescription) {
+ super(aID, "basicmachine.cropharvester.0"+aTier, "Crop Manager ("+GT_Values.VN[aTier]+")", aTier, 21, aDescription);
+ mLocalName = "Crop Manager ("+GT_Values.VN[aTier]+")";
+ }
+
+ public GT_MetaTileEntity_CropHarvestor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, 21, aDescription, aTextures);
+ mLocalName = "Crop Manager ("+GT_Values.VN[aTier]+")";
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_CropHarvestor(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_CropHarvestor(aPlayerInventory, aBaseMetaTileEntity, mLocalName);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 8;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return GT_Values.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier]);
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[mTier];
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000 * mTier;
+ }
+
+ @Override
+ public int getTankPressure() {
+ return -100;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_CropHarvestor(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 21;
+ }
+
+ private static final int getRange(int aTier) {
+ switch(aTier) {
+ case 1:
+ return 1;
+ case 2:
+ return 5;
+ case 3:
+ return 9;
+ case 4:
+ return 13;
+ case 5:
+ return 17;
+ case 6:
+ return 21;
+ case 7:
+ return 25;
+ case 8:
+ return 29;
+ case 9:
+ return 33;
+ default:
+ return 0;
+ }
+ }
+
+ private HashSet<ICropTile> mCropCache = new HashSet<ICropTile>();
+ private boolean mInvalidCache = false;
+
+ public boolean doesInventoryHaveSpace() {
+ for (int i = SLOT_OUTPUT_START; i < this.getSizeInventory(); i++) {
+ if (this.mInventory[i] == null || this.mInventory[i].stackSize < 64) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public long powerUsage() {
+ return this.maxEUInput() / 8;
+ }
+
+ public long powerUsageSecondary() {
+ return this.maxEUInput() / 32;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork() && (getBaseMetaTileEntity().hasWorkJustBeenEnabled() || aTick % 100 == 0)) {
+ if (this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU()) {
+
+ int aTileX = this.getBaseMetaTileEntity().getXCoord();
+ int aTileY = this.getBaseMetaTileEntity().getXCoord();
+ int aTileZ = this.getBaseMetaTileEntity().getXCoord();
+
+ int aRadius = 10 + getRange(mTier);
+ int aSide = (aRadius-1)/2;
+ ArrayList<ItemStack> aAllDrops = new ArrayList<ItemStack>();
+
+ if (mCropCache.isEmpty() || aTick % 1200 == 0 || mInvalidCache) {
+ if (!mCropCache.isEmpty()) {
+ mCropCache.clear();
+ }
+ //Logger.INFO("Looking for crops.");
+ for (int y = 0; y <= 2; y++) {
+ for (int x = (-aSide); x <= aSide; x++) {
+ for (int z = (-aSide); z <= aSide; z++) {
+ TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(x, y, z);
+ if (tTileEntity != null && tTileEntity instanceof ICropTile) {
+ ICropTile tCrop = (ICropTile) tTileEntity;
+ mCropCache.add(tCrop);
+ }
+ }
+ }
+ }
+ }
+
+ //Process Cache
+ if (doesInventoryHaveSpace()) {
+ for (ICropTile tCrop : mCropCache) {
+ if (tCrop == null) {
+ mInvalidCache = true;
+ break;
+ }
+ CropCard aCrop = tCrop.getCrop();
+ if (aCrop != null) {
+ //Logger.INFO("Found "+aCrop.displayName()+" at offset "+x+", "+y+", "+z);
+ if (!aCrop.canGrow(tCrop) && aCrop.canBeHarvested(tCrop)) {
+ if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsage(), true)) {
+ ItemStack[] aHarvest = tCrop.harvest_automated(true);
+ if (aHarvest != null && aHarvest.length > 0) {
+ for (ItemStack aStack : aHarvest) {
+ if (aStack.stackSize > 0) {
+ if (mTier * 5 > MathUtils.randInt(1, 100)) {
+ aStack.stackSize += Math.floor(tCrop.getGain()/10);
+ Logger.INFO("Bonus output given for "+aCrop.displayName());
+ }
+ Logger.INFO("Harvested "+aCrop.displayName());
+ aAllDrops.add(aStack);
+ }
+ }
+ }
+ }
+ }
+ if (this.mModeAlternative) {
+ processSecondaryFunctions(tCrop);
+ }
+ }
+ }
+
+ if (!aAllDrops.isEmpty()) {
+ Logger.INFO("Handling "+aAllDrops.size()+" Harvests");
+ Iterator<ItemStack> iter = aAllDrops.iterator();
+ while (iter.hasNext()) {
+ ItemStack aDrop = iter.next();
+ if (ItemUtils.checkForInvalidItems(aDrop)) {
+
+ for (int i = SLOT_OUTPUT_START; i < this.getSizeInventory(); i++) {
+ if (this.mInventory[i] != null) {
+ //Logger.INFO("Slot "+i+" contains "+this.mInventory[i].getDisplayName());
+ if (GT_Utility.areStacksEqual(aDrop, mInventory[i], false)) {
+ //Same
+ if (mInventory[i].stackSize < 64 && (mInventory[i].stackSize + aDrop.stackSize <= 64)) {
+ //can merge
+ //Logger.INFO("Slot "+i+" size: "+mInventory[i].stackSize+" + Drop Size: "+aDrop.stackSize+" = "+(mInventory[i].stackSize + aDrop.stackSize));
+ mInventory[i].stackSize += aDrop.stackSize;
+ break;
+ }
+ else if (mInventory[i].stackSize < 64 && (mInventory[i].stackSize + aDrop.stackSize > 64)) {
+ //can merge
+ //Logger.INFO("Slot "+i+" size: "+mInventory[i].stackSize+" + Drop Size: "+aDrop.stackSize+" = "+(mInventory[i].stackSize + aDrop.stackSize));
+ int aRemainder = mInventory[i].stackSize + aDrop.stackSize - 64;
+ Logger.INFO("Remainder: "+aRemainder+", Continuing.");
+ mInventory[i].stackSize = 64;
+ aDrop.stackSize = aRemainder;
+ continue;
+ }
+ else {
+ //Logger.INFO("Slot "+i+" size: 64, Continuing.");
+ continue;
+ }
+ }
+ }
+ else {
+ //Logger.INFO("Slot "+i+" is empty, setting to "+aDrop.getDisplayName()+" x"+aDrop.stackSize);
+ this.mInventory[i] = aDrop;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public boolean hasFertilizer() {
+ for (int i = SLOT_FERT_1; i <= SLOT_FERT_4; i++) {
+ if (this.mInventory[i] != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean consumeFertilizer(boolean aSimulate) {
+ if (hasFertilizer()) {
+ for (int i = SLOT_FERT_1; i <= SLOT_FERT_4; i++) {
+ if (this.mInventory[i] != null) {
+ consume(i, 1, aSimulate);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean hasWeedEX() {
+ for (int i = SLOT_WEEDEX_1; i <= SLOT_WEEDEX_2; i++) {
+ if (this.mInventory[i] != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean consumeWeedEX(boolean aSimulate) {
+ if (hasWeedEX()) {
+ for (int i = SLOT_WEEDEX_1; i <= SLOT_WEEDEX_2; i++) {
+ if (this.mInventory[i] != null) {
+ damage(i, 1, aSimulate);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void processSecondaryFunctions(ICropTile aCrop) {
+ if (!mModeAlternative) {
+ return;
+ }
+ if (hasFertilizer() && consumeFertilizer(true) && this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU() && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) && applyFertilizer(aCrop)) {
+ if (consumeFertilizer(false)) {
+ //Logger.INFO("Consumed Fert.");
+ }
+ }
+ if (this.getFluidAmount() > 0 && this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU() && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) && applyHydration(aCrop)) {
+ //Logger.INFO("Consumed Water.");
+ }
+ if (hasWeedEX() && consumeWeedEX(true) && this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU() && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) && applyWeedEx(aCrop)) {
+ if (consumeWeedEX(false)) {
+ //Logger.INFO("Consumed Weed-EX.");
+ }
+ }
+ }
+
+
+ public boolean applyWeedEx(ICropTile aCrop) {
+ if (aCrop.getWeedExStorage() < 150) {
+ aCrop.setWeedExStorage(aCrop.getWeedExStorage() + 50);
+ boolean triggerDecline;
+ triggerDecline = aCrop.getWorld().rand.nextInt(3) == 0;
+ if (aCrop.getCrop() != null && aCrop.getCrop().isWeed(aCrop) && aCrop.getWeedExStorage() >= 75 && triggerDecline) {
+ switch (aCrop.getWorld().rand.nextInt(5)) {
+ case 0 :
+ if (aCrop.getGrowth() > 0) {
+ aCrop.setGrowth((byte) (aCrop.getGrowth() - 1));
+ }
+ case 1 :
+ if (aCrop.getGain() > 0) {
+ aCrop.setGain((byte) (aCrop.getGain() - 1));
+ }
+ default :
+ if (aCrop.getResistance() > 0) {
+ aCrop.setResistance((byte) (aCrop.getResistance() - 1));
+ }
+ }
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean applyFertilizer(ICropTile aCrop) {
+ if (aCrop.getNutrientStorage() >= 100) {
+ return false;
+ } else {
+ //Logger.INFO("Current Nutrient: "+aCrop.getNutrientStorage()+" for "+aCrop.getCrop().displayName());
+ aCrop.setNutrientStorage(100);
+ return true;
+ }
+ }
+
+ public boolean applyHydration(ICropTile aCrop) {
+ if (aCrop.getHydrationStorage() >= 200 || this.getFluidAmount() == 0) {
+ //Logger.INFO("Hydration Max");
+ return false;
+ } else {
+ int apply = 200 - aCrop.getHydrationStorage();
+ if (this.getFluidAmount() >= 0) {
+ int drain = 0;
+ if (this.getFluidAmount() >= apply) {
+ drain = apply;
+ }
+ else {
+ drain = this.getFluidAmount();
+ }
+ this.mFluid.amount -= drain;
+ if (this.mFluid.amount <= 0) {
+ this.mFluid = null;
+ }
+ //Logger.INFO("Did Hydrate");
+ aCrop.setHydrationStorage(aCrop.getHydrationStorage() + drain);
+ return true;
+ }
+ else {
+ //Logger.INFO("No water?");
+ return false;
+ }
+ }
+ }
+
+ public boolean consume(int aSlot, int amount, boolean simulate) {
+ ItemStack stack = this.mInventory[aSlot];
+ if (stack != null && stack.stackSize >= amount) {
+ int currentAmount = Math.min(amount, stack.stackSize);
+ amount -= currentAmount;
+ if (!simulate) {
+ if (stack.stackSize == currentAmount) {
+ this.mInventory[aSlot] = null;
+ } else {
+ stack.stackSize -= currentAmount;
+ }
+ }
+ else {
+ return amount >= 0;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public ItemStack damage(int aSlot, int amount, boolean simulate) {
+ ItemStack ret = null;
+ int damageApplied = 0;
+ ItemStack stack = this.mInventory[aSlot];
+ Item item = stack.getItem();
+ if (stack != null && item.isDamageable() && (ret == null
+ || stack.getItem() == ret.getItem() && ItemStack.areItemStackTagsEqual(stack, ret))) {
+ if (simulate) {
+ stack = stack.copy();
+ }
+ int maxDamage = DamageHandler.getMaxDamage(stack);
+ while (amount > 0 && stack.stackSize > 0) {
+ int currentAmount = Math.min(amount, maxDamage - DamageHandler.getDamage(stack));
+ DamageHandler.damage(stack, currentAmount, null);
+ damageApplied += currentAmount;
+ amount -= currentAmount;
+ if (DamageHandler.getDamage(stack) >= maxDamage) {
+ --stack.stackSize;
+ DamageHandler.setDamage(stack, 0);
+ }
+
+ if (ret == null) {
+ ret = stack.copy();
+ }
+ }
+ if (stack.stackSize == 0 && !simulate) {
+ this.mInventory[aSlot] = null;
+ }
+ }
+
+ if (ret != null) {
+ int i = DamageHandler.getMaxDamage(ret);
+ ret.stackSize = damageApplied / i;
+ DamageHandler.setDamage(ret, damageApplied % i);
+ }
+ return ret;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aStack != null && aIndex >= SLOT_OUTPUT_START && aIndex < this.getSizeInventory();
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (aStack != null) {
+ if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) {
+ return aIndex >= SLOT_FERT_1 && aIndex <= SLOT_FERT_4;
+ }
+ else if (aStack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) {
+ return aIndex >= SLOT_WEEDEX_1 && aIndex <= SLOT_WEEDEX_2;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String[] getDescription() {
+ int aRadius = 10 + getRange(mTier);
+ int aSide = (aRadius-1)/2;
+ return new String[] {
+ this.mDescription,
+ "Secondary mode can Hydrate/Fertilize/Weed-EX",
+ "Consumes "+powerUsage()+"eu per harvest",
+ "Consumes "+powerUsageSecondary()+"eu per secondary operation",
+ "Can harvest 2 blocks above",
+ "Radius: "+aSide+" each side ("+aRadius+"x3x"+aRadius+")",
+ "Has "+(mTier * 5)+"% chance for extra drops",
+ "Holds "+this.getCapacity()+"L of Water",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return true;
+ }
+
+ /*@Override
+ public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing)
+ return 118+(aRedstone?8:0);
+ if (GT_Utility.getOppositeSide(aSide) == aFacing)
+ return 113+(aRedstone?8:0);
+
+ int tIndex = 128+(aRedstone?8:0);
+
+ switch (aFacing) {
+ case 0:
+ return tIndex+64;
+ case 1:
+ return tIndex+32;
+ case 2: switch (aSide) {
+ case 0: return tIndex+32;
+ case 1: return tIndex+32;
+ case 4: return tIndex+16;
+ case 5: return tIndex+48;
+ }
+ case 3: switch (aSide) {
+ case 0: return tIndex+64;
+ case 1: return tIndex+64;
+ case 4: return tIndex+48;
+ case 5: return tIndex+16;
+ }
+ case 4: switch (aSide) {
+ case 0: return tIndex+16;
+ case 1: return tIndex+16;
+ case 2: return tIndex+48;
+ case 3: return tIndex+16;
+ }
+ case 5: switch (aSide) {
+ case 0: return tIndex+48;
+ case 1: return tIndex+48;
+ case 2: return tIndex+16;
+ case 3: return tIndex+48;
+ }
+ }
+ return tIndex;
+ } */
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getBack(i);
+ rTextures[7][i + 1] = this.getBottom(i);
+ rTextures[8][i + 1] = this.getTop(i);
+ rTextures[9][i + 1] = this.getSides(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == 0 || aSide == 1) {
+ return this.mTextures[3][aColorIndex + 1];
+ }
+ else {
+ return this.mTextures[4][aColorIndex + 1];
+ }
+ /*return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];*/
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter)};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Boxes)};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Boxes)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter)};
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mModeAlternative", mModeAlternative);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mModeAlternative = aNBT.getBoolean("mModeAlternative");
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
index c5e33c088d..92cbddfdba 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -66,11 +66,11 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
return this.mCurrentDimension;
}
- public Map<UUID, EntityPlayer> getLocalMap(){
+ public Map<String, UUID> getLocalMap(){
return this.mLocalChargingMap;
}
- public Map<EntityPlayer, UUID> getLongRangeMap(){
+ public Map<String, UUID> getLongRangeMap(){
return this.mWirelessChargingMap;
}
@@ -372,9 +372,8 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
super.onFirstTick(aBaseMetaTileEntity);
}
-
- private Map<EntityPlayer, UUID> mWirelessChargingMap = new HashMap<EntityPlayer, UUID>();
- private Map<UUID, EntityPlayer> mLocalChargingMap = new HashMap<UUID, EntityPlayer>();
+ private Map<String, UUID> mWirelessChargingMap = new HashMap<String, UUID>();
+ private Map<String, UUID> mLocalChargingMap = new HashMap<String, UUID>();
private boolean isValidPlayer(EntityPlayer aPlayer) {
BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity();
@@ -412,7 +411,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
if (isValidPlayer(mTemp) && !mLocalChargingMap.containsKey(mTemp.getPersistentID())){
- mLocalChargingMap.put(mTemp.getPersistentID(), mTemp);
+ mLocalChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
//PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Local].");
}
@@ -430,8 +429,8 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) <= tempRange){
if (!mWirelessChargingMap.containsKey(mTemp)){
- if (mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())) {
- mWirelessChargingMap.put(mTemp, mTemp.getPersistentID());
+ if (isValidPlayer(mTemp)) {
+ mWirelessChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Long-Range].");
}
@@ -538,15 +537,29 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
}
if (this.mMode == 2){
- PlayerUtils.messagePlayer(aPlayer, "Mixed Mode | Local: "+this.mTier*10+"m | Long: "+tempRange+"m");
+ PlayerUtils.messagePlayer(aPlayer, "Mixed Mode | Local: "+this.mTier*10+"m | Long: "+tempRange+"m");
+ PlayerUtils.messagePlayer(aPlayer, "Players with access:");
+ for (String name : this.getLocalMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, "Local: "+name);
+ }
+ for (String name : this.getLongRangeMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, "Long: "+name);
+ }
}
else if (this.mMode == 1){
PlayerUtils.messagePlayer(aPlayer, "Local Mode: "+this.mTier*20+"m");
+ PlayerUtils.messagePlayer(aPlayer, "Players with access:");
+ for (String name : this.getLocalMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, ""+name);
+ }
}
else {
PlayerUtils.messagePlayer(aPlayer, "Long-range Mode: "+tempRange+"m");
-
+ PlayerUtils.messagePlayer(aPlayer, "Players with access:");
+ for (String name : this.getLongRangeMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, ""+name);
+ }
}
return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
index b8f24d6c5e..7e7ecfa390 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
@@ -1,16 +1,36 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.*;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.OrePrefixes;
+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.interfaces.tileentity.IHasWorldObjectAndCoords;
-import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
@@ -19,19 +39,23 @@ import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.ItemStackData;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
-public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
+public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_AmazonPackager> {
private long mVoltage;
private byte mTier;
private int mCasing;
+
+ private ItemStack mSchematicCache;;
+ private ItemStack mInputCache;
+ private ItemStack mOutputCache;
+ private GT_Recipe mCachedRecipe;
+
private IStructureDefinition<GMTE_AmazonPackager> STRUCTURE_DEFINITION = null;
@Override
@@ -67,24 +91,24 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GMTE_AmazonPackager>builder()
.addShape(mName, transpose(new String[][]{
- {"CCC", "CCC", "CCC"},
- {"C~C", "C-C", "CCC"},
- {"CCC", "CCC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
}))
.addElement(
'C',
ofChain(
ofHatchAdder(
GMTE_AmazonPackager::addAmazonPackagerList, TAE.getIndexFromPage(2, 9), 1
- ),
+ ),
onElementPass(
x -> ++x.mCasing,
ofBlock(
ModBlocks.blockCasings3Misc, 9
+ )
)
)
)
- )
.build();
}
return STRUCTURE_DEFINITION;
@@ -116,25 +140,25 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
protected GT_Multiblock_Tooltip_Builder createTooltip() {
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Controller Block for the Amazon Warehouse")
- .addInfo("This Multiblock is used for EXTREME packaging requirements")
- .addInfo("Dust Schematics are inserted into the input busses")
- .addInfo("If inserted into the controller, it is shared across all busses")
- .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot")
- .addInfo("Uncomparably fast compared to a single packager of the same tier")
- .addInfo("Only uses 75% of the eu/t normally required")
- .addInfo("Processes five items per voltage tier")
- .addPollutionAmount(getPollutionPerSecond(null))
- .addSeparator()
- .beginStructureBlock(3, 3, 3, true)
- .addController("Front center")
- .addCasingInfo("Supply Depot Casings", 10)
- .addInputBus("Any casing", 1)
- .addOutputBus("Any casing", 1)
- .addEnergyHatch("Any casing", 1)
- .addMaintenanceHatch("Any casing", 1)
- .addMufflerHatch("Any casing", 1)
- .toolTipFinisher("GT++");
+ .addInfo("Controller Block for the Amazon Warehouse")
+ .addInfo("This Multiblock is used for EXTREME packaging requirements")
+ .addInfo("Dust Schematics are inserted into the input busses")
+ .addInfo("If inserted into the controller, it is shared across all busses")
+ .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot")
+ .addInfo("Uncomparably fast compared to a single packager of the same tier")
+ .addInfo("Only uses 75% of the eu/t normally required")
+ .addInfo("Processes 16 items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Supply Depot Casings", 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .toolTipFinisher("GT++");
return tt;
}
@@ -146,9 +170,9 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
@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.getCasingTextureForId(TAE.getIndexFromPage(2, 1)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 9)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
}
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 1))};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 9))};
}
@@ -164,20 +188,20 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
}
}
+ private static final FluidStack[] sNoFluids = new FluidStack[] {};
+
@Override
public boolean checkRecipe(ItemStack aStack) {
-
+
//Just the best place to check this~
initFields();
-
+
ArrayList<ItemStack> tItems = getStoredInputs();
if (this.getGUIItemStack() != null) {
tItems.add(this.getGUIItemStack());
}
- ArrayList<FluidStack> tFluids = getStoredFluids();
ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
- FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
- boolean state = checkRecipeGeneric(tItemInputs, tFluidInputs, 5 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000);
+ boolean state = checkRecipeGeneric(tItemInputs, sNoFluids, 16 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000);
if (state) {
@@ -204,7 +228,7 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
}
}
}
-
+
return mCompleted != null && mCompleted.size() > 0;
}
}
@@ -262,6 +286,282 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
return false;
}
+ private ItemStack getSchematic(ItemStack[] aInputs) {
+ for (ItemStack aStack : aInputs) {
+ if (ItemList.Schematic_Dust.isStackEqual(aStack) || ItemList.Schematic_1by1.isStackEqual(aStack) || ItemList.Schematic_2by2.isStackEqual(aStack) || ItemList.Schematic_3by3.isStackEqual(aStack)) {
+ return aStack;
+ }
+ }
+ return null;
+ }
+
+ private ItemStack getRecipeInput(ItemStack[] aInputs) {
+ for (ItemStack aStack : aInputs) {
+ if (!ItemList.Schematic_Dust.isStackEqual(aStack) && !ItemList.Schematic_1by1.isStackEqual(aStack) && !ItemList.Schematic_2by2.isStackEqual(aStack) && !ItemList.Schematic_3by3.isStackEqual(aStack)) {
+ return aStack;
+ }
+ }
+ return null;
+ }
+
+ private boolean hasValidCache(ItemStack aStack, ItemStack aSchematic, boolean aClearOnFailure) {
+ if (mSchematicCache != null && mInputCache != null && mOutputCache != null && mCachedRecipe != null) {
+ if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSchematic, mSchematicCache)) {
+ return true;
+ }
+ }
+ // clear cache if it was invalid
+ if (aClearOnFailure) {
+ mSchematicCache = null;
+ mInputCache = null;
+ mOutputCache = null;
+ mCachedRecipe = null;
+ }
+ return false;
+ }
+
+ private void cacheItem(ItemStack aSchematic, ItemStack aInputItem, ItemStack aOutputItem, GT_Recipe aRecipe) {
+ mSchematicCache = aSchematic.copy();
+ mInputCache = aInputItem.copy();
+ mOutputCache = aOutputItem.copy();
+ mCachedRecipe = aRecipe;
+ }
+
+ private GT_Recipe generatePackageRecipe(ItemStack aSchematic, ItemStack aInput) {
+ boolean tIsCached = hasValidCache(aInput, aSchematic, true);
+ if (tIsCached) {
+ ItemStack tOutput = mOutputCache.copy();
+ if (tOutput != null) {
+ if (mCachedRecipe != null && GT_Utility.areStacksEqual(aInput, mInputCache) && GT_Utility.areStacksEqual(tOutput, mOutputCache)) {
+ int aRequiredInputSize = 0;
+ if (ItemList.Schematic_Dust.isStackEqual(aSchematic)) {
+ if (OrePrefixes.dustTiny.contains(aInput)) {
+ aRequiredInputSize = 9;
+ }
+ if (OrePrefixes.dustSmall.contains(aInput)) {
+ aRequiredInputSize = 4;
+ }
+ if (OrePrefixes.dust.contains(aInput)) {
+ aRequiredInputSize = 1;
+ }
+ }
+ if (ItemList.Schematic_1by1.isStackEqual(aSchematic)) {
+ aRequiredInputSize = 1;
+ }
+ if (ItemList.Schematic_2by2.isStackEqual(aSchematic)) {
+ aRequiredInputSize = 4;
+ }
+ if (ItemList.Schematic_3by3.isStackEqual(aSchematic)) {
+ aRequiredInputSize = 9;
+ }
+ if (aInput.stackSize >= aRequiredInputSize) {
+ log("Using Cached Recipe. Require: "+aRequiredInputSize+", Found: "+aInput.stackSize);
+ return mCachedRecipe;
+ }
+ else {
+ log("Not enough input");
+ }
+ }
+ }
+ }
+ // We can package this
+ GT_Recipe aRecipe = lookupRecipe();
+ log("Looking up new recipe");
+ if (aRecipe != null) {
+ // Cache it
+ aInput = aInput != null ? aInput : getRecipeInput(aRecipe.mInputs);
+ cacheItem(aSchematic, aInput, aRecipe.mOutputs[0], aRecipe);
+ if (hasValidCache(aInput, aSchematic, false)) {
+ log("Caching Recipe");
+ return aRecipe;
+ }
+ }
+ return null;
+ }
+
+ private GT_Recipe lookupRecipe() {
+ ArrayList<ItemStack> aItems = getStoredInputs();
+ if (this.getGUIItemStack() != null) {
+ aItems.add(this.getGUIItemStack());
+ }
+ ItemStack[] aItemInputs = aItems.toArray(new ItemStack[aItems.size()]);
+ GT_Recipe tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false, false,
+ gregtech.api.enums.GT_Values.V[mTier], sNoFluids, aItemInputs);
+
+ if (tRecipe != null) {
+ return tRecipe;
+ }
+ return null;
+ }
+
+
+
+
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ ItemStack aInput = getRecipeInput(aItemInputs);
+ ItemStack aSchematic = getSchematic(aItemInputs);
+ GT_Recipe tRecipe = generatePackageRecipe(aSchematic, aInput);
+
+ ItemStack[] aRealInputs = new ItemStack[] {aSchematic, aInput};
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, sNoFluids, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ mCachedRecipe = null;
+ log("BAD RETURN - 3 - Reset Cached Recipe");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ if (isPerpectOC) this.mMaxProgresstime /= 4;
+ else this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
public boolean allowPutStack(final ItemStack aStack, ItemStack schematicStack) {
//If Schematic Static is not 1x1, 2x2, 3x3
if (!ItemList.Schematic_1by1.isStackEqual((Object) schematicStack) && !ItemList.Schematic_2by2.isStackEqual((Object) schematicStack) && !ItemList.Schematic_3by3.isStackEqual((Object) schematicStack)) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
index 7ddf16b36f..b5c07ecd95 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
@@ -1,18 +1,13 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc;
-import static gregtech.api.enums.GT_Values.*;
+import static gregtech.api.enums.GT_Values.W;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
-import net.minecraft.block.Block;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
@@ -23,21 +18,28 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.entity.EntityTeslaTowerLightning;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.MaterialUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
+public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase<GregtechMTE_TeslaTower> {
private Block casingBlock;
private int casingMeta;
@@ -49,12 +51,12 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
private int xLoc, yLoc, zLoc;
protected int mRange;
- */
-/**
+
+ /**
* Machine Mode,
* {@value false} Attacks all entities,
* {@value true} Only attacks players.
- *//*
+ */
protected volatile boolean mMode = false;
@@ -88,7 +90,7 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
return null;
}
- @Override
+ /*@Override
public String[] getTooltip() {
String casings = getCasingBlockItem().get(0).getDisplayName();
return new String[]{
@@ -102,13 +104,33 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
"1x3x1 " + MaterialUtils.getMaterialName(getFrameMaterial()) + " Frame Boxes (Each pillar side and on top)",
"1x Maintenance Hatch (One of base casings)",
"1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"};
+ }*/
+
+ @Override
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Tesla Defence Tower Mk3200")
+ .addInfo("Enemies within "+this.mRange+"m are blasted with a high energy plasma.")
+ .addInfo("This uses 5,000,000EU per blast.")
+ .addInfo("Can screwdriver to toggle mode between Players and all Entities.")
+ .addSeparator()
+ .beginStructureBlock(1, 7, 1, false)
+ .addController("Top Middle")
+ .addCasingInfo("Casing", 360)
+ .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1)
+ .addInputBus("Any 4 dot hint (min 1)", 4)
+ .addInputHatch("Any 4 dot hint(min 1)", 4)
+ .addOutputHatch("Any 4 dot hint(min 1)", 4)
+ .addEnergyHatch("Any 4 dot hint(min 1)", 4)
+ .addMaintenanceHatch("Any 4 dot hint(min 1)", 4)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
}
private final void initFields() {
casingBlock = ModBlocks.blockCasings2Misc;
casingMeta = getCasingBlockItem().get(0).getItemDamage();
- int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
- frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
casingTextureIndex = getCasingTextureIndex();
mRange = 50;
}
@@ -144,26 +166,24 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(ItemStack aStack) {
- */
-/*if (!isEnergyEnough()) {
+
+ if (!isEnergyEnough()) {
this.mProgresstime = 0;
this.mMaxProgresstime = 20;
this.getBaseMetaTileEntity().setActive(false);
stopMachine();
}
- else {*//*
-*/
-/*
+ else {
this.mProgresstime = 1;
this.mMaxProgresstime = 100;
- this.getBaseMetaTileEntity().setActive(true);*//*
+ this.getBaseMetaTileEntity().setActive(true);
- //}
+ }
return false;
}
@Override
- public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
updateCoordinates();
//check base layer
for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) {
@@ -414,16 +434,6 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
return GregtechItemList.Casing_TeslaTower;
}
- protected Materials getFrameMaterial() {
- */
-/*casingBlock = getCasingBlockItem().getBlock();
- casingMeta = getCasingBlockItem().get(0).getItemDamage();
- int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
- frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
- *//*
-return Materials.get("TungstenCarbide");
- }
-
protected int getCasingTextureIndex() {
return TAE.GTPP_INDEX(30);
}
@@ -474,6 +484,17 @@ return Materials.get("TungstenCarbide");
return 0;
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
index df01d01679..36139bcdec 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
@@ -34,7 +34,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialAlloySmelter> {
public static int CASING_TEXTURE_ID;
private HeatingCoilLevel mHeatingCapacity;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
index eae867d11d..5fa68d5129 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
@@ -50,12 +50,10 @@ public class GregtechMetaTileEntity_IndustrialArcFurnace extends GregtechMeta_Mu
public GregtechMetaTileEntity_IndustrialArcFurnace(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
}
public GregtechMetaTileEntity_IndustrialArcFurnace(final String aName) {
super(aName);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
}
@Override
@@ -70,9 +68,6 @@ public class GregtechMetaTileEntity_IndustrialArcFurnace extends GregtechMeta_Mu
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for Industrial Arc Furnace")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
index 8802a7148b..12c4dbd5d5 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
@@ -28,8 +28,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialCentrifuge
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCentrifuge> {
private boolean mIsAnimated;
private static ITexture frontFace;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
index 63dd3d62dc..982b054d34 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -24,8 +24,8 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialCokeOven
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialCokeOven extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCokeOven> {
+
private int mLevel = 0;
private int mCasing;
private int mCasing1;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
index bf5f8aaeaf..7532f67bf8 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -27,8 +27,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialCuttingMachine
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialCuttingMachine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCuttingMachine> {
private boolean mCuttingMode = true;
private int mCasing;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
index 44552ea2f7..4147f58e36 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
@@ -39,7 +39,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialDehydrator> {
private static int CASING_TEXTURE_ID;
private static String mCasingName = "Vacuum Casing";
@@ -51,13 +51,11 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
public GregtechMetaTileEntity_IndustrialDehydrator(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
}
public GregtechMetaTileEntity_IndustrialDehydrator(String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -66,9 +64,6 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Factory Grade Vacuum Furnace")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
index f6613980ca..d233c00cc7 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
@@ -22,8 +22,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialElectrolyzer
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialElectrolyzer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialElectrolyzer> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialElectrolyzer> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
index a5c7f62578..a9105a27cc 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
@@ -27,8 +27,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialExtruder
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialExtruder extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialExtruder> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialExtruder> STRUCTURE_DEFINITION = null;
@@ -82,7 +81,7 @@ extends GregtechMeta_MultiBlockBase {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialExtruder>builder()
.addShape(mName, transpose(new String[][]{
{"CCC", "CCC", "CCC", "CCC", "CCC"},
- {"C~C", "C-C", "C-C", "C-C", "CMC"},
+ {"C~C", "C-C", "C-C", "C-C", "CCC"},
{"CCC", "CCC", "CCC", "CCC", "CCC"},
}))
.addElement(
@@ -99,12 +98,6 @@ extends GregtechMeta_MultiBlockBase {
)
)
)
- .addElement(
- 'M',
- ofHatchAdder(
- GregtechMetaTileEntity_IndustrialExtruder::addIndustrialExtruderMufflerList, getCasingTextureIndex(), 2
- )
- )
.build();
}
return STRUCTURE_DEFINITION;
@@ -141,19 +134,6 @@ extends GregtechMeta_MultiBlockBase {
return false;
}
- public final boolean addIndustrialExtruderMufflerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- } else {
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity);
- }
- }
- return false;
- }
-
@Override
public String getSound() {
return GregTech_API.sSoundList.get(Integer.valueOf(203));
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
new file mode 100644
index 0000000000..2b0345af78
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
@@ -0,0 +1,319 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.*;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+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.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.*;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+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.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialForgeHammer> {
+
+ private int mCasing;
+ private int mAnvil;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialForgeHammer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialForgeHammer(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ setAnvilBlocks();
+ return new GregtechMetaTileEntity_IndustrialForgeHammer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Forge Hammer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Forge Hammer")
+ .addInfo("Speed: 100% x Anvil Tier | Eu Usage: 100% | Parallel: Tier x 8")
+ .addInfo("T1 - Vanilla Anvil");
+ if (LoadedMods.Railcraft) {
+ tt.addInfo("T2 - Steel Anvil");
+ }
+ if (LoadedMods.EnderIO) {
+ tt.addInfo("T3 - Dark Steel Anvil");
+ }
+ if (LoadedMods.ThaumicBases) {
+ tt.addInfo("T3 - Thaumic Anvil");
+ tt.addInfo("T4 - Void Anvil");
+ }
+ tt.addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Forge Casing", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ Map<Block, Integer> aBlockMap = new HashMap<Block, Integer>();
+ aBlockMap.put(sAnvil, 0);
+ if (LoadedMods.Railcraft) {
+ aBlockMap.put(sSteelAnvil, 0);
+ }
+ if (LoadedMods.EnderIO) {
+ aBlockMap.put(sDarkSteelAnvil, 0);
+ }
+ if (LoadedMods.ThaumicBases) {
+ aBlockMap.put(sThaumiumAnvil, 0);
+ aBlockMap.put(sVoidAnvil, 0);
+ }
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialForgeHammer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "CAC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement('C', ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_IndustrialForgeHammer::addIndustrialForgeHammerList, TAE.getIndexFromPage(1, 11), 1 ),
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings5Misc, 6)
+ )
+ )
+ )
+ .addElement('A', onElementPass(x -> ++x.mAnvil, ofBlocksFlat(aBlockMap, sAnvil, 0)))
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ setAnvilBlocks();
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ setAnvilBlocks();
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialForgeHammerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(1);
+ }
+
+ @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.getCasingTextureForId(TAE.getIndexFromPage(1, 11)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(1, 11))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MaterialPress";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sHammerRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ Block aAnvil = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (aAnvil != null) {
+ int aAnvilTier = getAnvilTier(aAnvil);
+ if (aAnvilTier > 0) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), new FluidStack[]{}, getMaxParallelRecipes() * aAnvilTier, 100, 100, 10000)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialForgeHammer;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ private static Block sAnvil;
+ private static Block sSteelAnvil;
+ private static Block sDarkSteelAnvil;
+ private static Block sThaumiumAnvil;
+ private static Block sVoidAnvil;
+
+ private static void setAnvilBlocks() {
+ if (sAnvil == null) {
+ sAnvil = Blocks.anvil;
+ if (LoadedMods.Railcraft) {
+ sSteelAnvil = GameRegistry.findBlock("Railcraft", "anvil");
+ }
+ if (LoadedMods.EnderIO) {
+ sDarkSteelAnvil = GameRegistry.findBlock("EnderIO", "blockDarkSteelAnvil");
+ }
+ if (LoadedMods.ThaumicBases) {
+ sThaumiumAnvil = GameRegistry.findBlock("thaumicbases", "thaumicAnvil");
+ sVoidAnvil = GameRegistry.findBlock("thaumicbases", "voidAnvil");
+ }
+ }
+ }
+
+ public static boolean isBlockAnvil(Block aBlock) {
+ setAnvilBlocks();
+ if (sAnvil == aBlock) {
+ return true;
+ }
+ if (LoadedMods.Railcraft) {
+ if (sSteelAnvil == aBlock) {
+ return true;
+ }
+ }
+ if (LoadedMods.EnderIO) {
+ if (sDarkSteelAnvil == aBlock) {
+ return true;
+ }
+ }
+ if (LoadedMods.ThaumicBases) {
+ if (sThaumiumAnvil == aBlock || sVoidAnvil == aBlock) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static int getAnvilTier(Block aBlock) {
+ if (isBlockAnvil(aBlock)) {
+ if (sAnvil == aBlock) {
+ return 1;
+ }
+ if (LoadedMods.Railcraft) {
+ if (sSteelAnvil == aBlock) {
+ return 2;
+ }
+ }
+ if (LoadedMods.EnderIO) {
+ if (sDarkSteelAnvil == aBlock) {
+ return 3;
+ }
+ }
+ if (LoadedMods.ThaumicBases) {
+ if (sThaumiumAnvil == aBlock) {
+ return 3;
+ }
+ if (sVoidAnvil == aBlock) {
+ return 4;
+ }
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ setAnvilBlocks();
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
index b6e072b653..743714319d 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
@@ -25,8 +25,8 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialMacerator
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialMacerator extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMacerator> {
+
private int mCasing;
private int mPerLayer;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialMacerator> STRUCTURE_DEFINITION = null;
@@ -145,13 +145,16 @@ extends GregtechMeta_MultiBlockBase {
public final boolean addIndustrialMaceratorBottomList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
@@ -161,11 +164,19 @@ extends GregtechMeta_MultiBlockBase {
public final boolean addIndustrialMaceratorMidList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
index 5e405d426d..0aceed47be 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
@@ -27,12 +27,11 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialMixer
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialMixer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMixer> {
public static int CASING_TEXTURE_ID;
- public static String mCasingName = "Advanced Blast Furnace Casing";
- public static String mCasingName2 = "Advanced Blast Furnace Casing";
+ public static String mCasingName = "Multi-Use Casing";
+ public static String mCasingName2 = "Titanium Turbine Casing";
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialMixer> STRUCTURE_DEFINITION = null;
@@ -40,15 +39,11 @@ extends GregtechMeta_MultiBlockBase {
public GregtechMetaTileEntity_IndustrialMixer(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
}
public GregtechMetaTileEntity_IndustrialMixer(final String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
}
@Override
@@ -63,14 +58,6 @@ extends GregtechMeta_MultiBlockBase {
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
-
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
- }
- if (mCasingName2.toLowerCase().contains(".name")) {
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for the Industrial Mixer")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java
new file mode 100644
index 0000000000..df1cc14658
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java
@@ -0,0 +1,269 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+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_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+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.item.ItemStack;
+
+public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMolecularTransformer> {
+
+ private static final int CASING_TEXTURE_ID = 48;
+ private int mCasing = 0;
+
+ public GregtechMetaTileEntity_IndustrialMolecularTransformer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialMolecularTransformer(final String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialMolecularTransformer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Molecular Transformer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Changes the structure of items to produce new ones")
+ .addInfo("Speed: 100% | Eu Usage: 100%")
+ .addInfo("This multiblock cannot be overclocked")
+ .addInfo("Maximum 1x of each bus/hatch.")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(7, 7, 7, false)
+ .addController("Top Center")
+ .addCasingInfo("Robust Tungstensteel Machine Casing", 40)
+ .addCasingInfo("Tungstensteel Coils", 16)
+ .addCasingInfo("Molecular Containment Casing", 52)
+ .addCasingInfo("High Voltage Current Capacitor", 32)
+ .addCasingInfo("Particle Containment Casing", 4)
+ .addCasingInfo("Resonance Chamber I", 5)
+ .addCasingInfo("Modulator I", 4)
+ .addInputBus("Any Robust Tungstensteel Machine Casing", 1)
+ .addOutputBus("Any Robust Tungstensteel Machine Casing", 1)
+ .addEnergyHatch("Any Robust Tungstensteel Machine Casing", 1)
+ .addMaintenanceHatch("Any Robust Tungstensteel Machine Casing", 1)
+ .addMufflerHatch("Any Robust Tungstensteel Machine Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> STRUCTURE_DEFINITION = null;
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> getStructureDefinition() {
+ STRUCTURE_DEFINITION = null;
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMolecularTransformer>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
+ {" ", " ", " xxx ", " x~x ", " xxx ", " ", " "},
+ {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "},
+ {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "},
+ {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "},
+ {" t ", " ttxtt ", " tyyyt ", "txyzyxt", " tyyyt ", " ttxtt ", " t "},
+ {" c ", " ccecc ", " cxfxc ", "cefefec", " cxfxc ", " ccecc ", " c "},
+ {" h ", " hhhhh ", " hhhhh ", "hhhhhhh", " hhhhh ", " hhhhh ", " h "},
+ }))
+
+ .addElement('x', ofBlock(getCasingBlock(), getCasingMeta()))
+ .addElement('y', ofBlock(getCasingBlock(), getCasingMeta2()))
+ .addElement('z', ofBlock(getCasingBlock(), getCasingMeta3()))
+ .addElement('e', ofBlock(getCasingBlock2(), 0))
+ .addElement('f', ofBlock(getCasingBlock2(), 4))
+ .addElement('c', ofBlock(getCoilBlock(), 3))
+ .addElement('t', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta()))))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_IndustrialMolecularTransformer::addGenericHatch, getCasingTextureIndex(), 1),
+ onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta()))
+ )))
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 3, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0);
+ if (this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 1 || this.mEnergyHatches.size() != 1) {
+ return false;
+ }
+ return aDidBuild && mCasing >= 40 && checkHatch();
+ }
+
+ protected static int getCasingTextureIndex() {
+ return CASING_TEXTURE_ID;
+ }
+
+ protected static Block getCasingBlock() {
+ return ModBlocks.blockSpecialMultiCasings;
+ }
+
+ protected static Block getCasingBlock2() {
+ return ModBlocks.blockSpecialMultiCasings2;
+ }
+
+ protected static Block getCasingBlock3() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ protected static Block getCoilBlock() {
+ return GregTech_API.sBlockCasings5;
+ }
+
+ protected static int getCasingMeta() {
+ return 11;
+ }
+
+ protected static int getCasingMeta2() {
+ return 12;
+ }
+
+ protected static int getCasingMeta3() {
+ return 13;
+ }
+
+ protected static int getTungstenCasingMeta() {
+ return 0;
+ }
+
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ log("Bad Hatch");
+ return false;
+ }
+
+ 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.getCasingTextureForId(44),
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "VacuumFreezer";
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe_Map.sMolecularTransformerRecipes;
+ }
+
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(1, 100, 100);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer;
+ }
+
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
index 76fc51b413..8f5d3bf5e4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
@@ -35,8 +35,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialMultiMachine
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialMultiMachine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMultiMachine> {
protected int mInternalMode = 0;
protected GT_Recipe[] mLastRecipeExtended = new GT_Recipe[9];
@@ -56,7 +55,7 @@ extends GregtechMeta_MultiBlockBase {
static {
for (int id = 0; id < 9; id++) {
- String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).mUnlocalizedName);
+ String aNEI = getRecipeMap(id).mNEIName;
aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)";
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
index 007d1a0d0f..069e00f55c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -29,7 +29,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialPlatePress> {
private boolean mFormingMode = false;
private int mCasing;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
index c5450fec5b..b3219f661b 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
@@ -1,9 +1,13 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import java.util.Random;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -11,9 +15,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
+import gregtech.api.util.*;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -21,12 +23,8 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
-public class GregtechMetaTileEntity_IndustrialSifter
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialSifter extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialSifter> {
+
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialSifter> STRUCTURE_DEFINITION = null;
@@ -63,7 +61,7 @@ extends GregtechMeta_MultiBlockBase {
.addCasingInfo("Sieve Grate", 18)
.addCasingInfo("Sieve Casings", 35)
.addInputBus("Any Casing", 1)
- .addOutputBus("Any Casing", 1)
+ .addOutputBus("Any Casing (x4)", 1)
.addEnergyHatch("Any Casing", 1)
.addMaintenanceHatch("Any Casing", 1)
.addMufflerHatch("Any Casing", 1)
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
index 01b887694a..a473196c43 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
@@ -24,8 +24,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialThermalCentrifuge
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialThermalCentrifuge extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialThermalCentrifuge> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialThermalCentrifuge> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
index 1f63995651..e59b6d3207 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
@@ -28,7 +28,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialVacuumFreezer> {
public static int CASING_TEXTURE_ID;
public static String mCryoFuelName = "Gelid Cryotheum";
@@ -44,18 +44,12 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta
super(aID, aName, aNameRegional);
mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
- mCryoFuelName = mFuelStack.getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
}
public GregtechMetaTileEntity_IndustrialVacuumFreezer(final String aName) {
super(aName);
mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
- mCryoFuelName = mFuelStack.getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
}
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
@@ -69,17 +63,6 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
-
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
- }
- if (mCryoFuelName.toLowerCase().contains(".")) {
- mCryoFuelName = FluidUtils.getFluidStack("cryotheum", 1).getLocalizedName();
- }
- if (mHatchName.toLowerCase().contains(".name")) {
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Factory Grade Advanced Vacuum Freezer")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
index 168d4ff6d6..616459dd1f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -1,15 +1,28 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
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.*;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
@@ -31,14 +44,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
-public class GregtechMetaTileEntity_IndustrialWashPlant
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialWashPlant extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialWashPlant> {
- private boolean mChemicalMode = false;
+ private int mMode = 0;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialWashPlant> STRUCTURE_DEFINITION = null;
@@ -57,15 +65,15 @@ extends GregtechMeta_MultiBlockBase {
@Override
public String getMachineType() {
- return "Ore Washer, Chemical Bath";
+ return "Ore Washer, Simple Washer, Chemical Bath";
}
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Controller Block for the Industrial Ore Washing Plant")
- .addInfo("Can be configured with a screwdriver to also process Chemical Bathing")
+ .addInfo("Controller Block for the Industrial Wash Plant")
+ .addInfo("Can be configured with a screwdriver to also do Simple Washer and process Chemical Bathing")
.addInfo("400% faster than using single block machines of the same voltage")
.addInfo("Processes four item per voltage tier")
.addInfo("Always requires an Input Hatch full of water to refill structure")
@@ -171,7 +179,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return mChemicalMode ? GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes : GT_Recipe.GT_Recipe_Map.sOreWasherRecipes;
+ return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sOreWasherRecipes : mMode == 1 ? GTPP_Recipe_Map.sSimpleWasherRecipes : GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes;
}
@Override
@@ -199,7 +207,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public int getPollutionPerSecond(final ItemStack aStack) {
- if (this.mChemicalMode) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath;
+ if (mMode == 2) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath;
return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeWasher;
}
@@ -311,24 +319,42 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setBoolean("mChemicalMode", mChemicalMode);
+ aNBT.setInteger("mMode", mMode);
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
- mChemicalMode = aNBT.getBoolean("mChemicalMode");
+ if (aNBT.hasKey("mChemicalMode")) {
+ boolean aTempMode = aNBT.getBoolean("mChemicalMode");
+ if (aTempMode) {
+ mMode = 2;
+ }
+ else {
+ mMode = 0;
+ }
+ aNBT.removeTag("mChemicalMode");
+ }
+ if (aNBT.hasKey("mMode")) {
+ mMode = aNBT.getInteger("mMode");
+ }
super.loadNBTData(aNBT);
}
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- mChemicalMode = Utils.invertBoolean(mChemicalMode);
- if (mChemicalMode){
- PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode.");
+ mMode++;
+ if (mMode > 2) {
+ mMode = 0;
}
- else {
+ if (mMode == 0){
PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Ore Washer Mode.");
+ }
+ else if (mMode == 1){
+ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Simple Washer Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode.");
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
index ccce25d925..9ea113ec01 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
@@ -24,8 +24,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialWireMill
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialWireMill extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialWireMill> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialWireMill> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
index ecd6616855..e86f98ef66 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
@@ -50,7 +50,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IsaMill> {
protected boolean boostEu = false;
private int mCasing;
@@ -486,7 +486,7 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
// Based on the Processing Array. A bit overkill, but very flexible.
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
index 8c9e886e94..43f4b337c6 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
@@ -1,7 +1,9 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
@@ -14,12 +16,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
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.minecraft.LangUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -29,12 +32,11 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_Adv_AssemblyLine
- extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Adv_AssemblyLine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_AssemblyLine> {
- public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
-
- public static String[] mCasingName = new String[5];
+ public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
+
+ public static String[] mCasingName = new String[5];
private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
private final int META_BaseCasing = 0; //4
private final int META_ContainmentCasing = 15; //3
@@ -42,46 +44,54 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
private final int META_PipeCasing = 1; //4
private final int META_IntegralCasing = 6; //0
private final int META_ContainmentChamberCasing = 2; //4
-
-
- public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
+
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
- }
+ }
- public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
- super(aName);
- }
+ public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
+ super(aName);
+ }
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
- }
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
+ }
+
+ /* public String[] getTooltip() {
+ if (mCasingName[0].toLowerCase().contains(".name")) {
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ }
+ if (mCasingName[1].toLowerCase().contains(".name")) {
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ }
+ if (mCasingName[2].toLowerCase().contains(".name")) {
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ }
+ if (mCasingName[3].toLowerCase().contains(".name")) {
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ }
+ if (mCasingName[4].toLowerCase().contains(".name")) {
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+ return new String[]{
+ "Advanced Integrated Assembly Line"
+ };
+ }*/
+
+ @Override
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
- public String[] getTooltip() {
- if (mCasingName[0].toLowerCase().contains(".name")) {
- mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
- }
- if (mCasingName[1].toLowerCase().contains(".name")) {
- mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
- }
- if (mCasingName[2].toLowerCase().contains(".name")) {
- mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
- }
- if (mCasingName[3].toLowerCase().contains(".name")) {
- mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
- }
- if (mCasingName[4].toLowerCase().contains(".name")) {
- mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
- }
- return new String[]{
- "Advanced Integrated Assembly Line"
- };
- }
-
private Block getCasing(int casingID) {
if (casingID == 1) {
return ModBlocks.blockCasingsMisc;
@@ -100,155 +110,151 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
}
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
- }
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)};
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png");
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return null;
- }
-
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- public boolean checkRecipe(ItemStack aStack) {
- if(GT_Values.D1)System.out.println("Start ALine recipe check");
- ArrayList<ItemStack> tDataStickList = getDataItems(2);
- if (tDataStickList.size() == 0) return false;
- if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
-
- ItemStack tStack[] = new ItemStack[15];
- FluidStack[] tFluids = new FluidStack[4];
- boolean findRecipe = false;
- nextDS:for (ItemStack tDataStick : tDataStickList){
- NBTTagCompound tTag = tDataStick.getTagCompound();
- if (tTag == null) continue;
- for (int i = 0; i < 15; i++) {
- int count = tTag.getInteger("a"+i);
- if (!tTag.hasKey("" + i) && count <= 0) continue;
- if (mInputBusses.get(i) == null) {
- continue nextDS;
- }
-
- ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
- boolean flag = true;
- if (count > 0) {
- for (int j = 0; j < count; j++) {
- tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
- if (tStack[i] == null) continue;
- if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
- if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
- flag = false;
- break;
- }
- }
- }
- if (flag) {
- tStack[i] = GT_Utility.loadItem(tTag, "" + i);
- if (tStack[i] == null) {
- flag = false;
- continue;
- }
- if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
- if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
- flag = false;
- }
- }
- if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
- if (flag) continue nextDS;
- }
-
- if(GT_Values.D1)System.out.println("All Items done, start fluid check");
- for (int i = 0; i < 4; i++) {
- if (!tTag.hasKey("f" + i)) continue;
- tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
- if (tFluids[i] == null) continue;
- if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
- if (mInputHatches.get(i) == null) {
- continue nextDS;
- }
- FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
- if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
- if(GT_Values.D1)System.out.println(i+" not accepted");
- continue nextDS;
- }
- if(GT_Values.D1)System.out.println(i+" accepted");
- }
-
- if(GT_Values.D1)System.out.println("Input accepted, check other values");
- if (!tTag.hasKey("output")) continue;
- mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
- if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
- continue;
-
- if (!tTag.hasKey("time")) continue;
- mMaxProgresstime = tTag.getInteger("time");
- if (mMaxProgresstime <= 0) continue;
-
- if (!tTag.hasKey("eu")) continue;
- mEUt = tTag.getInteger("eu");
-
- if(GT_Values.D1)System.out.println("Find avaiable recipe");
- findRecipe = true;
- break;
- }
- if (!findRecipe) return false;
-
- if(GT_Values.D1)System.out.println("All checked start consuming inputs");
- for (int i = 0; i < 15; i++) {
- if (tStack[i] == null) continue;
- ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
- stackInSlot.stackSize -= tStack[i].stackSize;
- }
-
- for (int i = 0; i < 4; i++) {
- if (tFluids[i] == null) continue;
- mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
- if (mInputHatches.get(i).mFluid.amount <= 0) {
- mInputHatches.get(i).mFluid = null;
- }
- }
- if(GT_Values.D1)System.out.println("Check overclock");
-
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- if (mEUt <= 16) {
- this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
- } else {
- 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);
- updateSlots();
- if(GT_Values.D1)System.out.println("Recipe sucessfull");
- return true;
- }
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 20) {
- GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
- }
- }
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ if(GT_Values.D1)System.out.println("Start ALine recipe check");
+ ArrayList<ItemStack> tDataStickList = getDataItems(2);
+ if (tDataStickList.size() == 0) return false;
+ if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
+
+ ItemStack tStack[] = new ItemStack[15];
+ FluidStack[] tFluids = new FluidStack[4];
+ boolean findRecipe = false;
+ nextDS:for (ItemStack tDataStick : tDataStickList){
+ NBTTagCompound tTag = tDataStick.getTagCompound();
+ if (tTag == null) continue;
+ for (int i = 0; i < 15; i++) {
+ int count = tTag.getInteger("a"+i);
+ if (!tTag.hasKey("" + i) && count <= 0) continue;
+ if (mInputBusses.get(i) == null) {
+ continue nextDS;
+ }
+
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ boolean flag = true;
+ if (count > 0) {
+ for (int j = 0; j < count; j++) {
+ tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
+ if (tStack[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ break;
+ }
+ }
+ }
+ if (flag) {
+ tStack[i] = GT_Utility.loadItem(tTag, "" + i);
+ if (tStack[i] == null) {
+ flag = false;
+ continue;
+ }
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ }
+ }
+ if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
+ if (flag) continue nextDS;
+ }
+
+ if(GT_Values.D1)System.out.println("All Items done, start fluid check");
+ for (int i = 0; i < 4; i++) {
+ if (!tTag.hasKey("f" + i)) continue;
+ tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
+ if (tFluids[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
+ if (mInputHatches.get(i) == null) {
+ continue nextDS;
+ }
+ FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if(GT_Values.D1)System.out.println(i+" not accepted");
+ continue nextDS;
+ }
+ if(GT_Values.D1)System.out.println(i+" accepted");
+ }
+
+ if(GT_Values.D1)System.out.println("Input accepted, check other values");
+ if (!tTag.hasKey("output")) continue;
+ mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
+ if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
+ continue;
+
+ if (!tTag.hasKey("time")) continue;
+ mMaxProgresstime = tTag.getInteger("time");
+ if (mMaxProgresstime <= 0) continue;
+
+ if (!tTag.hasKey("eu")) continue;
+ mEUt = tTag.getInteger("eu");
+
+ if(GT_Values.D1)System.out.println("Find avaiable recipe");
+ findRecipe = true;
+ break;
+ }
+ if (!findRecipe) return false;
+
+ if(GT_Values.D1)System.out.println("All checked start consuming inputs");
+ for (int i = 0; i < 15; i++) {
+ if (tStack[i] == null) continue;
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ stackInSlot.stackSize -= tStack[i].stackSize;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ if (tFluids[i] == null) continue;
+ mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
+ if (mInputHatches.get(i).mFluid.amount <= 0) {
+ mInputHatches.get(i).mFluid = null;
+ }
+ }
+ if(GT_Values.D1)System.out.println("Check overclock");
+
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ if (mEUt <= 16) {
+ this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ 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);
+ updateSlots();
+ if(GT_Values.D1)System.out.println("Recipe sucessfull");
+ return true;
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
+ }
+ }
public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
@@ -314,7 +320,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
if (aOwnerName != null && aOwnerName.length() > 0) {
aOwner = PlayerUtils.getPlayer(aOwnerName);
}
-
+
if (aShieldingCount != 128) {
log("Not enough "+mCasingName[4]+"s, require 128.");
if (aOwner != null) {
@@ -365,18 +371,18 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- }
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
- }
- return false;
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
}
public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
@@ -394,7 +400,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
if (aY == 0 && x == 0 && z == 0) {
continue;
}
-
+
Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
@@ -485,7 +491,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
return aCasingCount;
}
-
+
public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
int aCasingCount = 0;
for (int x = -1; x < 2; x++) {
@@ -511,7 +517,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
return aCasingCount;
}
-
+
public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
int aCasingCount = 0;
for (int x = -2; x < 3; x++) {
@@ -539,67 +545,65 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
return aCasingCount;
}
-
- */
-/**
- * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
- *//*
-
- private boolean isCorrectDataItem(ItemStack aStack, int state){
- if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
- if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
- if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
- return false;
- }
-
- */
-/**
- * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
- *//*
-
- public ArrayList<ItemStack> getDataItems(int state) {
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
- if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
- rList.add(mInventory[1]);
- }
- for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
- if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
- && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
- rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
- }
- }
- }
- return rList;
- }
-
- public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) return false;
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) return false;
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
- }
- return false;
- }
-
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- public int getPollutionPerTick(ItemStack aStack) {
- return 0;
- }
-
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+
+ private boolean isCorrectDataItem(ItemStack aStack, int state){
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
+ if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
+ if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
+ return false;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+
+ public ArrayList<ItemStack> getDataItems(int state) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
+ rList.add(mInventory[1]);
+ }
+ for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
+ && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
@Override
public boolean hasSlotInGUI() {
@@ -625,5 +629,35 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
public int getEuDiscountForParallelism() {
return 0;
}
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ log("Fixing Bad Facing. (GT Bug)");
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean checkMachine(
+ IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack
+ ) {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
-*/
+
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
index 1ebe328e6d..055c591047 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -34,7 +34,7 @@ import net.minecraftforge.fluids.FluidStack;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
-public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_DistillationTower> {
private byte mMode = 0;
private boolean mUpgraded = false;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
index ce54aef282..e00bbbf730 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
@@ -40,7 +40,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_EBF> {
public static int CASING_TEXTURE_ID;
public static String mHotFuelName = "Blazing Pyrotheum";
@@ -56,17 +56,11 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
public GregtechMetaTileEntity_Adv_EBF(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11);
- mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
}
public GregtechMetaTileEntity_Adv_EBF(String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11);
- mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
}
@Override
@@ -80,34 +74,25 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
- }
- if (mHotFuelName.toLowerCase().contains(".")) {
- mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
- }
- if (mHatchName.toLowerCase().contains(".name")) {
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Factory Grade Advanced Blast Furnace")
- .addInfo("Speed: 120% | Eu Usage: 90% | Parallel: 8")
- .addInfo("Consumes 10L of " + mHotFuelName + " per second during operation")
- .addInfo("Constructed exactly the same as a normal EBF")
- .addPollutionAmount(getPollutionPerSecond(null))
- .addSeparator()
- .addController("Bottom center")
- .addCasingInfo(mCasingName, 9)
- .addInputHatch("Any Casing", 1)
- .addInputBus("Any Casing", 1)
- .addOutputBus("Any Casing", 1)
- .addOutputHatch("Any Casing", 1)
- .addStructureHint(mHatchName, 1)
- .addEnergyHatch("Any Casing", 1)
- .addMufflerHatch("Any Casing", 1)
- .addMaintenanceHatch("Any Casing", 1)
- .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ .addInfo("Factory Grade Advanced Blast Furnace")
+ .addInfo("Speed: 120% | Eu Usage: 90% | Parallel: 8")
+ .addInfo("Consumes 10L of " + mHotFuelName + " per second during operation")
+ .addInfo("Constructed exactly the same as a normal EBF")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .addController("Bottom center")
+ .addCasingInfo(mCasingName, 9)
+ .addInputHatch("Any Casing", 1)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addStructureHint(mHatchName, 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
return tt;
}
@@ -116,31 +101,31 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_EBF>builder()
.addShape(mName, transpose(new String[][]{
- {"CCC", "CCC", "CCC"},
- {"HHH", "H-H", "HHH"},
- {"HHH", "H-H", "HHH"},
- {"C~C", "CCC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
}))
.addElement(
'C',
ofChain(
ofHatchAdder(
GregtechMetaTileEntity_Adv_EBF::addAdvEBFList, CASING_TEXTURE_ID, 1
- ),
+ ),
onElementPass(
x -> ++x.mCasing,
ofBlock(
ModBlocks.blockCasings3Misc, 11
+ )
)
)
)
- )
.addElement(
'H',
ofCoil(
GregtechMetaTileEntity_Adv_EBF::setCoilLevel, GregtechMetaTileEntity_Adv_EBF::getCoilLevel
+ )
)
- )
.build();
}
return STRUCTURE_DEFINITION;
@@ -298,7 +283,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
int tHeatCapacityDivTiers = (int) (mHeatingCapacity.getHeat() - tRecipe.mSpecialValue) / 900;
if (tHeatCapacityDivTiers > 0)
- tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
float tTotalEUt = 0.0f;
int parallelRecipes = 0;
@@ -443,7 +428,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
}
}
}
-
+
}
@Override
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
index 56206f8178..e5f42ffdca 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
@@ -98,6 +98,11 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus
}
@Override
+ public int overclock(int mStartEnergy) {
+ return (mStartEnergy < 160000000) ? 16 : ((mStartEnergy < 320000000) ? 8 : (mStartEnergy < 640000000) ? 4 : 1);
+ }
+
+ @Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
ITexture[] sTexture;
@@ -150,4 +155,24 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus
}
return true;
}
+
+ @Override
+ public String[] getInfoData() {
+ String tier = "IV";
+ float plasmaOut = 0;
+ int powerRequired = 0;
+ if (this.mLastRecipe != null) {
+ powerRequired = this.mLastRecipe.mEUt;
+ if (this.mLastRecipe.getFluidOutput(0) != null) {
+ plasmaOut = (float)this.mLastRecipe.getFluidOutput(0).amount / (float)this.mLastRecipe.mDuration;
+ }
+ }
+
+ return new String[]{
+ "Fusion Reactor MK "+tier,
+ "EU Required: "+powerRequired+"EU/t",
+ "Stored EU: "+mEUStore+" / "+maxEUStore(),
+ "Plasma Output: "+plasmaOut+"L/t"};
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
index aff614184a..e2dfd8d3c3 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
@@ -1,43 +1,36 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.GregTech_API.sBlockCasings4;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
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.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
+import gregtech.api.util.*;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.GregTech_API.sBlockCasings4;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+public class GregtechMetaTileEntity_Adv_Implosion extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_Implosion> {
-public class GregtechMetaTileEntity_Adv_Implosion
-extends GregtechMeta_MultiBlockBase {
-
- private String mCasingName;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_Adv_Implosion> STRUCTURE_DEFINITION = null;
public GregtechMetaTileEntity_Adv_Implosion(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
}
public GregtechMetaTileEntity_Adv_Implosion(String aName) {
super(aName);
- mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -51,9 +44,6 @@ extends GregtechMeta_MultiBlockBase {
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.contains("gt.blockcasings")) {
- mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Factory Grade Advanced Implosion Compressor")
@@ -63,7 +53,7 @@ extends GregtechMeta_MultiBlockBase {
.addSeparator()
.beginStructureBlock(3, 3, 3, true)
.addController("Front center")
- .addCasingInfo(mCasingName, 10)
+ .addCasingInfo("Robust TungstenSteel Casing", 10)
.addInputBus("Any casing", 1)
.addOutputBus("Any casing", 1)
.addEnergyHatch("Any casing", 1)
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java
new file mode 100644
index 0000000000..92190521cd
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java
@@ -0,0 +1,163 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.GregTech_API.sBlockCasings1;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase;
+import net.minecraft.item.ItemStack;
+
+public class GregtechMetaTileEntity_SteamCompressor extends GregtechMeta_SteamMultiBase {
+
+ private String mCasingName = "Bronze Plated Bricks";
+ private IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> STRUCTURE_DEFINITION = null;
+ private int mCasing;
+
+ public GregtechMetaTileEntity_SteamCompressor(String aName) {
+ super(aName);
+ }
+
+ public GregtechMetaTileEntity_SteamCompressor(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) {
+ return new GregtechMetaTileEntity_SteamCompressor(this.mName);
+ }
+
+ @Override
+ protected GT_RenderedTexture getFrontOverlay() {
+ return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR);
+ }
+
+ @Override
+ protected GT_RenderedTexture getFrontOverlayActive() {
+ return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Compressor";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Steam Macerator")
+ .addInfo("Macerates " + getMaxParallelRecipes() + " ores at a time")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo(mCasingName, 14)
+ .addStructureHint("Input Bus (Steam)", 1)
+ .addStructureHint("Output Bus (Steam)", 1)
+ .addStructureHint("Steam Hatch", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamCompressor>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_SteamCompressor::addSteamMultiList, 10, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ sBlockCasings1, 10
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addSteamMultiList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileID() == 31040){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ fixAllMaintenanceIssue();
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 14;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 8;
+ }
+
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sCompressorRecipes;
+ }
+
+ @Override
+ public ItemStack[] getOutputItems(GT_Recipe aRecipe) {
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[1];
+ for (int h = 0; h < 1; h++) {
+ if (aRecipe.getOutput(h) != null) {
+ tOutputItems[h] = aRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+ return tOutputItems;
+ }
+
+ @Override
+ public int getOutputCount(ItemStack[] aOutputs) {
+ return 1;
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
index eae51e5c1d..6ee78b0a95 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
@@ -36,7 +36,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
+public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase<GT4Entity_AutoCrafter> {
private MODE mMachineMode = MODE.ASSEMBLY;
private byte mTier = 1;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
index 65474d38ed..fdf6b4be91 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
@@ -16,20 +16,23 @@ import gregtech.api.util.*;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.general.ItemLavaFilter;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.MISC_MATERIALS;
+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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT4Entity_ThermalBoiler
-extends GregtechMeta_MultiBlockBase
-{
+public class GT4Entity_ThermalBoiler extends GregtechMeta_MultiBlockBase<GT4Entity_ThermalBoiler> {
+
private int mCasing;
private IStructureDefinition<GT4Entity_ThermalBoiler> STRUCTURE_DEFINITION = null;
private int mSuperEfficencyIncrease = 0;
@@ -72,6 +75,9 @@ extends GregtechMeta_MultiBlockBase
}
private static Item mLavaFilter;
+ private static Fluid mLava = null;
+ private static Fluid mPahoehoe = null;
+ private static Fluid mSolarSaltHot = null;
@Override
public boolean checkRecipe(ItemStack aStack) {
@@ -80,6 +86,17 @@ extends GregtechMeta_MultiBlockBase
if (mLavaFilter == null) {
mLavaFilter = ItemList.Component_LavaFilter.getItem();
}
+ if (mLava == null) {
+ mLava = FluidRegistry.LAVA;
+ }
+ if (mPahoehoe == null) {
+ mPahoehoe = FluidUtils.getPahoehoeLava(1).getFluid();
+ }
+ if (mSolarSaltHot == null) {
+ mSolarSaltHot = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid();
+ }
+
+
//Try reload new Lava Filter
if (aStack == null) {
@@ -94,43 +111,51 @@ extends GregtechMeta_MultiBlockBase
for (GT_Recipe tRecipe : GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels.mRecipeList) {
FluidStack tFluid = tRecipe.mFluidInputs[0];
if (tFluid != null) {
- if (depleteInput(tFluid)) {
- this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2));
- this.mEUt = getEUt();
- this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
-
- int loot_MAXCHANCE = 100000;
- if (mLavaFilter.getClass().isInstance(aStack.getItem())) {
-
- if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) };
- }
- if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) };
- }
- if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) };
- }
- if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) };
- }
- if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) };
- }
- if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) };
- }
-
+
+ if (tFluid.getFluid() == mLava || tFluid.getFluid() == mPahoehoe) {
+ if (depleteInput(tFluid)) {
+ this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2));
+ this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
+
+ int loot_MAXCHANCE = 100000;
+ if (mLavaFilter.getClass().isInstance(aStack.getItem())) {
+ if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) };
+ }
+ if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) };
+ }
+ if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) };
+ }
+ if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) };
+ }
+ if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) };
+ }
+ if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) };
+ }
+ }
+ //Give Obsidian without Lava Filter
+ if (tFluid.getFluid() == mLava){
+ if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) };
+ }
+ }
+ return true;
}
- //Give Obsidian without Lava Filter
- if (tFluid.isFluidEqual(GT_ModHandler.getLava(86))){
- if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) };
+ }
+ else if (tFluid.getFluid() == mSolarSaltHot) {
+ if (depleteInput(tFluid)) {
+ this.mMaxProgresstime = tRecipe.mDuration;
+ this.mEfficiency = 10000;
+ for (FluidStack aOutput : tRecipe.mFluidOutputs) {
+ this.addOutput(FluidUtils.getFluidStack(aOutput, aOutput.amount));
}
+ return true;
}
-
-
- return true;
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
index 326cc01de7..1e3e84328e 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
@@ -1,77 +1,61 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
-import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
-import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Element;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
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.interfaces.tileentity.IHasWorldObjectAndCoords;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.api.objects.data.Triplet;
-import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gregtech.common.items.behaviors.Behaviour_DataOrb;
+import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.recipe.common.CI;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder;
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.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase {
-
- private int mSolidCasingTier = 0;
- private int mMachineCasingTier = 0;
- private int mPipeCasingTier = 0;
- private int mCoilTier = 0;
- private int checkCoil;
- private int[] checkCasing = new int[8];
- private int checkMachine;
- private int checkPipe;
- private int maxTierOfHatch;
- private int mCasing;
- private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null;
+public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase<GregtechMTE_ElementalDuplicator> {
private ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder> mReplicatorDataOrbHatches = new ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder>();
-
- private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<Integer, Triplet<Block, Integer, Integer>>();
+ private static final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 3);
+ private int mCasing = 0;
public GregtechMTE_ElementalDuplicator(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -81,28 +65,6 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
super(aName);
}
- public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) {
- int aSize = mTieredBlockRegistry.size();
- int aSize2 = aSize;
- Triplet<Block, Integer, Integer> aCasingData = new Triplet<Block, Integer, Integer>(aBlock, aMeta, aCasingTextureID);
- if (mTieredBlockRegistry.containsKey(aTier)) {
- CORE.crash("Tried to register a Machine casing for tier "+aTier+" to the Chemical Plant, however this tier already contains one.");
- }
- mTieredBlockRegistry.put(aTier, aCasingData);
- aSize = mTieredBlockRegistry.size();
- return aSize > aSize2;
- }
-
- private static int getCasingTextureIdForTier(int aTier) {
- if (!mTieredBlockRegistry.containsKey(aTier)) {
- return 10;
- }
- int aCasingID = mTieredBlockRegistry.get(aTier).getValue_3();
- //Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier);
- return aCasingID;
- }
-
- @Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
return new GregtechMTE_ElementalDuplicator(this.mName);
}
@@ -114,433 +76,467 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Controller Block for the Industrial Replication Machine")
- .addInfo("Now replication is less painful")
- .addInfo("Please read to user manual for more information on construction & usage")
- .addSeparator()
- .addController("Bottom Center")
- .addStructureHint("Catalyst Housing", 1)
- .addInputBus("Bottom Casing", 1)
- .addOutputBus("Bottom Casing", 1)
- .addInputHatch("Bottom Casing", 1)
- .addOutputHatch("Bottom Casing", 1)
- .addEnergyHatch("Bottom Casing", 1)
- .addMaintenanceHatch("Bottom Casing", 1)
- .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ .addInfo("Produces Elemental Material from UU Matter")
+ .addInfo("Speed: 100% | Eu Usage: 100% | Parallel: 8 * Tier")
+ .addInfo("This multiblock cannot be overclocked")
+ .addInfo("Maximum 1x of each bus/hatch.")
+ .addInfo("Does not require both Output Hatch & Bus")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(9, 6, 9, true)
+ .addController("Top Center")
+ .addCasingInfo("Elemental Confinement Shell", 138)
+ .addCasingInfo("Matter Fabricator Casing", 24)
+ .addCasingInfo("Containment Casing", 24)
+ .addCasingInfo("Matter Generation Coil", 24)
+ .addCasingInfo("High Voltage Current Capacitor", 20)
+ .addCasingInfo("Resonance Chamber III", 24)
+ .addCasingInfo("Modulator III", 16)
+ .addOtherStructurePart("Data Orb Repository", "1x", 1)
+ .addInputHatch("Any 1 dot hint", 1)
+ .addOutputBus("Any 1 dot hint", 1)
+ .addOutputHatch("Any 1 dot hint", 1)
+ .addEnergyHatch("Any 1 dot hint", 1)
+ .addMaintenanceHatch("Any 1 dot hint", 1)
+ .addMufflerHatch("Any 1 dot hint", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
return tt;
}
- public void setMachineMeta(int meta) {
- checkMachine = meta;
- }
- public int getMachineMeta() {
- return checkMachine;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null;
+
+ @Override
+ public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder()
+
+ // h = Hatch
+ // c = Casing
+
+ // a = MF Casing 1
+ // b = Matter Gen Coil
+
+ // d = Current Capacitor
+ // e = Particle
+
+ // f = Resonance III
+ // g = Modulator III
+
+ .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
+ {" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccch~hccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "},
+ {" cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", " abfba ", " cac "},
+ {" cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", " e e ", " cec "},
+ {" cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", " e e ", " cec "},
+ {" cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", " abfba ", " cac "},
+ {" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccchhhccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "},
+ }))
+
+
+ .addElement('a', ofBlock(getCasingBlock4(), getCasingMeta6()))
+ .addElement('b', ofBlock(getCasingBlock4(), getCasingMeta7()))
+
+ .addElement('d', ofBlock(getCasingBlock2(), getCasingMeta2()))
+ .addElement('e', ofBlock(getCasingBlock2(), getCasingMeta3()))
+
+ .addElement('f', ofBlock(getCasingBlock3(), getCasingMeta4()))
+ .addElement('g', ofBlock(getCasingBlock3(), getCasingMeta5()))
+ .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMTE_ElementalDuplicator::addGenericHatch, getCasingTextureIndex(), 1),
+ onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))
+ )))
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
}
- public void setPipeMeta(int meta) {
- checkPipe = meta;
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 4, 4, 0);
}
- public int getPipeMeta() {
- return checkPipe;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 4, 4, 0);
+ if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && this.mOutputHatches.size() !=0) || this.mEnergyHatches.size() != 1 || this.mReplicatorDataOrbHatches.size() != 1) {
+ return false;
+ }
+ log("Casings: "+mCasing);
+ return aDidBuild && mCasing >= 138 && checkHatch();
+ }
+
+ protected static int getCasingTextureIndex() {
+ return CASING_TEXTURE_ID;
}
- public void setCoilMeta(int meta) {
- checkCoil = meta;
+ protected static Block getCasingBlock() {
+ return ModBlocks.blockCasings5Misc;
}
- public int getCoilMeta() {
- return checkCoil;
+ protected static Block getCasingBlock2() {
+ return ModBlocks.blockSpecialMultiCasings;
}
- public int coilTier(int meta) {
- switch (meta) {
- case 0: return 1;
- case 1: return 2;
- case 2: return 3;
- case 3: return 4;
- case 4: return 5;
- case 5: return 7;
- case 6: return 8;
- case 7: return 10;
- case 8: return 11;
- case 9: return 6;
- case 10: return 9;
- }
- return 0;
+ protected static Block getCasingBlock3() {
+ return ModBlocks.blockSpecialMultiCasings2;
}
- @Override
- public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() {
- if (STRUCTURE_DEFINITION == null) {
- STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder()
- .addShape(mName, transpose(new String[][]{
- {"XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX"},
- {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
- {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
- {"X X", " ", " HHH ", " HHH ", " HHH ", " ", "X X"},
- {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
- {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
- {"CCC~CCC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CCCCCCC"},
- }))
- .addElement(
- 'C',
- ofChain(
- ofHatchAdder(
- GregtechMTE_ElementalDuplicator::addChemicalPlantList, getCasingTextureID(), 1
- ),
- onElementPass(
- x -> {++x.checkCasing[0]; ++x.mCasing;},
- ofSolidCasing(0)
- ),
- onElementPass(
- x -> {++x.checkCasing[1]; ++x.mCasing;},
- ofSolidCasing(1)
- ),
- onElementPass(
- x -> {++x.checkCasing[2]; ++x.mCasing;},
- ofSolidCasing(2)
- ),
- onElementPass(
- x -> {++x.checkCasing[3]; ++x.mCasing;},
- ofSolidCasing(3)
- ),
- onElementPass(
- x -> {++x.checkCasing[4]; ++x.mCasing;},
- ofSolidCasing(4)
- ),
- onElementPass(
- x -> {++x.checkCasing[5]; ++x.mCasing;},
- ofSolidCasing(5)
- ),
- onElementPass(
- x -> {++x.checkCasing[6]; ++x.mCasing;},
- ofSolidCasing(6)
- ),
- onElementPass(
- x -> {++x.checkCasing[7]; ++x.mCasing;},
- ofSolidCasing(7)
- )
- )
- )
- .addElement(
- 'X',
- ofChain(
- onElementPass(
- x -> {++x.checkCasing[0]; ++x.mCasing;},
- ofSolidCasing(0)
- ),
- onElementPass(
- x -> {++x.checkCasing[1]; ++x.mCasing;},
- ofSolidCasing(1)
- ),
- onElementPass(
- x -> {++x.checkCasing[2]; ++x.mCasing;},
- ofSolidCasing(2)
- ),
- onElementPass(
- x -> {++x.checkCasing[3]; ++x.mCasing;},
- ofSolidCasing(3)
- ),
- onElementPass(
- x -> {++x.checkCasing[4]; ++x.mCasing;},
- ofSolidCasing(4)
- ),
- onElementPass(
- x -> {++x.checkCasing[5]; ++x.mCasing;},
- ofSolidCasing(5)
- ),
- onElementPass(
- x -> {++x.checkCasing[6]; ++x.mCasing;},
- ofSolidCasing(6)
- ),
- onElementPass(
- x -> {++x.checkCasing[7]; ++x.mCasing;},
- ofSolidCasing(7)
- )
- )
- )
- .addElement(
- 'M',
- addTieredBlock(
- GregTech_API.sBlockCasings1, GregtechMTE_ElementalDuplicator::setMachineMeta, GregtechMTE_ElementalDuplicator::getMachineMeta, 10
- )
- )
- .addElement(
- 'H',
- addTieredBlock(
- GregTech_API.sBlockCasings5, GregtechMTE_ElementalDuplicator::setCoilMeta, GregtechMTE_ElementalDuplicator::getCoilMeta, 11
- )
- )
- .addElement(
- 'P',
- addTieredBlock(
- GregTech_API.sBlockCasings2, GregtechMTE_ElementalDuplicator::setPipeMeta, GregtechMTE_ElementalDuplicator::getPipeMeta, 12, 16
- )
- )
- .build();
- }
- return STRUCTURE_DEFINITION;
+ protected static Block getCasingBlock4() {
+ return ModBlocks.blockCasingsMisc;
}
- public static <T> IStructureElement<T> ofSolidCasing(int aIndex) {
- return new IStructureElement<T>() {
- @Override
- public boolean check(T t, World world, int x, int y, int z) {
- Block block = world.getBlock(x, y, z);
- int meta = world.getBlockMetadata(x, y, z);
- Block target = mTieredBlockRegistry.get(aIndex).getValue_1();
- int targetMeta = mTieredBlockRegistry.get(aIndex).getValue_2();
- return target.equals(block) && meta == targetMeta;
- }
+ protected static int getCasingMeta() {
+ return 3;
+ }
- int getIndex(int size) {
- if (size > 8) size = 8;
- return size - 1;
- }
+ protected static int getCasingMeta2() {
+ return 12;
+ }
- @Override
- public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
- StructureLibAPI.hintParticle(world, x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2());
- return true;
- }
+ protected static int getCasingMeta3() {
+ return 13;
+ }
- @Override
- public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- return world.setBlock(x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2(), 3);
- }
- };
+ protected static int getCasingMeta4() {
+ return 2;
}
- @Override
- public void construct(ItemStack stackSize, boolean hintsOnly) {
- buildPiece(mName , stackSize, hintsOnly, 3, 6, 0);
+ protected static int getCasingMeta5() {
+ return 6;
}
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- mCasing = 0;
- for (int i = 0; i < 8; i++) {
- checkCasing[i] = 0;
- }
- checkCoil = 0;
- checkPipe = 0;
- checkMachine = 0;
- mSolidCasingTier = 0;
- mMachineCasingTier = 0;
- mPipeCasingTier = 0;
- mCoilTier = 0;
- mReplicatorDataOrbHatches.clear();
- if (checkPiece(mName, 3, 6, 0) && mCasing >= 80) {
- for (int i = 0; i < 8; i++) {
- if (checkCasing[i] == mCasing) {
- mSolidCasingTier = i;
- }
- else if (checkCasing[i] > 0)
- return false;
- }
- mMachineCasingTier = checkMachine - 1;
- mPipeCasingTier = checkPipe - 12;
- mCoilTier = coilTier(checkCoil - 1);
- updateHatchTexture();
- return mMachineCasingTier >= maxTierOfHatch;
- }
- return false;
+ protected static int getCasingMeta6() {
+ return 9;
}
- public void updateHatchTexture() {
- for (GT_MetaTileEntity_Hatch h : mReplicatorDataOrbHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mInputBusses) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mMaintenanceHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mEnergyHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mOutputBusses) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mOutputHatches) h.updateTexture(getCasingTextureID());
+ protected static int getCasingMeta7() {
+ return 8;
}
- public final boolean addChemicalPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder){
- return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier);
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) {
+ try {
+ ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
}
return false;
}
- @Override
- public String getSound() {
- return GregTech_API.sSoundList.get(Integer.valueOf(207));
- }
-
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
-
- ITexture aOriginalTexture;
-
- // Check things exist client side (The worst code ever)
- if (aBaseMetaTileEntity.getWorld() != null) {
-
- }
- int aCasingID = getCasingTextureID();
- aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(aCasingID);
-
+ 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[]{aOriginalTexture, new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
}
- return new ITexture[]{aOriginalTexture};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
}
@Override
public boolean hasSlotInGUI() {
- return true;
+ return false;
}
@Override
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) {
- generateRecipes();
- }
- return GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT;
- }
-
- public static void generateRecipes() {
- for (GT_Recipe i : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) {
- GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.add(i);
- }
+ public boolean requiresVanillaGtGUI() {
+ return false;
}
@Override
- public int getMaxParallelRecipes() {
- return 2 * getPipeCasingTier();
+ public String getCustomGUIResourceName() {
+ return null;
}
- @Override
- public int getEuDiscountForParallelism() {
- return 100;
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe_Map.sElementalDuplicatorRecipes;
}
- private int getSolidCasingTier() {
- return this.mSolidCasingTier;
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
}
- private int getMachineCasingTier() {
- return mMachineCasingTier;
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), 100, 100);
}
- private int getPipeCasingTier() {
- return mPipeCasingTier;
- }
- private int getCasingTextureID() {
- // Check the Tier Client Side
- int aTier = mSolidCasingTier;
- int aCasingID = getCasingTextureIdForTier(aTier);
- return aCasingID;
- }
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
- public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
- int aMaxTier = getMachineCasingTier();
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
- GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
- int aTileTier = aMachineBlock.mTier;
- if (aTileTier > aMaxTier) {
- log("Hatch tier too high.");
- return false;
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = null;
+
+ try {
+ log("Checking "+aItemInputs.length+" Data Orbs");
+
+ for (int i=0;i<aItemInputs.length;i++) {
+ ItemStack aItem = aItemInputs[i];
+ log("Found: "+aItem.getDisplayName());
+ }
+ ItemStack aDataOrbStack = null;
+ recipe : for (GT_Recipe nRecipe : this.getRecipeMap().mRecipeList) {
+ log("Checking Recipe for: "+(nRecipe.mOutputs.length > 0 && nRecipe.mOutputs[0] != null ? nRecipe.mOutputs[0].getDisplayName() : nRecipe.mFluidOutputs[0].getLocalizedName()));
+ ItemStack aTempStack = getSpecialSlotStack(nRecipe);
+ if (aTempStack != null) {
+ for (ItemStack aItem : aItemInputs) {
+ if (nRecipe.mSpecialItems != null) {
+ if (GT_Utility.areStacksEqual(aTempStack, aItem, false)) {
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(aTempStack)).mLinkedMaterials.get(0);
+ log("Found: "+aTempStack.getDisplayName()+" for "+tMaterial.name());
+ aDataOrbStack = aTempStack;
+ break recipe;
+ }
+ }
+ }
+ }
+ }
+ if (aDataOrbStack != null) {
+ tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aDataOrbStack, aItemInputs);
+ if (tRecipe != null) {
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(aDataOrbStack)).mLinkedMaterials.get(0);
+ log("Found recipe for "+tMaterial.name());
+ }
+ else {
+ log("No Recipe Found");
+ }
}
else {
- return addToMachineList(aTileEntity, getCasingTextureID());
+ log("Null DO");
}
+
}
- else {
- log("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
return false;
- }
- }
+ }
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier);
- aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier);
- aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier);
- aNBT.setInteger("mCoilTier", this.mCoilTier);
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 4;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
}
+
@Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mSolidCasingTier = aNBT.getInteger("mSolidCasingTier");
- mMachineCasingTier = aNBT.getInteger("mMachineCasingTier");
- mPipeCasingTier = aNBT.getInteger("mPipeCasingTier");
- mCoilTier = aNBT.getInteger("mCoilTier");
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
}
@Override
- public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) {
- log("Found GT_MetaTileEntity_Hatch_ElementalDataOrbHolder");
- ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aTileEntity).mRecipeMap = getRecipeMap();
- return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
- }
- return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ public int getEuDiscountForParallelism() {
+ return 100;
}
- @Override
public int getMaxEfficiency(final ItemStack aStack) {
return 10000;
}
- @Override
- public int getPollutionPerTick(final ItemStack aStack) {
- return 100;
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer;
}
- @Override
- public int getAmountOfOutputs() {
- return 1;
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
}
- @Override
public boolean explodesOnComponentBreak(final ItemStack aStack) {
return false;
}
@Override
- public String getCustomGUIResourceName() {
- return null;
- }
-
- // Same speed bonus as pyro oven
- public int getSpeedBonus() {
- return 50 * (this.mCoilTier - 2);
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
}
@Override
@@ -554,191 +550,136 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
}
@Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- }
-
- @Override
- public boolean checkRecipe(final ItemStack aStack) {
- return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus());
+ public ArrayList<ItemStack> getStoredInputs() {
+ ArrayList<ItemStack> tItems = super.getStoredInputs();
+ for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ tItems.addAll(tHatch.getInventory());
+ }
+ }
+ tItems.removeAll(Collections.singleton(null));
+ return tItems;
}
+ /**
+ * finds a Recipe matching the aFluid and ItemStack Inputs.
+ *
+ * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup.
+ * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up.
+ * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs
+ * @param aDontCheckStackSizes if set to false will only return recipes that can be executed at least once with the provided input
+ * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage
+ * @param aFluids the Fluid Inputs
+ * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do.
+ * @param aInputs the Item Inputs
+ * @return the Recipe it has found or null for no matching Recipe
+ */
+ public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) {
- @Override
- public boolean checkRecipeGeneric(
- ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
- int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
- return false;
- }
-
- private static final HashMap<Long, AutoMap<GT_Recipe>> mTieredRecipeMap = new HashMap<Long, AutoMap<GT_Recipe>>();
- private static final AutoMap<GT_Recipe> aTier0Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier1Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier2Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier3Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier4Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier5Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier6Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier7Recipes = new AutoMap<GT_Recipe>();
- private static boolean mInitRecipeCache = false;
-
- private static void initRecipeCaches() {
- if (!mInitRecipeCache) {
- mTieredRecipeMap.put((long) 0, aTier0Recipes);
- mTieredRecipeMap.put((long) 1, aTier1Recipes);
- mTieredRecipeMap.put((long) 2, aTier2Recipes);
- mTieredRecipeMap.put((long) 3, aTier3Recipes);
- mTieredRecipeMap.put((long) 4, aTier4Recipes);
- mTieredRecipeMap.put((long) 5, aTier5Recipes);
- mTieredRecipeMap.put((long) 6, aTier6Recipes);
- mTieredRecipeMap.put((long) 7, aTier7Recipes);
- for (GT_Recipe aRecipe : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList) {
- if (aRecipe != null) {
- switch (aRecipe.mSpecialValue) {
- case 0:
- aTier0Recipes.add(aRecipe);
- continue;
- case 1:
- aTier1Recipes.add(aRecipe);
- continue;
- case 2:
- aTier2Recipes.add(aRecipe);
- continue;
- case 3:
- aTier3Recipes.add(aRecipe);
- continue;
- case 4:
- aTier4Recipes.add(aRecipe);
- continue;
- case 5:
- aTier5Recipes.add(aRecipe);
- continue;
- case 6:
- aTier6Recipes.add(aRecipe);
- continue;
- case 7:
- aTier7Recipes.add(aRecipe);
- continue;
- }
- }
- }
- mInitRecipeCache = true;
+ GT_Recipe_Map mRecipeMap = this.getRecipeMap();
+ // No Recipes? Well, nothing to be found then.
+ if (mRecipeMap.mRecipeList.isEmpty()) {
+ return null;
}
- }
- private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) {
- int aInputCount = aComparator.mInputs.length;
- if (aInputCount > 0) {
- //Logger.INFO("Looking for recipe with "+aInputCount+" Items");
- int aMatchingInputs = 0;
- recipe : for (ItemStack a : aComparator.mInputs) {
- for (ItemStack b : aInputs) {
- if (a.getItem() == b.getItem()) {
- if (a.getItemDamage() == b.getItemDamage()) {
- //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName());
- aMatchingInputs++;
- continue recipe;
- }
- }
- }
- }
- if (aMatchingInputs != aInputCount) {
- return false;
- }
- }
- int aFluidInputCount = aComparator.mFluidInputs.length;
- if (aFluidInputCount > 0) {
- //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids");
- int aMatchingFluidInputs = 0;
- recipe : for (FluidStack b : aComparator.mFluidInputs) {
- //Logger.INFO("Checking for fluid "+b.getLocalizedName());
- for (FluidStack a : aFluids) {
- if (GT_Utility.areFluidsEqual(a, b)) {
- //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName());
- aMatchingFluidInputs++;
- continue recipe;
- }
- else {
- //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName());
- }
- }
+ // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes.
+ // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes.
+ if (GregTech_API.sPostloadFinished) {
+ if (mRecipeMap.mMinimalInputFluids > 0) {
+ if (aFluids == null) return null;
+ int tAmount = 0;
+ for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++;
+ if (tAmount < mRecipeMap.mMinimalInputFluids) return null;
}
- if (aMatchingFluidInputs != aFluidInputCount) {
- return false;
+ if (mRecipeMap.mMinimalInputItems > 0) {
+ if (aInputs == null) return null;
+ int tAmount = 0;
+ for (ItemStack aInput : aInputs) if (aInput != null) tAmount++;
+ if (tAmount < mRecipeMap.mMinimalInputItems) return null;
}
}
- Logger.INFO("Recipes Match!");
- return true;
- }
- public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) {
- if (!mInitRecipeCache) {
- initRecipeCaches();
+ // Unification happens here in case the Input isn't already unificated.
+ if (aNotUnificated) {
+ aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs);
}
- if (this.getRecipeMap().mRecipeList.isEmpty()) {
- log("No Recipes in Map to search through.");
- return null;
+
+ // Check the Recipe which has been used last time in order to not have to search for it again, if possible.
+ if (aRecipe != null) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(aRecipe);
+ if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return aRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= aRecipe.mEUt ? aRecipe : null;
+ }
}
- else {
- log("Checking tier "+aSpecialValue+" recipes and below. Using Input Voltage of "+aVoltage+"V.");
- log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids.");
- // Try check the cached recipe first
- if (aRecipe != null) {
- if (areInputsEqual(aRecipe, aInputs, aFluids)) {
- if (aRecipe.mEUt <= aVoltage) {
- Logger.INFO("Using cached recipe.");
- return aRecipe;
+
+ // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items.
+ if (mRecipeMap.mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs)
+ if (tStack != null) {
+ Collection<GT_Recipe> tRecipes = mRecipeMap.mRecipeItemMap.get(new GT_ItemStack(tStack));
+ if (tRecipes != null) {
+ for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ tRecipes = mRecipeMap.mRecipeItemMap.get(new GT_ItemStack(tStack, true));
}
}
- }
-
- // Get all recipes for the tier
- AutoMap<AutoMap<GT_Recipe>> aMasterMap = new AutoMap<AutoMap<GT_Recipe>>();
- for (long i=0;i<=aSpecialValue;i++) {
- aMasterMap.add(mTieredRecipeMap.get(i));
- }
- GT_Recipe aFoundRecipe = null;
-
- // Iterate the tiers recipes until we find the one with all inputs matching
- master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) {
- for (GT_Recipe aRecipeToCheck : aTieredMap) {
- if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) {
- log("Found recipe with matching inputs!");
- if (aRecipeToCheck.mSpecialValue <= aSpecialValue) {
- if (aRecipeToCheck.mEUt <= aVoltage) {
- aFoundRecipe = aRecipeToCheck;
- break master;
+ if (tRecipes != null) {
+ for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
}
- }
+ }
}
}
}
- // If we found a recipe, return it
- if (aFoundRecipe != null) {
- log("Found valid recipe.");
- return aFoundRecipe;
+ // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too.
+ if (mRecipeMap.mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids)
+ if (aFluid != null) {
+ Collection<GT_Recipe>
+ tRecipes = mRecipeMap.mRecipeFluidMap.get(aFluid.getFluid());
+ if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ }
}
- }
- log("Did not find valid recipe.");
+
+ // And nothing has been found.
return null;
}
- /*
- * Catalyst Handling
- */
+ public static ItemStack getSpecialSlotStack(GT_Recipe aRecipe) {
+ ItemStack aStack = null;
+ if (aRecipe.mSpecialItems != null) {
+ if (aRecipe.mSpecialItems instanceof ItemStack[]) {
+ ItemStack[] aTempStackArray = (ItemStack[]) aRecipe.mSpecialItems;
+ aStack = aTempStackArray[0];
+ }
+ }
+ return aStack;
+ }
- @Override
- public ArrayList<ItemStack> getStoredInputs() {
- ArrayList<ItemStack> tItems = super.getStoredInputs();
- for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
- tHatch.mRecipeMap = getRecipeMap();
- if (isValidMetaTileEntity(tHatch)) {
- tItems.addAll(tHatch.getInventory());
+ private static boolean areDataOrbsEqual(ItemStack aOrb1, ItemStack aOrb2) {
+ if (aOrb1 != null && aOrb2 != null) {
+ Materials tMaterial1 = Element.get(Behaviour_DataOrb.getDataName(aOrb1)).mLinkedMaterials.get(0);
+ Materials tMaterial2 = Element.get(Behaviour_DataOrb.getDataName(aOrb2)).mLinkedMaterials.get(0);
+ if (tMaterial1.equals(tMaterial2)) {
+ return true;
}
- }
- return tItems;
+ }
+
+ return false;
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
index 25b8865f55..715ef30697 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
@@ -1,19 +1,18 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
+
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.metatileentity.implementations.*;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gtPlusPlus.core.lib.CORE;
-import org.apache.commons.lang3.ArrayUtils;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
@@ -21,10 +20,16 @@ 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_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.api.util.GTPP_Recipe;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -34,7 +39,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase {
+public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase<GregtechMTE_FrothFlotationCell> {
private int mCasing;
private IStructureDefinition<GregtechMTE_FrothFlotationCell> STRUCTURE_DEFINITION = null;
@@ -67,7 +72,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase
.beginStructureBlock(3, 3, 3, true)
.addController("Front Center")
.addCasingInfo("Inconel Reinforced Casing", 68)
- .addCasingInfo("Flotation Casings", 52)
+ .addCasingInfo("Flotation Casing", 52)
.addInputBus("Bottom Casing", 1)
.addInputHatch("Bottom Casing", 1)
.addOutputHatch("Bottom Casing", 1)
@@ -222,7 +227,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
// Fix GT bug
- if (this.getBaseMetaTileEntity().getFrontFacing() == 0 && this.getBaseMetaTileEntity().getBackFacing() == 1) {
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
log("Fixing Bad Facing. (GT Bug)");
this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
}
@@ -233,6 +238,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase
return super.checkRecipeGeneric();
}
+ @Override
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
index cccee84c99..fabbd42924 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
@@ -33,7 +33,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntityGeneratorArray> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntityGeneratorArray> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
index 83b8eae458..2b5320de20 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
@@ -29,10 +29,10 @@ import net.minecraft.item.ItemStack;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntityTreeFarm> {
public static int CASING_TEXTURE_ID;
- public static String mCasingName = "Advanced Cryogenic Casing";
+ public static String mCasingName = "Sterile Farm Casing";
public static TreeGenerator mTreeData;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntityTreeFarm> STRUCTURE_DEFINITION = null;
@@ -51,13 +51,11 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
}
public GregtechMetaTileEntityTreeFarm(final String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
}
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
@@ -71,9 +69,6 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Converts EU to Oak Logs")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
index 323efa2193..06983572af 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
@@ -33,8 +33,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_AlloyBlastSmelter
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_AlloyBlastSmelter extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_AlloyBlastSmelter> {
private int mMode = 0;
private boolean isUsingControllerCircuit = false;
@@ -68,6 +67,7 @@ extends GregtechMeta_MultiBlockBase {
.addInfo("Controller Block for the Alloy Blast Smelter")
.addInfo("20% Faster than the Electric Blast Furnace")
.addInfo("Allows Complex GT++ alloys to be created")
+ .addInfo("This multiblock cannot be overclocked")
.addInfo("Circuit for recipe goes in the Input Bus or GUI slot")
.addPollutionAmount(getPollutionPerSecond(null))
.addSeparator()
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index 7514a3dea6..1b24b8f264 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -34,7 +34,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Cyclotron> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_Cyclotron> STRUCTURE_DEFINITION = null;
@@ -203,6 +203,8 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus && ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier >= 5){
return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output && ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy && ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier >= 5){
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
index 80eb09640d..26a744612a 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
@@ -39,7 +39,7 @@ import net.minecraft.util.WeightedRandomFishable;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialFishingPond> {
private boolean isUsingControllerCircuit = false;
private static final Item circuit = CI.getNumberedCircuit(0).getItem();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
index d9162cea89..28d82bc492 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
@@ -1,28 +1,28 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import java.util.ArrayList;
import java.util.Collection;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
+
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.*;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.chemistry.RocketFuels;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.util.minecraft.FluidUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -31,12 +31,9 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeRocketEngine>
{
protected int fuelConsumption;
@@ -52,6 +49,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public static String mCasingName = "Turbodyne Casing";
public static String mIntakeHatchName = "Tungstensteel Turbine Casing";
public static String mGearboxName = "Inconel Reinforced Casing";
+
+ private static Fluid sAirFluid = null;
+ private static FluidStack sAirFluidStack = null;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_LargeRocketEngine> STRUCTURE_DEFINITION = null;
@@ -64,6 +64,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.fuelValue = 0;
this.fuelRemaining = 0;
this.boostEu = false;
+ setAir();
}
public GregtechMetaTileEntity_LargeRocketEngine(final String aName) {
@@ -72,26 +73,11 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.fuelValue = 0;
this.fuelRemaining = 0;
this.boostEu = false;
+ setAir();
}
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11);
- }
- if (mIntakeHatchName.toLowerCase().contains(".name")) {
- mIntakeHatchName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11);
- }
- if (mGearboxName.toLowerCase().contains(".name")) {
- mGearboxName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 1);
- }
- if (mLubricantName.toLowerCase().contains(".")) {
- mLubricantName = FluidUtils.getFluidStack("carbondioxide", 1).getLocalizedName();
- }
- if (mCoolantName.toLowerCase().contains(".")) {
- mCoolantName = FluidUtils.getFluidStack("liquidhydrogen", 1).getLocalizedName();
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for the Large Rocket Engine")
@@ -111,7 +97,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
.addStructureHint("Air Intake Hatch", 1)
.addInputBus("Side center line", 1)
.addInputHatch("Side center line", 1)
- .addMaintenanceHatch("Side center line", 1)
+ .addMaintenanceHatch("Any Block Touching Inconel Reinforced Casing", 1)
.addDynamoHatch("Top center line", 2)
.addMufflerHatch("Back Center", 3)
.toolTipFinisher(CORE.GT_Tooltip_Builder);
@@ -123,7 +109,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_LargeRocketEngine>builder()
.addShape(mName, transpose(new String[][]{
- {"CCC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CCC"},
+ {"CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC"},
{"C~C", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "CMC"},
{"CCC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CCC"},
}))
@@ -195,13 +181,19 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public final boolean addLargeRocketEngineTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } if (LoadedMods.TecTech) {
+ }
+ if (LoadedMods.TecTech) {
if (isThisHatchMultiDynamo(aMetaTileEntity)) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
@@ -213,15 +205,19 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public final boolean addLargeRocketEngineSideList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
@@ -257,19 +253,28 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
}
+
+ public static void setAir() {
+ if (sAirFluidStack == null) {
+ sAirFluidStack = FluidUtils.getFluidStack("air", 1);
+ }
+ if (sAirFluid == null && sAirFluidStack != null) {
+ sAirFluid = sAirFluidStack.getFluid();
+ }
+ }
public int getAir() {
+ setAir();
if (this.mAirIntakes.isEmpty() || this.mAirIntakes.size() <= 0) {
return 0;
}
else {
int totalAir = 0;
- FluidStack airstack = FluidUtils.getFluidStack("air", 1);
for (GT_MetaTileEntity_Hatch_AirIntake u : this.mAirIntakes) {
if (u != null && u.mFluid != null) {
// had this trow errors cousing the machine to stop probebly fixed
FluidStack f = u.mFluid;
- if (f.isFluidEqual(airstack)) {
+ if (f.isFluidEqual(sAirFluidStack)) {
totalAir += f.amount;
}
}
@@ -279,9 +284,13 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
}
@Override
+ public GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels;
+ }
+
+ @Override
public boolean checkRecipe(final ItemStack aStack) {
final ArrayList<FluidStack> tFluids = this.getStoredFluids();
- FluidStack air = FluidUtils.getFluidStack("air", 1);
int aircount = getAir() ;
if (aircount < euProduction/100) {
@@ -289,7 +298,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
return false;
}
else {
- boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/100));
+ boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(sAirFluid, euProduction/100));
if (!hasIntakeAir) {
//log("Could not consume Air to run "+aircount);
freeFuelTicks = 0;
@@ -302,10 +311,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
//log("Running "+aircount);
log("looking at hatch");
- final Collection<GT_Recipe> tRecipeList = GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels.mRecipeList;
- if (tFluids.size() > 0 && tRecipeList != null) {
+ if (tFluids.size() > 0 && getRecipeMap() != null) {
if (tFluids.contains(MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(this.boostEu ? 3 : 1)) || tFluids.contains(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1)))) {
if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
@@ -324,12 +332,12 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.boostEu = consumeLOH();
for (final FluidStack hatchFluid1 : tFluids) {
- if (hatchFluid1.isFluidEqual(air)) {
+ if (hatchFluid1.isFluidEqual(sAirFluidStack)) {
continue;
}
if (freeFuelTicks == 0) {
- for (final GT_Recipe aFuel : tRecipeList) {
+ for (final GT_Recipe aFuel : getRecipeMap().mRecipeList) {
final FluidStack tLiquid;
tLiquid = aFuel.mFluidInputs[0];
if (hatchFluid1.isFluidEqual(tLiquid)) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
index 9be787e922..5135a7eeed 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
@@ -28,7 +28,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeSemifluidGenerator> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_LargeSemifluidGenerator> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
index 31fcc41cf4..177d1690cf 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
@@ -1,5 +1,8 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import java.util.ArrayList;
+import java.util.Collection;
+
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.enums.ConfigCategories;
@@ -82,16 +85,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
- mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
}
public GregtechMetaTileEntity_MassFabricator(final String aName) {
super(aName);
- mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
- mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
}
@Override
@@ -101,21 +98,13 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
-
- if (mCasingName1.toLowerCase().contains(".name")) {
- mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
- }
- if (mCasingName2.toLowerCase().contains(".name")) {
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
- }
- if (mCasingName3.toLowerCase().contains(".name")) {
- mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for the Matter Fabricator")
+ .addInfo("Speed: 100% | Eu Usage: 80%")
+ .addInfo("Parallel: Scrap = 64 | UU = 8 * Tier")
.addInfo("Produces UU-A, UU-M & Scrap")
+ .addInfo("Change mode with screwdriver")
.addPollutionAmount(getPollutionPerSecond(null))
.addSeparator()
.beginStructureBlock(5, 4, 5, true)
@@ -445,7 +434,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
public boolean checkRecipeUU(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll) {
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
// Based on the Processing Array. A bit overkill, but very flexible.
@@ -645,7 +634,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
@Override
public int getMaxParallelRecipes() {
- return this.mMode == MODE_SCRAP ? 32 : 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
+ return this.mMode == MODE_SCRAP ? 64 : 8 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
}
@Override
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
index f86ecf3196..ca33c31f8c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
@@ -21,7 +21,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Refinery> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_Refinery> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
index d42b33a403..4ad4c76be4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
@@ -1,10 +1,12 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
@@ -12,13 +14,15 @@ 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.*;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
+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 gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater;
@@ -27,24 +31,29 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_SolarTower
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_SolarTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_SolarTower> {
//862
- private static final int mCasingTextureID = TAE.getIndexFromPage(3, 4);
- public static String mCasingName = "";
- private int mHeight = 0;
+ private static final int mCasingTextureID = TAE.getIndexFromPage(3, 9);
private int mHeatLevel = 0;
+ private int mCasing1;
+ private int mCasing2;
+ private int mCasing3;
+ private int mCasing4;
+
+
+ public ArrayList<TileEntitySolarHeater> mSolarHeaters = new ArrayList<TileEntitySolarHeater>();
+
public GregtechMetaTileEntity_SolarTower(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
}
public GregtechMetaTileEntity_SolarTower(final String aName) {
super(aName);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
}
@Override
@@ -58,14 +67,326 @@ extends GregtechMeta_MultiBlockBase {
}
@Override
- public String[] getTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Contributing Green Energy towards the future")
+ .addInfo("Input: "+MISC_MATERIALS.SOLAR_SALT_COLD.getLocalizedName())
+ .addInfo("Output: "+MISC_MATERIALS.SOLAR_SALT_HOT.getLocalizedName())
+ .addInfo("Surround with rings of Solar Heaters")
+ .addInfo("Each ring increases tier")
+ .addInfo("1 = 1, 2 = 2, 3 = 4, 4 = 8, 5 = 16")
+ .addInfo("Tier decreases heating time and allows more salt to be processed")
+ .addSeparator()
+ .beginStructureBlock(6, 27, 6, false)
+ .addController("Top Middle")
+ .addCasingInfo("Structural Solar Casing", 229)
+ .addCasingInfo("Thermally Insulated Casing", 60)
+ .addCasingInfo("Salt Containment Casing", 66)
+ .addCasingInfo("Thermal Containment Casing", 60)
+ .addInputHatch("Any 2 dot hint(min 1)", 2)
+ .addOutputHatch("Any 2 dot hint(min 1)", 2)
+ .addMaintenanceHatch("Any 2 dot hint", 2)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ private static final String STRUCTURE_PIECE_BASE = "base";
+ private static final String STRUCTURE_PIECE_TOWER = "tower";
+ private static final String STRUCTURE_PIECE_TOP = "top";
+
+ private static final String SOLAR_HEATER_RING_1 = "ring1";
+ private static final String SOLAR_HEATER_RING_2 = "ring2";
+ private static final String SOLAR_HEATER_RING_3 = "ring3";
+ private static final String SOLAR_HEATER_RING_4 = "ring4";
+ private static final String SOLAR_HEATER_RING_5 = "ring5";
+
+ private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>>() {
+ @Override
+ protected IStructureDefinition<GregtechMetaTileEntity_SolarTower> computeValue(Class<?> type) {
+ return StructureDefinition.<GregtechMetaTileEntity_SolarTower>builder()
+
+ // s = salt
+ // c = thermal containment
+ // i = thermal insulated
+ // t = solar structural
+ // h = hatch
+ // g = solar heater
+
+ .addShape(STRUCTURE_PIECE_TOP, (new String[][]{
+ {" ", " ", " ~ ", " ", " "},
+ {" ", " s ", " sss ", " s ", " "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ }))
+ .addShape(STRUCTURE_PIECE_TOWER, (new String[][]{
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ }))
+ .addShape(STRUCTURE_PIECE_BASE, (new String[][]{
+ {" ", " ", " t ", " ttt ", " ttstt ", " ttssstt ", " ttstt ", " ttt ", " t ", " ", " "},
+ {" ", " ", " t ", " ttt ", " tssst ", " ttssstt ", " tssst ", " ttt ", " t ", " ", " "},
+ {" ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", " ttssstt ", " ttttt ", " ttt ", " t ", " "},
+ {" ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", " ttssstt ", " ttttt ", " ttt ", " t ", " "},
+ {" hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "htttsssttth", "htttsssttth", "htttsssttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh "},
+ {" hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "httttttttth", "httttttttth", "httttttttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh "},
+ }))
+
+
+ .addShape(SOLAR_HEATER_RING_1, (new String[][]{
+ {
+ " ggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_2, (new String[][]{
+ {
+ " ggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_3, (new String[][]{
+ {
+ " ggggggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_4, (new String[][]{
+ {
+ " ggggggggggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggggggggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_5, (new String[][]{
+ {
+ " ggggggggggggggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggggggggggggggg ",
+ }}))
+
+ .addElement('g', lazy(t -> ofHatchAdder(GregtechMetaTileEntity_SolarTower::addSolarHeater, 0, 1)))
+ .addElement('t', lazy(t -> onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta()))))
+ .addElement('i', lazy(t -> onElementPass(x -> ++x.mCasing2, ofBlock(t.getCasingBlock(), t.getCasingMeta2()))))
+ .addElement('s', lazy(t -> onElementPass(x -> ++x.mCasing3, ofBlock(t.getCasingBlock(), t.getCasingMeta3()))))
+ .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing4, ofBlock(t.getCasingBlock2(), t.getCasingMeta4()))))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_SolarTower::addGenericHatch, t.getCasingTextureIndex(), 2),
+ onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta())))))
+
+
+ .build();
+ }
+ };
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ resetSolarHeaters();
+ this.mMaintenanceHatches.clear();
+ this.mInputHatches.clear();
+ this.mOutputHatches.clear();
+ mCasing1 = 0;
+ mCasing2 = 0;
+ mCasing3 = 0;
+ mCasing4 = 0;
+
+ boolean aStructureTop = checkPiece(STRUCTURE_PIECE_TOP, 2, 2, 0);
+ log("Top Check: "+aStructureTop);
+ boolean aStructureTower = checkPiece(STRUCTURE_PIECE_TOWER, 1, 1, -7);
+ log("Tower Check: "+aStructureTower);
+ boolean aStructureBase = checkPiece(STRUCTURE_PIECE_BASE, 5, 5, -22);
+ log("Base Check: "+aStructureBase);
+ boolean aCasingCount1 = mCasing1 >= 229;
+ boolean aCasingCount2 = mCasing2 == 60;
+ boolean aCasingCount3 = mCasing3 == 66;
+ boolean aCasingCount4 = mCasing4 == 60;
+ boolean aAllStructure = aStructureTop && aStructureTower && aStructureBase;
+ boolean aAllCasings = aCasingCount1 && aCasingCount2 && aCasingCount3 && aCasingCount4;
+ if (!aAllCasings || !aAllStructure ||
+ mMaintenanceHatches.size() != 1 ||
+ mInputHatches.size() < 1 ||
+ mOutputHatches.size() < 1
+ ) {
+ log("Bad Hatches - Solar Heaters: "+mSolarHeaters.size()+
+ ", Maint: "+mMaintenanceHatches.size()+
+ ", Input Hatches: "+mInputHatches.size()+
+ ", Output Hatches: "+mOutputHatches.size()+
+ ", Top: "+aStructureTop+
+ ", Tower: "+aStructureTower+
+ ", Base: "+aStructureBase+
+ ", Casing Count: "+aCasingCount1+" | Found: "+mCasing1+
+ ", Casing Count: "+aCasingCount2+" | Found: "+mCasing2+
+ ", Casing Count: "+aCasingCount3+" | Found: "+mCasing3+
+ ", Casing Count: "+aCasingCount4+" | Found: "+mCasing4);
+ return false;
+ }
+ log("Built "+this.getLocalName()+" with "+mCasing1+" Structural Solar casings, "+mCasing2+" Thermally Insulated casings, "+mCasing3+" Salt Containment casings, "+mCasing4+" Thermal Containment casings.");
+ return aAllCasings && aAllStructure;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ // Tower
+ buildPiece(STRUCTURE_PIECE_TOP, stackSize, hintsOnly, 2, 2, 0);
+ buildPiece(STRUCTURE_PIECE_TOWER, stackSize, hintsOnly, 1, 1, -7);
+ buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 5, 5, -22);
+
+ //Solar Heaters
+ if (stackSize.stackSize >= 1) {
+ buildPiece(SOLAR_HEATER_RING_1, stackSize, hintsOnly, 7, 7, -27);
+ if (stackSize.stackSize >= 2) {
+ buildPiece(SOLAR_HEATER_RING_2, stackSize, hintsOnly, 9, 9, -27);
+ if (stackSize.stackSize >= 3) {
+ buildPiece(SOLAR_HEATER_RING_3, stackSize, hintsOnly, 11, 11, -27);
+ if (stackSize.stackSize >= 4) {
+ buildPiece(SOLAR_HEATER_RING_4, stackSize, hintsOnly, 13, 13, -27);
+ if (stackSize.stackSize >= 5) {
+ buildPiece(SOLAR_HEATER_RING_5, stackSize, hintsOnly, 15, 15, -27);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_SolarTower> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
+
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
}
- return new String[]{
- "Contributing Green Energy towards the future",
- mCasingName+"s for the base of the tower",
- };
+ log("Bad Hatch");
+ return false;
}
@Override
@@ -76,10 +397,10 @@ extends GregtechMeta_MultiBlockBase {
@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == 0 || aSide == 1) {
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6)),
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)),
new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
}
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6))};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12))};
}
@Override
@@ -97,68 +418,174 @@ extends GregtechMeta_MultiBlockBase {
return null;
}
- @Override
- public boolean isFacingValid(final byte aFacing) {
- return aFacing <= 1;
- }
-
- private Set<String> mCachedReflectors = new HashSet<String>();
-
- public Set<String> getConnectedSolarReflectors(){
- Set<String> mValidTilePositions = new HashSet<String>();
- IGregTechTileEntity tTileEntity;
- Map<String, BlockPos> mFastMap = new HashMap<String, BlockPos>();
- for (int x = -64; x <= 64; x++) {
- for (int z = -64; z <= 64; z++) {
- int aX, aY, aZ;
- aX = this.getBaseMetaTileEntity().getXCoord();
- aY = this.mHeight;
- aZ = this.getBaseMetaTileEntity().getZCoord();
- BlockPos b = new BlockPos(aX+x, aY, aZ+z, this.getBaseMetaTileEntity().getWorld());
-
- tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX + x, this.mHeight, aZ + z);
- if (tTileEntity == null) {
- continue;
- }
- else {
- Logger.INFO("Found Tile Entity at "+b.getLocationString());
- if (tTileEntity.getMetaTileEntity() instanceof TileEntitySolarHeater) {
- TileEntitySolarHeater mTile = (TileEntitySolarHeater) tTileEntity.getMetaTileEntity();
- if (mTile != null) {
- b = new BlockPos(tTileEntity.getXCoord(), tTileEntity.getYCoord(), tTileEntity.getZCoord(), tTileEntity.getWorld());
- if (!mTile.mHasTower || mTile.mSolarTower == null) {
- Logger.INFO("Found Solar Reflector, Injecting Data.");
- mTile.setSolarTower(b);
- }
- mFastMap.put(b.getUniqueIdentifier(), b);
- }
- }
- else {
- continue;
- }
- }
+ private int getHeaterTier() {
+ int aSolarHeaterCounter = this.mSolarHeaters.size();
+ if (aSolarHeaterCounter > 0) {
+ if (aSolarHeaterCounter == 36) {
+ return 1;
+ }
+ else if (aSolarHeaterCounter == 88) {
+ return 2;
+ }
+ else if (aSolarHeaterCounter == 156) {
+ return 4;
+ }
+ else if (aSolarHeaterCounter == 240) {
+ return 8;
+ }
+ else if (aSolarHeaterCounter == 340) {
+ return 16;
+ }
+ }
+ return 0;
+ }
+
+ private int getHeaterCountForTier(int aTier) {
+ switch (aTier) {
+ case 1:
+ return 36;
+ case 2:
+ return 88;
+ case 4:
+ return 156;
+ case 8:
+ return 240;
+ case 16:
+ return 340;
+ default:
+ return 0;
+ }
+ }
- if (addToMachineList(tTileEntity, mCasingTextureID)) {
- continue;
- }
- }
+ public boolean getConnectedSolarReflectors(){
+
+ this.mSolarHeaters.clear();
+ int aRing = 1;
+
+ if (this.mSolarHeaters.size() < 36) {
+ // 15x15
+ boolean aRing1 = checkPiece(SOLAR_HEATER_RING_1, 7, 7, -27);
+ if (aRing1) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ if (this.mSolarHeaters.size() < 88) {
+ // 17x17
+ boolean aRing2 = checkPiece(SOLAR_HEATER_RING_2, 9, 9, -27);
+ if (aRing2) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
}
+ if (this.mSolarHeaters.size() < 156) {
+ // 19x19
+ boolean aRing3 = checkPiece(SOLAR_HEATER_RING_3, 11, 11, -27);
+ if (aRing3) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ if (this.mSolarHeaters.size() < 240) {
+ // 21x21
+ boolean aRing4 = checkPiece(SOLAR_HEATER_RING_4, 13, 13, -27);
+ if (aRing4) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ if (this.mSolarHeaters.size() < 340) {
+ // 23x23
+ boolean aRing5 = checkPiece(SOLAR_HEATER_RING_5, 15, 15, -27);
+ if (aRing5) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ return mSolarHeaters.size() > 0;
+ }
- for (BlockPos p : mFastMap.values()) {
- if (mValidTilePositions.add(p.getUniqueIdentifier()));
+ private boolean addSolarHeater(IGregTechTileEntity aTileEntity, int a) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof TileEntitySolarHeater) {
+ TileEntitySolarHeater mTile = (TileEntitySolarHeater) aMetaTileEntity;
+ if (mTile != null) {
+ if (!mTile.hasSolarTower() && mTile.canSeeSky()) {
+ //Logger.INFO("Found Solar Reflector, Injecting Data.");
+ mTile.setSolarTower(this);
+ return this.mSolarHeaters.add(mTile);
+ }
+ }
+ }
}
- mCachedReflectors = mValidTilePositions;
- return mCachedReflectors;
+ return false;
}
+
+ private Fluid mColdSalt = null;
+ private Fluid mHotSalt = null;
@Override
- public boolean checkRecipe(final ItemStack aStack) {
- //this.mEfficiencyIncrease = 100;
- //this.mMaxProgresstime = 100;
- //this.mEUt = -4;
+ public boolean checkRecipe(final ItemStack aStack) {
+ this.mEfficiencyIncrease = 10;
+ this.mMaxProgresstime = 100;
+
+ if (this.mSolarHeaters.isEmpty() || this.mSolarHeaters.size() < 340 || this.getTotalRuntimeInTicks() % 200 == 0) {
+ getConnectedSolarReflectors();
+ }
+
+ int aTier = getHeaterTier();
+ int aHeaters = getHeaterCountForTier(aTier);
+
+ //Manage Heat every 5s
+ //Add Heat First, if sources available
+ if (aHeaters > 0) {
+ for (int i = 0; i < aHeaters; i++) {
+ Math.min((this.mHeatLevel += aTier), 20000);
+ }
+ }
+
+ //Remove Heat, based on time of day
+ if (mHeatLevel > 0) {
+ if (mHeatLevel > 20000) {
+ this.mHeatLevel = 20000;
+ }
+ }
+ World w = this.getBaseMetaTileEntity().getWorld();
+ if (w != null) {
+ int aRemovalFactor = 0;
+ if (w.isDaytime()) {
+ aRemovalFactor = 1;
+ }
+ else {
+ aRemovalFactor = 8;
+ }
+ for (int i = 0; i<MathUtils.randInt((aHeaters/10), aHeaters); i++){
+ this.mHeatLevel -= aRemovalFactor;
+ }
+ }
+
+ if (this.mEfficiency == this.getMaxEfficiency(null) && this.mHeatLevel >= 10000) {
+ if (mColdSalt == null) {
+ mColdSalt = MISC_MATERIALS.SOLAR_SALT_COLD.getFluid();
+ }
+ if (mHotSalt == null) {
+ mHotSalt = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid();
+ }
+ ArrayList<FluidStack> aFluids = this.getStoredFluids();
+ for (FluidStack aFluid : aFluids) {
+ if (aFluid.getFluid().equals(mColdSalt)) {
+ if (aFluid.amount >= (aTier * 1000)) {
+ this.depleteInput(FluidUtils.getFluidStack(mColdSalt, (aTier * 1000)));
+ this.addOutput(FluidUtils.getFluidStack(mHotSalt, (aTier * 1000)));
+ break;
+ }
+ }
+ }
+ }
+
+
return true;
}
-
+
@Override
public int getMaxParallelRecipes() {
return 1;
@@ -175,27 +602,6 @@ extends GregtechMeta_MultiBlockBase {
}
@Override
- public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- this.mHeight = 0;
- for (int i = 0; i <= 19; i++) {
- if (!checkLayer(i)) {
- Logger.INFO("Invalid Structure on Y level "+i);
- return false;
- }
- }
- if (mMaintenanceHatches.size() != 1) {
- Logger.INFO("Bad Hatches");
- return false;
- }
-
- this.mHeight = this.getBaseMetaTileEntity().getYCoord() - 19;
- Logger.INFO("Built Structure");
- if (!aBaseMetaTileEntity.getWorld().isRemote)
- getConnectedSolarReflectors();
- return true;
- }
-
- @Override
public int getMaxEfficiency(final ItemStack aStack) {
return 10000;
}
@@ -216,36 +622,29 @@ extends GregtechMeta_MultiBlockBase {
}
public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
+ return ModBlocks.blockSpecialMultiCasings;
}
+ public Block getCasingBlock2() {
+ return ModBlocks.blockCasings2Misc;
+ }
public byte getCasingMeta() {
- return 4;
+ return 6;
}
public byte getCasingMeta2() {
- return 5;
+ return 8;
}
public byte getCasingMeta3() {
- return 6;
+ return 7;
}
- public boolean isValidCasingBlock(Block aBlock, int aMeta) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
- return true;
- }
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- return true;
- }
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- return true;
- }
- Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + "With Meta "+aMeta);
- return false;
+ public byte getCasingMeta4() {
+ return 11;
}
public byte getCasingTextureIndex() {
@@ -254,7 +653,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (this.mHeight > 3) {}
+
}
@@ -262,441 +661,48 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- aNBT.setInteger("mHeight", mHeight);
aNBT.setInteger("mHeatLevel", mHeatLevel);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- mHeight = aNBT.getInteger("mHeight");
mHeatLevel = aNBT.getInteger("mHeatLevel");
}
- public boolean checkLayer(int aY) {
- if (aY >= 0 && aY <= 6) {
- return checkTopLayers(-aY);
- }
- if (aY >= 7 && aY <= 16) {
- return checkTowerLayer(-aY);
- }
- else if (aY >= 17 && aY <= 19) {
- return checkBaseLayer(-aY);
- }
- Logger.INFO("Bad Y level to check");
- return false;
- }
-
- public boolean checkTopLayers(int aY) {
- Block aBlock;
- int aMeta;
-
- if (aY == 0) {
- return true;
- } else if (aY == -1) {
- for (int x = -1; x <= 1; x++) {
- for (int z = -1; z <= 1; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- } else if (aY == -2 || aY == -6) {
- for (int x = -2; x <= 2; x++) {
- for (int z = -2; z <= 2; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- //Edge Casing
- if (x == -2 || x == 2 || z == -2 || z == 2) {
- //Edge Corners
- if ((x == 2 || x == -2) && (z == 2 | z == -2)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else {
- //Edge Sides
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
-
- //Internal
- else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- }
- //Top Layers 7x7
- else if (aY == -3 || aY == -5) {
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- //Edge Casing
- if (x == -3 || x == 3 || z == -3 || z == 3) {
-
- //3, 3
- //2, 3
- //3, 2
-
- //Air Spacing
- if (x == 3 && (z == -3 || z == -2 || z == 2 || z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else if (x == -3 && (z == -3 || z == -2 || z == 2 || z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else if (z == 3 && (x == -3 || x == -2 || x == 2 || x == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else if (z == -3 && (x == -3 || x == -2 || x == 2 || x == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else {
- //Edge Sides
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- else if ((x == -2 || x == 2) & (z == -2 || z == 2)) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- //Internal
- else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- }
- //Midle Top Layer 9x9
- else if (aY == -4) {
- //Check Inner 5x5
- for (int x = -2; x <= 2; x++) {
- for (int z = -2; z <= 2; z++) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, z) != getCasingBlock() && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z) != getCasingMeta2()) {
- Logger.INFO("Error at offset: X:" + x + ", Y:" + aY + ", Z:" + z);
- return false;
- }
- else {
- continue;
- }
- }
- }
- //Check Pos Sides
- for (int z = -1; z <= -1; z++) {
- if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta2()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
- return false;
- }
-
- }
- for (int x = -1; x <= -1; x++) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta2()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
- return false;
- }
- }
-
- //Corner Casings
- for (int z = -2; z <= -2; z++) {
- if (z == -2 || z == 2) {
- if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("2 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
- return false;
- }
- }
- }
- for (int x = -2; x <= -2; x++) {
- if (x == -2 || x == 2) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("2 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
- return false;
- }
- }
- }
- //Check Sides Casings
- for (int z = -1; z <= -1; z++) {
- if (getBaseMetaTileEntity().getBlockOffset(4, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(4, aY, z) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(-4, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(-4, aY, z) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
- return false;
- }
-
- }
- for (int x = -1; x <= -1; x++) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, 4) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 4) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -4) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -4) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
- return false;
- }
- }
- }
- return true;
- }
-
- public boolean checkTowerLayer(int aY) {
- Block aBlock;
- int aMeta;
- for (int x = -1; x <= 1; x++) {
- for (int z = -1; z <= 1; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- if (x == -1 || x == 1 || z == -1 || z == 1) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Externally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- } else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- return true;
- }
-
- public boolean checkBaseLayer(int aY) {
- Block aBlock;
- int aMeta;
-
- int requiredMeta = getCasingMeta2();
- if (aY == -19) {
- requiredMeta = getCasingMeta();
- }
-
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
-
- if ((x == 3 && z == 3) || (x == 2 && z == 2) || (x == 3 && z == 2) || (x == 2 && z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else if ((x == -3 && z == -3) || (x == -2 && z == -2) || (x == -3 && z == -2) || (x == -2 && z == -3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else if ((x == -3 && z == 3) || (x == -2 && z == 2) || (x == -3 && z == 2) || (x == -2 && z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else if ((x == 3 && z == -3) || (x == 2 && z == -2) || (x == 3 && z == -2) || (x == 2 && z == -3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else {
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (addToMachineList(tTileEntity, mCasingTextureID)) {
- continue;
- }
- if (x == 0 && z == 0) {
- if (aBlock == getCasingBlock() && aMeta == requiredMeta) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- }
- return true;
- }
-
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
-
- //Add Heat every second
- if (aTick % 20 == 0) {
-
- //Add Heat First, if sources available
- int aCacheSize = this.mCachedReflectors.size();
- if (aCacheSize > 0) {
- int aCount = aCacheSize;
- for (int i = 0; i < aCount; i++) {
- this.mHeatLevel++;
- }
- }
-
- //Remove Heat, based on time of day
- World w = this.getBaseMetaTileEntity().getWorld();
- if (w != null) {
- int aRemovalFactor = 0;
- if (w.isDaytime()) {
- aRemovalFactor = 1;
- }
- else {
- aRemovalFactor = 3;
- }
- for (int i = 0; i<MathUtils.randInt((aCacheSize/10), (aCacheSize*10)); i++){
- this.mHeatLevel -= aRemovalFactor;
- }
- }
- }
}
@Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- if (this.mCachedReflectors.isEmpty()) {
- if (aTick % (30*20) == 0) {
- this.getConnectedSolarReflectors();
- }
- }
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
}
@Override
public void onRemoval() {
- this.mCachedReflectors.clear();
+ resetSolarHeaters();
super.onRemoval();
}
+ private void resetSolarHeaters() {
+ for (TileEntitySolarHeater aTile : this.mSolarHeaters) {
+ aTile.clearSolarTower();
+ }
+ this.mSolarHeaters.clear();
+ }
+
@Override
public String[] getExtraInfoData() {
return new String[] {
"Internal Heat Level: "+this.mHeatLevel,
- "Connected Solar Reflectors: "+this.mCachedReflectors.size()
+ "Connected Solar Reflectors: "+this.mSolarHeaters.size()
};
}
-
-
-
-
-
-
-
-
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
index 4759457d8d..d3db328bd4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
@@ -42,7 +42,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
+public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase<GregtechMTE_AlgaePondBase> {
private int mLevel = -1;
private int mCasing;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
index 4a01809ac7..daad2f50da 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -585,7 +585,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
// Based on the Processing Array. A bit overkill, but very flexible.
@@ -609,7 +609,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
}
// checks if it has a catalyst
- ItemStack tCatalystRecipe = findCatalyst(aItemInputs);
+ ItemStack tCatalystRecipe = null;
boolean aDoesRecipeNeedCatalyst = false;
for (ItemStack aInputItem : tRecipe.mInputs) {
if (ItemUtils.isCatalyst(aInputItem)) {
@@ -618,6 +618,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
}
}
if (aDoesRecipeNeedCatalyst) {
+ tCatalystRecipe = findCatalyst(aItemInputs, tRecipe.mInputs);
if (tCatalystRecipe == null) {
log("does not have catalyst");
return false;
@@ -959,12 +960,16 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
return allowedParallel;
}
- private ItemStack findCatalyst(ItemStack[] aItemInputs) {
+ private ItemStack findCatalyst(ItemStack[] aItemInputs, ItemStack[] aRecipeInputs) {
if (aItemInputs != null) {
for (final ItemStack aInput : aItemInputs) {
if (aInput != null) {
if (ItemUtils.isCatalyst(aInput)) {
- return aInput;
+ for (ItemStack aRecipeInput : aRecipeInputs) {
+ if (GT_Utility.areStacksEqual(aRecipeInput, aInput, true)) {
+ return aInput;
+ }
+ }
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java
new file mode 100644
index 0000000000..6221dba89d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java
@@ -0,0 +1,170 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import static gtPlusPlus.core.lib.CORE.RANDOM;
+
+import java.util.ArrayList;
+
+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_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+@SuppressWarnings("deprecation")
+public class GT_MTE_LargeTurbine_Gas extends GregtechMetaTileEntity_LargerTurbineBase {
+
+ public GT_MTE_LargeTurbine_Gas(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+
+ public GT_MTE_LargeTurbine_Gas(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MTE_LargeTurbine_Gas(mName);
+ }
+
+ @Override
+ public int getCasingMeta() {
+ return 3;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 58;
+ }
+
+
+ @Override
+ protected boolean requiresOutputHatch() {
+ return false;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return 5000;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid == null) {
+ return 0;
+ }
+ GT_Recipe tFuel = GT_Recipe_Map.sTurbineFuels.findFuel(aLiquid);
+ if (tFuel != null) {
+ return tFuel.mSpecialValue;
+ }
+ return 0;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+ if (aFluids.size() >= 1) {
+ int tEU = 0;
+ int actualOptimalFlow = 0;
+
+ FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
+ int fuelValue = getFuelValue(firstFuelType);
+ //log("Fuel Value of "+aFluids.get(0).getLocalizedName()+" is "+fuelValue+"eu");
+ if (aOptFlow < fuelValue) {
+ // turbine too weak and/or fuel too powerful
+ // at least consume 1L
+ this.realOptFlow = 1;
+ // wastes the extra fuel and generate aOptFlow directly
+ depleteInput(new FluidStack(firstFuelType, 1));
+ this.storedFluid += 1;
+ return GT_Utility.safeInt((long) aOptFlow * (long) aBaseEff / 10000L);
+ }
+
+ actualOptimalFlow = GT_Utility.safeInt((long) aOptFlow / fuelValue);
+ this.realOptFlow = actualOptimalFlow;
+
+ int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
+ int flow = 0;
+ int totalFlow = 0;
+
+ storedFluid = 0;
+ for (FluidStack aFluid : aFluids) {
+ if (aFluid.isFluidEqual(firstFuelType)) {
+ flow = Math.min(aFluid.amount, remainingFlow); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
+ depleteInput(new FluidStack(aFluid, flow)); // deplete that amount
+ this.storedFluid += aFluid.amount;
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ }
+ }
+ if (totalFlow <= 0) return 0;
+ tEU = GT_Utility.safeInt((long) totalFlow * fuelValue);
+
+ //log("Total Flow: "+totalFlow);
+ //log("Real Optimal Flow: "+actualOptimalFlow);
+ //log("Flow: "+flow);
+ //log("Remaining Flow: "+remainingFlow);
+
+ if (totalFlow == actualOptimalFlow) {
+ tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L);
+ } else {
+ float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow);
+ tEU *= efficiency;
+ tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L);
+ }
+
+ return tEU;
+
+ }
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return (RANDOM.nextInt(4) == 0) ? 0 : 1;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Large Gas Turbine";
+ }
+
+ @Override
+ protected String getTurbineType() {
+ return "Gas";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced Gas Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java
new file mode 100644
index 0000000000..20a8d7e964
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java
@@ -0,0 +1,262 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import java.util.ArrayList;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+@SuppressWarnings("deprecation")
+public class GT_MTE_LargeTurbine_Plasma extends GregtechMetaTileEntity_LargerTurbineBase {
+
+ public GT_MTE_LargeTurbine_Plasma(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+
+ public GT_MTE_LargeTurbine_Plasma(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MTE_LargeTurbine_Plasma(mName);
+ }
+
+ @Override
+ public int getCasingMeta() {
+ return 4;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 60;
+ }
+
+ @Override
+ protected boolean requiresOutputHatch() {
+ return true;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid == null) {
+ return 0;
+ }
+ GT_Recipe tFuel = GT_Recipe_Map.sPlasmaFuels.findFuel(aLiquid);
+ if (tFuel != null) {
+ return tFuel.mSpecialValue;
+ }
+ return 0;
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+
+ try {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies();
+ if (aEmptyTurbineRotorHatches.size() > 0) {
+ log("Found "+aEmptyTurbineRotorHatches.size()+" Assemblies without Turbine.");
+ ArrayList<ItemStack> aTurbines = getAllBufferedTurbines();
+ hatch : for (GT_MetaTileEntity_Hatch_Turbine aHatch : aEmptyTurbineRotorHatches) {
+ for (ItemStack aTurbineItem : aTurbines) {
+ if (aTurbineItem == null) {
+ continue;
+ }
+ if (aTurbineItem != null && aHatch.insertTurbine(aTurbineItem.copy())) {
+ boolean aDidDeplete = depleteTurbineFromStock(aTurbineItem);
+ log("Put Turbine into Assembly - "+aDidDeplete);
+ continue hatch;
+ }
+ }
+ }
+ }
+ //log("Found "+getFullTurbineAssemblies().size()+" Assemblies with a Turbine.");
+
+ if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) {
+ log("BAD RETURN - 1");
+ stopMachine();
+ return false;
+ }
+
+ //log("Running checkRecipeGeneric(0)");
+
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+
+ if (tFluids.size() > 0) {
+ if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
+ || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
+ counter = 0;
+ float aTotalBaseEff = 0;
+ float aTotalOptimalFlow = 0;
+ ItemStack aStack = getFullTurbineAssemblies().get(0).getTurbine();
+ for (int i=0;i<18;i++) {
+ if (i == 0) {
+ aTotalBaseEff += GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
+ }
+ aTotalOptimalFlow += GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL,
+ ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
+ * 50));
+ }
+
+ baseEff = MathUtils.roundToClosestInt(aTotalBaseEff);
+ optFlow = MathUtils.roundToClosestInt(aTotalOptimalFlow);
+ if(optFlow<=0 || baseEff<=0){
+ log("Running checkRecipeGeneric(bad-1)");
+ stopMachine();//in case the turbine got removed
+ return false;
+ }
+ } else {
+ counter++;
+ }
+ }
+
+ // How much the turbine should be producing with this flow
+ int newPower = fluidIntoPower(tFluids, optFlow, baseEff);
+ int difference = newPower - this.mEUt; // difference between current output and new output
+
+ // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
+ // This is how much the turbine can actually change during this tick
+ int maxChangeAllowed = Math.max(200, GT_Utility.safeInt((long) Math.abs(difference) / 5));
+
+ if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
+ int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
+ this.mEUt += change; // Apply the change
+ }
+ else {
+ this.mEUt = newPower;
+ }
+ if (this.mEUt <= 0) {
+ this.mEUt=0;
+ this.mEfficiency=0;
+ log("Running checkRecipeGeneric(bad-2)");
+ return false;
+ } else {
+ this.mMaxProgresstime = 20;
+ this.mEfficiencyIncrease = 200;
+ // Overvoltage is handled inside the MultiBlockBase when pushing out to dynamos. no need to do it here.
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+ //log("GOOD RETURN - Making: "+this.mEUt+" EU/t");
+ return true;
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+ if (aFluids.size() >= 1) {
+ aOptFlow *= 800;//CHANGED THINGS HERE, check recipe runs once per 20 ticks
+ int tEU = 0;
+
+ int actualOptimalFlow = 0;
+
+ FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
+ int fuelValue = getFuelValue(firstFuelType);
+ actualOptimalFlow = GT_Utility.safeInt((long) Math.ceil((double) aOptFlow / (double) fuelValue));
+ this.realOptFlow = actualOptimalFlow; // For scanner info
+
+ int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
+ int flow = 0;
+ int totalFlow = 0;
+
+ storedFluid = 0;
+ for (FluidStack aFluid : aFluids) {
+ if (aFluid.isFluidEqual(firstFuelType)) {
+ flow = Math.min(aFluid.amount, remainingFlow); // try to use up w/o exceeding remainingFlow
+ depleteInput(new FluidStack(aFluid, flow)); // deplete that amount
+ this.storedFluid += aFluid.amount;
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ }
+ }
+ String fn = FluidRegistry.getFluidName(firstFuelType);
+ String[] nameSegments = fn.split("\\.", 2);
+ if (nameSegments.length == 2) {
+ String outputName = nameSegments[1];
+ FluidStack output = FluidRegistry.getFluidStack(outputName, totalFlow);
+ if (output == null) {
+ output = FluidRegistry.getFluidStack("molten." + outputName, totalFlow);
+ }
+ if (output != null) {
+ addOutput(output);
+ }
+ }
+ if (totalFlow <= 0) return 0;
+ tEU = GT_Utility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow));
+
+ //GT_FML_LOGGER.info(totalFlow+" : "+fuelValue+" : "+aOptFlow+" : "+actualOptimalFlow+" : "+tEU);
+
+ if (totalFlow == actualOptimalFlow) {
+ tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU));
+ } else {
+ double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow);
+
+ tEU = (int) (tEU * efficiency);
+ tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU));
+ }
+
+ return tEU;
+
+ }
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Large Plasma Turbine";
+ }
+
+
+ @Override
+ protected String getTurbineType() {
+ return "Plasma";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced Plasma Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
index f52f02b5de..d1e3e35938 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
@@ -1,23 +1,22 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
import java.util.ArrayList;
import gregtech.GT_Mod;
+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_ModHandler;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
+@SuppressWarnings("deprecation")
public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTurbineBase {
public boolean achievement = false;
@@ -31,36 +30,14 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
super(aName);
}
- public String[] getTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 9);
- }
- return new String[]{
- "Controller Block for the XL High Pressure Steam Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Superheated Steam Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "1x Output Hatch for Steam (Side centered)",
- mCasingName+"s for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Output depending on Rotor and fitting",
- "Use screwdriver to adjust fitting of turbine"};
- }
-
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MTE_LargeTurbine_SHSteam(mName);
}
@Override
- public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
- }
-
- @Override
- public byte getCasingMeta() {
- return 9;
+ public int getCasingMeta() {
+ return 2;
}
@Override
@@ -68,11 +45,21 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
return 59;
}
+ @Override
+ protected boolean requiresOutputHatch() {
+ return true;
+ }
+
@Override
- public int getPollutionPerTick(ItemStack aStack) {
+ public int getPollutionPerSecond(ItemStack aStack) {
return 0;
}
+ @Override
+ public int getFuelValue(FluidStack aLiquid) {
+ return 0;
+ }
+
@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
if(looseFit) {
@@ -142,11 +129,9 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
return (looseFit && CORE.RANDOM.nextInt(4)==0)?0:1;
}
- @Override
- public String[] getExtraInfoData() {
- super.looseFit = looseFit;
- return super.getInfoData();
- }
+ public boolean isLooseMode() {
+ return looseFit;
+ }
@Override
public void saveNBTData(NBTTagCompound aNBT) {
@@ -161,11 +146,6 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
}
@Override
- public boolean hasSlotInGUI() {
- return true;
- }
-
- @Override
public String getCustomGUIResourceName() {
return null;
}
@@ -175,5 +155,24 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
return "Large Super-heated Steam Turbine";
}
+ @Override
+ protected String getTurbineType() {
+ return "Super-heated Steam";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced HP Steam Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5);
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
index 2e6f6149e7..f285d3e8de 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
@@ -1,4 +1,3 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
import static gtPlusPlus.core.lib.CORE.RANDOM;
@@ -6,19 +5,19 @@ import static gtPlusPlus.core.lib.CORE.RANDOM;
import java.util.ArrayList;
import gregtech.GT_Mod;
+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_ModHandler;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
+@SuppressWarnings("deprecation")
public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurbineBase {
private float water;
@@ -34,36 +33,14 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
super(aName);
}
- public String[] getTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 8);
- }
- return new String[]{
- "Controller Block for the XL Steam Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Steam Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "1x Output Hatch for Distilled Water (Side centered)",
- mCasingName+"s for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Output depending on Rotor and fitting",
- "Use screwdriver to adjust fitting of turbine"};
- }
-
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MTE_LargeTurbine_Steam(mName);
}
@Override
- public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
- }
-
- @Override
- public byte getCasingMeta() {
- return 8;
+ public int getCasingMeta() {
+ return 1;
}
@Override
@@ -71,8 +48,13 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
return 16;
}
+ @Override
+ protected boolean requiresOutputHatch() {
+ return true;
+ }
+
@Override
- public int getPollutionPerTick(ItemStack aStack) {
+ public int getPollutionPerSecond(ItemStack aStack) {
return 0;
}
@@ -82,6 +64,10 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
water = water - usage;
return usage;
}
+
+ public int getFuelValue(FluidStack aLiquid) {
+ return 0;
+ }
@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
@@ -149,13 +135,10 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
public int getDamageToComponent(ItemStack aStack) {
return (looseFit && RANDOM.nextInt(4)==0)?0:1;
}
-
-
- @Override
- public String[] getExtraInfoData() {
- super.looseFit = looseFit;
- return super.getInfoData();
- }
+
+ public boolean isLooseMode() {
+ return looseFit;
+ }
@Override
public void saveNBTData(NBTTagCompound aNBT) {
@@ -170,12 +153,6 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
}
@Override
- public boolean hasSlotInGUI() {
- return true;
- }
-
-
- @Override
public String getCustomGUIResourceName() {
return null;
}
@@ -185,5 +162,24 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
return "Large Steam Turbine";
}
+ @Override
+ protected String getTurbineType() {
+ return "Steam";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced Steam Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5);
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
index 9da724c6eb..4b2f60abd1 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
@@ -1,10 +1,17 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import java.util.ArrayList;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.TAE;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
@@ -13,374 +20,577 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.core.util.sys.KeyboardUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
-public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechMeta_MultiBlockBase {
+public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargerTurbineBase> {
protected int baseEff = 0;
protected int optFlow = 0;
protected double realOptFlow = 0;
protected int storedFluid = 0;
protected int counter = 0;
- protected boolean looseFit=false;
+ protected int mCasing;
+
+ public ITexture frontFace;
+ public ITexture frontFaceActive;
+
+
+ public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
- private final int mCasingTextureID;
- public static String mCasingName;
-
- public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
- mCasingTextureID = getTAE();
- GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4;
- GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4;
- frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
- frontFace = new GT_RenderedTexture(GT9_5);
-
+ frontFace = getTextureFrontFace();
+ frontFaceActive = getTextureFrontFaceActive();
+
}
public GregtechMetaTileEntity_LargerTurbineBase(String aName) {
super(aName);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
- mCasingTextureID = getTAE();
- GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4;
- GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4;
- frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
- frontFace = new GT_RenderedTexture(GT9_5);
+ frontFace = getTextureFrontFace();
+ frontFaceActive = getTextureFrontFaceActive();
}
- public final int getTAE() {
- return TAE.getIndexFromPage(3, getCasingMeta());
- }
- public final String getCasingNaming() {
- return ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
- }
+ protected abstract ITexture getTextureFrontFace();
+
+ protected abstract ITexture getTextureFrontFaceActive();
+
+ protected abstract String getTurbineType();
+
+ protected abstract String getCasingName();
+
+ protected abstract boolean requiresOutputHatch();
@Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return getMaxEfficiency(aStack) > 0;
- }
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the XL "+getTurbineType()+" Turbine")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 9, 3, false)
+ .addController("Top Middle")
+ .addCasingInfo(getCasingName(), 360)
+ .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1)
+ .addInputBus("Any 4 dot hint (min 1)", 4)
+ .addInputHatch("Any 4 dot hint(min 1)", 4);
+ if (requiresOutputHatch()) {
+ tt.addOutputHatch("Any 4 dot hint(min 1)", 4);
+ }
+ tt.addDynamoHatch("Any 4 dot hint(min 1)", 4)
+ .addMaintenanceHatch("Any 4 dot hint(min 1)", 4);
+ if (requiresMufflers()) {
+ tt.addMufflerHatch("Any 7 dot hint (x4)", 7);
+ }
+ tt.toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase>>() {
+ @Override
+ protected IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase> computeValue(Class<?> type) {
+ return StructureDefinition.<GregtechMetaTileEntity_LargerTurbineBase>builder()
+ // c = turbine casing
+ // s = turbine shaft
+ // t = turbine housing
+ // h = dynamo/maint
+ // m = muffler
+ .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
+ {"ccchccc", "ccccccc", "ccmmmcc", "ccm~mcc", "ccmmmcc", "ccccccc", "ccchccc"},
+ {"ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ }))
+
+ .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(t.getCasingBlock(), t.getCasingMeta()))))
+ .addElement('s', lazy(t -> ofBlock(t.getCasingBlock(), t.getTurbineShaftMeta())))
+ .addElement('t', lazy(t -> ofHatchAdder(GregtechMetaTileEntity_LargerTurbineBase::addTurbineHatch, t.getCasingTextureIndex(), 1)))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_LargerTurbineBase::addGenericHatch, t.getCasingTextureIndex(), 4),
+ onElementPass(x -> ++x.mCasing, ofBlock(t.getCasingBlock(), t.getCasingMeta()))
+ )))
+ .addElement('m', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_LargerTurbineBase::addMuffler, t.getCasingTextureIndex(), 7),
+ onElementPass(x -> ++x.mCasing, ofBlock(t.getCasingBlock(), t.getCasingMeta())))))
+ .build();
+ }
+ };
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png");
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
}
- @Override
- public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- return checkMachine2(aBaseMetaTileEntity, aStack);
+ private boolean requiresMufflers() {
+ return getPollutionPerSecond(null) > 0;
}
- public boolean checkMachine2(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- //9 high
- //7x7
-
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
this.mDynamoHatches.clear();
this.mTurbineRotorHatches.clear();
this.mMaintenanceHatches.clear();
- this.mMufflerHatches.clear();
+ if (requiresMufflers()) {
+ this.mMufflerHatches.clear();
+ }
+ this.mInputBusses.clear();
this.mInputHatches.clear();
- this.mOutputHatches.clear();
-
- for (int i=0;i>-9;i--) {
- if (!getLayer(i)) {
- Logger.INFO("Bad Layer: "+(+i));
- return false;
- }
- }
-
- Logger.INFO("Hatches | Found "+mTurbineRotorHatches.size()+" Rotor Assemblies, "+12+" are required.");
- Logger.INFO("Hatches | Found "+mMaintenanceHatches.size()+" Maint. hatches, "+1+" are required.");
- Logger.INFO("Hatches | Found "+mDynamoHatches.size()+" Dynamos, "+1+" or more are required.");
- Logger.INFO("Hatches | Found "+mMufflerHatches.size()+" Mufflers, "+4+" are required.");
- Logger.INFO("Hatches | Found "+mInputHatches.size()+" Input Hatches, "+1+" or more are required.");
- Logger.INFO("Hatches | Found "+mOutputHatches.size()+" Output Hatches, "+1+" ore more are required.");
-
- if (mTurbineRotorHatches.size() != 12 ||
+ if (requiresOutputHatch()) {
+ this.mOutputHatches.clear();
+ }
+ mCasing = 0;
+
+ boolean aStructure = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0);
+ boolean aCasingCount = mCasing >= 360;
+ log("Structure Check: "+aStructure);
+ if (!aCasingCount ||
+ mTurbineRotorHatches.size() != 12 ||
mMaintenanceHatches.size() != 1 ||
mDynamoHatches.size() < 1 ||
- mMufflerHatches.size() != 4 ||
+ (requiresMufflers() && mMufflerHatches.size() != 4) ||
+ mInputBusses.size() < 1 ||
mInputHatches.size() < 1 ||
- mOutputHatches.size() < 1
+ (requiresOutputHatch() && mOutputHatches.size() < 1)
) {
+ log("Bad Hatches - Turbine Housings: "+mTurbineRotorHatches.size()+
+ ", Maint: "+mMaintenanceHatches.size()+
+ ", Dynamo: "+mDynamoHatches.size()+
+ ", Muffler: "+mMufflerHatches.size()+
+ ", Input Buses: "+mInputBusses.size()+
+ ", Input Hatches: "+mInputHatches.size()+
+ ", Output Hatches: "+mOutputHatches.size()+
+ ", Casing Count: "+aCasingCount+" | Found: "+mCasing);
return false;
- }
- Logger.INFO("Built Structure");
- return true;
+ }
+ log("Built "+this.getLocalName()+" with "+mCasing+"/360 casings.");
+ return aCasingCount && aStructure;
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 3, 3, 0);
+ }
- public boolean getLayer(int aY) {
- if (aY == 0 || aY == -2 || aY == -3 || aY == -5 || aY == -6 || aY == -8) {
- return checkNormalLayer(aY);
+ public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
}
- else {
- return checkTurbineLayer(aY);
- }
- }
-
- public boolean checkNormalLayer(int aY) {
- Block tBlock;
- int tMeta;
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- IGregTechTileEntity tTileEntity;
-
- if (aY == 0 && x == 0 && z == 0) {
- continue;
- }
- else if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
- ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
- tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
- Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
- continue;
- }
- }
- else if (isValidCasingBlock(tBlock, tMeta)) {
- continue;
- } else {
- if (tBlock != null) {
- log("Offset: "+x+", "+aY+", "+z);
- log("Found "+tBlock.getLocalizedName()+" with Meta "+tMeta);
- log("Expected "+getCasingBlock().getLocalizedName()+" with Meta "+getCasingMeta());
- }
- return false;
- }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
+ log("Found GT_MetaTileEntity_Hatch_Turbine");
+ updateTexture(aTileEntity, aBaseCasingIndex);
+ GT_MetaTileEntity_Hatch_Turbine aTurbineHatch = (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity;
+ IGregTechTileEntity g = this.getBaseMetaTileEntity();
+ if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) {
+ boolean aDidAdd = this.mTurbineRotorHatches.add(aTurbineHatch);
+ Logger.INFO("Injected Controller into Turbine Assembly. Found: "+this.mTurbineRotorHatches.size());
+ return aDidAdd;
+ }
+ else {
+ Logger.INFO("Failed to inject controller into Turbine Assembly Hatch.");
}
}
- return true;
+ log("Bad Turbine Housing");
+ return false;
}
-
- public boolean checkTurbineLayer(int aY) {
- if (!checkTurbineLayerX(aY)) {
- return checkTurbineLayerZ(aY);
+ public final boolean addMuffler(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
}
+ return false;
+ }
+
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
else {
- return true;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
}
+ log("Bad Hatch");
+ return false;
}
- public boolean checkTurbineLayerX(int aY) {
- Logger.INFO("checking X");
- Block tBlock;
- int tMeta;
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
- if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
- ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
- Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
- continue;
- }
- }
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png");
+ }
+ public boolean isValidCasingBlock(Block aBlock, int aMeta) {
+ if (Block.isEqualTo(aBlock, getCasingBlock()) && aMeta == getCasingMeta()) {
+ return true;
+ }return false;
+ }
- if (x == -2 || x == 2) {
-
- //Find Hatches on the ends
- if (z == -3 || z == 3) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) {
- log("Found x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- continue;
- }
- else {
- log("Missing x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- }
- }
-
- if (isValidTurbineBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
- }
- }
- else {
- if (isValidCasingBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
- }
- }
- }
- }
+ public boolean isValidTurbineShaft(Block aBlock, int aMeta) {
+ if (aBlock == getCasingBlock() && aMeta == getTurbineShaftMeta()) {
+ return true;
+ }
+ return false;
+ }
+
+ public final Block getCasingBlock() {
+ return ModBlocks.blockSpecialMultiCasings;
+ }
+
+ @Override
+ public final boolean hasSlotInGUI() {
return true;
}
- public boolean checkTurbineLayerZ(int aY) {
- Logger.INFO("checking Z");
- Block tBlock;
- int tMeta;
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
-
- if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
- ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
- Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
- continue;
- }
- }
+ public abstract int getCasingMeta();
- if (z == -2 || z == 2) {
-
- //Find Hatches on the ends
- if (x == -3 || x == 3) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) {
- log("Found z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- continue;
- }
- else {
- log("Missing z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- }
- }
-
- if (isValidTurbineBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
+ public byte getTurbineShaftMeta() {
+ return 0;
+ }
+
+ public abstract byte getCasingTextureIndex();
+
+ public abstract int getFuelValue(FluidStack aLiquid);
+
+ public static boolean isValidTurbine(ItemStack aTurbine) {
+ return (aTurbine !=null && aTurbine.getItem() instanceof GT_MetaGenerated_Tool && aTurbine.getItemDamage() >= 170 && aTurbine.getItemDamage() <= 176);
+ }
+
+ protected ArrayList<ItemStack> getAllBufferedTurbines(){
+ ArrayList<ItemStack> aTurbinesInStorage = new ArrayList<ItemStack>();
+ for (GT_MetaTileEntity_Hatch_InputBus aBus: this.mInputBusses) {
+ if (isValidMetaTileEntity(aBus)) {
+ for (ItemStack aContent : aBus.mInventory) {
+ if (isValidTurbine(aContent)) {
+ aTurbinesInStorage.add(aContent);
}
}
- else {
- if (isValidCasingBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
- }
- }
- }
- }
- return true;
- }
+ }
+ }
+ return aTurbinesInStorage;
+ }
- public boolean isValidCasingBlock(Block aBlock, int aMeta) {
- if (GregTech_API.sBlockMachines == aBlock) {
- return true;
+ public boolean areAllTurbinesTheSame() {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aTurbineAssemblies = getFullTurbineAssemblies();
+ if (aTurbineAssemblies.size() < 12) {
+ log("Found "+aTurbineAssemblies.size()+", expected 12.");
+ return false;
}
- if (Block.isEqualTo(aBlock, getCasingBlock()) && (int) aMeta == (int) getCasingMeta()) {
- return true;
+ AutoMap<Materials> aTurbineMats = new AutoMap<Materials>();
+ AutoMap<Integer> aTurbineSizes = new AutoMap<Integer>();
+ for (GT_MetaTileEntity_Hatch_Turbine aHatch : aTurbineAssemblies) {
+ aTurbineMats.add(GT_MetaGenerated_Tool.getPrimaryMaterial(aHatch.getTurbine()));
+ aTurbineSizes.add(getTurbineSize(aHatch.getTurbine()));
}
- log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMeta());
- return false;
+ Materials aBaseMat = aTurbineMats.get(0);
+ int aBaseSize = aTurbineSizes.get(0);
+ for (int aSize : aTurbineSizes) {
+ if (aBaseSize != aSize) {
+ return false;
+ }
+ }
+ for (Materials aMat : aTurbineMats) {
+ if (aBaseMat != aMat) {
+ return false;
+ }
+ }
+ return true;
}
- public boolean isValidTurbineBlock(Block aBlock, int aMeta) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMetaTurbine()) {
- return true;
+ public static int getTurbineSize(ItemStack aTurbine) {
+ if (isValidTurbine(aTurbine)) {
+ if (aTurbine.getItemDamage() >= 170 && aTurbine.getItemDamage() < 172) {
+ return 1;
+ }
+ else if (aTurbine.getItemDamage() >= 172 && aTurbine.getItemDamage() < 174) {
+ return 2;
+ }
+ else if (aTurbine.getItemDamage() >= 174 && aTurbine.getItemDamage() < 176) {
+ return 3;
+ }
+ else if (aTurbine.getItemDamage() >= 176 && aTurbine.getItemDamage() < 178) {
+ return 4;
+ }
}
- log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMetaTurbine());
- return false;
+ return 0;
}
- public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
+ public static String getTurbineSizeString(int aSize) {
+ switch (aSize) {
+ case 1:
+ return "Small Turbine";
+ case 2:
+ return "Turbine";
+ case 3:
+ return "Large Turbine";
+ case 4:
+ return "Huge Turbine";
+ default:
+ return "";
+ }
}
- public abstract byte getCasingMeta();
+ protected ArrayList<GT_MetaTileEntity_Hatch_Turbine> getEmptyTurbineAssemblies() {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
+ //log("Checking "+mTurbineRotorHatches.size()+" Assemblies for empties.");
+ for (GT_MetaTileEntity_Hatch_Turbine aTurbineHatch : this.mTurbineRotorHatches) {
+ if (!aTurbineHatch.hasTurbine()) {
+ //log("Found Assembly without Turbine.");
+ aEmptyTurbineRotorHatches.add(aTurbineHatch);
+ }
+ }
+ return aEmptyTurbineRotorHatches;
+ }
- public byte getCasingMetaTurbine() {
- return 7;
+ protected ArrayList<GT_MetaTileEntity_Hatch_Turbine> getFullTurbineAssemblies() {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
+ //log("Checking "+mTurbineRotorHatches.size()+" Assemblies for Turbines.");
+ for (GT_MetaTileEntity_Hatch_Turbine aTurbineHatch : this.mTurbineRotorHatches) {
+ if (aTurbineHatch.hasTurbine()) {
+ //log("Found Assembly with Turbine.");
+ aTurbineRotorHatches.add(aTurbineHatch);
+ }
+ }
+ return aTurbineRotorHatches;
}
- public abstract byte getCasingTextureIndex();
+ protected boolean depleteTurbineFromStock(ItemStack aTurbine) {
+ for (GT_MetaTileEntity_Hatch_InputBus aInputBus : this.mInputBusses) {
+ for (int slot = 0; slot < aInputBus.mInventory.length; slot++) {
+ ItemStack aStack = aInputBus.getStackInSlot(slot);
+ if (aStack != null && GT_Utility.areStacksEqual(aStack, aTurbine)) {
+ aInputBus.setInventorySlotContents(slot, null);
+ updateSlots();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
@Override
- public boolean checkRecipe(ItemStack aStack) {
- if((counter&7)==0 && (aStack==null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() >179)) {
- stopMachine();
- return false;
- }
- ArrayList<FluidStack> tFluids = getStoredFluids();
- if (tFluids.size() > 0) {
- if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
- || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
- counter = 0;
- baseEff = MathUtils.safeInt((long)((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
- optFlow = MathUtils.safeInt((long)Math.max(Float.MIN_NORMAL,
- ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
- * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
- * 50));
- if(optFlow<=0 || baseEff<=0){
- stopMachine();//in case the turbine got removed
- return false;
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(new ItemStack[] {}, getStoredFluids().toArray(new FluidStack[] {}), 1, 100, 100, 10000);
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+
+ try {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies();
+ if (aEmptyTurbineRotorHatches.size() > 0) {
+ log("Found "+aEmptyTurbineRotorHatches.size()+" Assemblies without Turbine.");
+ ArrayList<ItemStack> aTurbines = getAllBufferedTurbines();
+ hatch : for (GT_MetaTileEntity_Hatch_Turbine aHatch : aEmptyTurbineRotorHatches) {
+ for (ItemStack aTurbineItem : aTurbines) {
+ if (aTurbineItem == null) {
+ continue;
+ }
+ if (aTurbineItem != null && aHatch.insertTurbine(aTurbineItem.copy())) {
+ boolean aDidDeplete = depleteTurbineFromStock(aTurbineItem);
+ log("Put Turbine into Assembly - "+aDidDeplete);
+ continue hatch;
+ }
+ }
}
- } else {
- counter++;
}
- }
- else {
- Logger.INFO("Did not find any valid input fluids.");
- }
+ //log("Found "+getFullTurbineAssemblies().size()+" Assemblies with a Turbine.");
- int newPower = fluidIntoPower(tFluids, optFlow, baseEff); // How much the turbine should be producing with this flow
- int difference = newPower - this.mEUt; // difference between current output and new output
+ if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) {
+ log("BAD RETURN - 1");
+ stopMachine();
+ return false;
+ }
- // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
- // This is how much the turbine can actually change during this tick
- int maxChangeAllowed = Math.max(10, MathUtils.safeInt((long)Math.abs(difference)/100));
+ //log("Running checkRecipeGeneric(0)");
+
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+
+ if (tFluids.size() > 0) {
+ if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
+ || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
+ counter = 0;
+
+ //log("Running checkRecipeGeneric(1)");
+ float aTotalBaseEff = 0;
+ float aTotalOptimalFlow = 0;
+
+ ItemStack aStack = getFullTurbineAssemblies().get(0).getTurbine();
+ for (int i=0;i<18;i++) {
+ if (i == 0) {
+ aTotalBaseEff += GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
+ //log("Bumped base eff to "+aTotalBaseEff);
+ }
+ aTotalOptimalFlow += GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL,
+ ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
+ * 50));
+ //log("Bumped base optimal flow to "+aTotalOptimalFlow);
+ }
- if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
- int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
- this.mEUt += change; // Apply the change
- } else {
- this.mEUt = newPower;
+ //log("Running checkRecipeGeneric(2)");
+ //log("Total base eff: "+aTotalBaseEff);
+ //log("Total base optimal flow: "+aTotalOptimalFlow);
+ baseEff = MathUtils.roundToClosestInt(aTotalBaseEff);
+ optFlow = MathUtils.roundToClosestInt(aTotalOptimalFlow);
+ //log("Total eff: "+baseEff);
+ //log("Total optimal flow: "+optFlow);
+ if(optFlow<=0 || baseEff<=0){
+ log("Running checkRecipeGeneric(bad-1)");
+ stopMachine();//in case the turbine got removed
+ return false;
+ }
+ } else {
+ counter++;
+ }
+ }
+
+ //log("Total eff: "+baseEff);
+ //log("Total optimal flow: "+optFlow);
+
+ // How much the turbine should be producing with this flow
+ int newPower = fluidIntoPower(tFluids, optFlow, baseEff);
+ //log("Bumped newPower to "+newPower);
+ //log("New Power: "+newPower);
+ int difference = newPower - this.mEUt; // difference between current output and new output
+ //log("diff: "+difference);
+
+ // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
+ // This is how much the turbine can actually change during this tick
+ int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long)Math.abs(difference)/100));
+ //log("Max Change Allowed: "+maxChangeAllowed);
+
+ if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
+ int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
+ this.mEUt += change; // Apply the change
+ //log("Applied power change.");
+ }
+ else {
+ this.mEUt = newPower;
+ //log("Using same value.");
+ }
+ if (this.mEUt <= 0) {
+ this.mEUt=0;
+ this.mEfficiency=0;
+ log("Running checkRecipeGeneric(bad-2)");
+ //stopMachine();
+ return false;
+ } else {
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 10;
+ // Overvoltage is handled inside the MultiBlockBase when pushing out to dynamos. no need to do it here.
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+ //log("GOOD RETURN - Making: "+this.mEUt+" EU/t");
+ return true;
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
}
+ return false;
+ }
- if (this.mEUt <= 0) {
- //stopMachine();
- this.mEUt=0;
- this.mEfficiency=0;
+ public boolean doRandomMaintenanceDamage() {
+ if (getMaxParallelRecipes() == 0 || getRepairStatus() == 0) {
+ stopMachine();
return false;
- } else {
- this.mMaxProgresstime = 1;
- this.mEfficiencyIncrease = 10;
- if(this.mDynamoHatches.size()>0){
- for(GT_MetaTileEntity_Hatch dynamo:mDynamoHatches)
- if(isValidMetaTileEntity(dynamo) && dynamo.maxEUOutput() < mEUt)
- explodeMultiblock();
- }
- return true;
}
+ if (mRuntime++ > 1000) {
+ mRuntime = 0;
+ if (getBaseMetaTileEntity().getRandomNumber(6000) == 0) {
+ switch (getBaseMetaTileEntity().getRandomNumber(6)) {
+ case 0:
+ mWrench = false;
+ break;
+ case 1:
+ mScrewdriver = false;
+ break;
+ case 2:
+ mSoftHammer = false;
+ break;
+ case 3:
+ mHardHammer = false;
+ break;
+ case 4:
+ mSolderingTool = false;
+ break;
+ case 5:
+ mCrowbar = false;
+ break;
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_Turbine aHatch : getFullTurbineAssemblies()) {
+ aHatch.damageTurbine(mEUt, damageFactorLow, damageFactorHigh);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (getFullTurbineAssemblies().size());
+ }
+
+ public boolean runRecipe(GT_MetaTileEntity_Hatch_Turbine aHatch) {
+ return false;
}
abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff);
@@ -391,19 +601,17 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
}
public int getMaxEfficiency(ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) {
- return 0;
- }
- if (aStack.getItem() instanceof GT_MetaGenerated_Tool_01) {
- return 10000;
- }
- return 0;
+ return this.getMaxParallelRecipes() == 12 ? 10000 : 0;
}
@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return true;
}
+ public boolean isLooseMode() {
+ return false;
+ }
+
@Override
public String[] getExtraInfoData() {
int mPollutionReduction=0;
@@ -413,17 +621,20 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
}
}
- String tRunning = mMaxProgresstime>0 ?
-
+ String tRunning = mMaxProgresstime > 0 ?
EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET :
EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET;
+
String tMaintainance = getIdealStatus() == getRepairStatus() ?
EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET :
EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ;
int tDura = 0;
- if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) {
- tDura = MathUtils.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1));
+ String aTurbineDamage = "";
+ for (GT_MetaTileEntity_Hatch_Turbine aHatch : this.getFullTurbineAssemblies()) {
+ ItemStack aTurbine = aHatch.getTurbine();
+ tDura = MathUtils.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(aTurbine) * (GT_MetaGenerated_Tool.getToolDamage(aTurbine))+1));
+ aTurbineDamage += EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"% | ";
}
long storedEnergy=0;
@@ -434,38 +645,23 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
}
}
- String[] ret = new String[]{
- // 8 Lines available for information panels
- tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", */
-/* 1 *//*
-
- tMaintainance, */
-/* 2 *//*
-
- StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%", */
-/* 2 *//*
- StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ */
-/* 3 *//*
-
- EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
- StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" + */
-/* 4 *//*
-
- EnumChatFormatting.YELLOW+" ("+(looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")", */
-/* 5 *//*
-
- StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L", */
-/* 6 *//*
-
- StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"%", */
-/* 7 *//*
-
- StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %" */
-/* 8 *//*
+ boolean aIsSteam = this.getClass().getName().toLowerCase().contains("steam");
+ String[] ret = new String[]{
+ // 8 Lines available for information panels
+ tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t",
+ tMaintainance,
+ StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%",
+ StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
+ StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" +
+ EnumChatFormatting.YELLOW+" ("+(isLooseMode()?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")",
+ StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L",
+ StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+aTurbineDamage,
+ StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
};
- if (!this.getClass().getName().contains("Steam"))
+ if (!aIsSteam)
ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t";
return ret;
@@ -479,19 +675,22 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
public boolean polluteEnvironment(int aPollutionLevel) {
- mPollution += aPollutionLevel;
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- if (mPollution >= 1000) {
- if (tHatch.polluteEnvironment()) {
- mPollution -= 1000;
+ if (this.requiresMufflers()) {
+ mPollution += aPollutionLevel;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ if (mPollution >= 10000) {
+ if (PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10000)) {
+ mPollution -= 10000;
+ }
+ } else {
+ break;
}
- } else {
- break;
}
}
+ return mPollution < 10000;
}
- return mPollution < 1000;
+ return true;
}
@Override
public long maxAmperesOut() {
@@ -505,114 +704,65 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
//super.onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ);
}
else {
+ /*
this.mIsAnimated = Utils.invertBoolean(mIsAnimated);
if (this.mIsAnimated) {
- PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
+ PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
}
else {
- PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
+ PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
}
if (mTurbineRotorHatches.size() > 0) {
- for (GT_MetaTileEntity_Hatch_Turbine h : mTurbineRotorHatches) {
- if (h != null) {
- h.mUsingAnimation = mIsAnimated;
- }
+ for (GT_MetaTileEntity_Hatch_Turbine h : mTurbineRotorHatches) {
+ if (h != null) {
+ h.mUsingAnimation = mIsAnimated;
}
+ }
}
- }
+ */}
}
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("mIsAnimated", mIsAnimated);
+ public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())};
}
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mIsAnimated = aNBT.getBoolean("mIsAnimated");
- }
-
- private boolean mIsAnimated = true;
- public ITexture frontFace;
- public ITexture frontFaceActive;
- private CustomIcon GT9_5_Active;
- private CustomIcon GT9_5;
-
- public boolean usingAnimations() {
- return mIsAnimated;
- }
-
- @Override
- public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.getCasingTextureForId(getTAE())};
- }
-
protected ITexture getFrontFacingTurbineTexture(boolean isActive) {
- if (usingAnimations()) {
- if (isActive) {
- return frontFaceActive;
- }
+ if (isActive) {
+ return frontFaceActive;
}
return frontFace;
}
-
- public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity,
- final int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
- log("Found GT_MetaTileEntity_Hatch_Turbine");
- updateTexture(aTileEntity, aBaseCasingIndex);
- GT_MetaTileEntity_Hatch_Turbine aTurbineHatch = (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity;
- IGregTechTileEntity g = this.getBaseMetaTileEntity();
- if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) {
- Logger.INFO("Injected Controller into Turbine Assembly.");
- return this.mTurbineRotorHatches.add(aTurbineHatch);
- }
- else {
- Logger.INFO("Failed to inject controller into Turbine Assembly Hatch.");
- }
- }
- return false;
- }
-
+
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide()) {
- if (mUpdate == 0 || this.mStartUpCheck == 0) {
+ if (mUpdate == 1 || mStartUpCheck == 1) {
+ log("Cleared Rotor Assemblies.");
this.mTurbineRotorHatches.clear();
}
- }
- if (aTick % 20 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.maxProgresstime() > 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
enableAllTurbineHatches();
}
-
+ if (this.maxProgresstime() <= 0) {
+ stopMachine();
+ }
+
}
@Override
public void startProcess() {
super.startProcess();
enableAllTurbineHatches();
}
- @Override
- public void onMachineBlockUpdate() {
- super.onMachineBlockUpdate();
- }
- @Override
- public boolean onRunningTick(ItemStack aStack) {
- return super.onRunningTick(aStack);
- }
+
@Override
public void stopMachine() {
- super.stopMachine();
+ baseEff = 0;
+ optFlow = 0;
disableAllTurbineHatches();
+ super.stopMachine();
}
@Override
public void onRemoval() {
@@ -630,7 +780,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
public boolean disableAllTurbineHatches() {
return updateTurbineHatches(false) > 0;
}
-
+
private Long mLastHatchUpdate;
public int updateTurbineHatches(boolean aState) {
int aUpdated = 0;
@@ -648,16 +798,97 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
mLastHatchUpdate = System.currentTimeMillis()/1000;
return aUpdated;
}
-
- @Override
- public int getMaxParallelRecipes() {
- return 1;
- }
@Override
public int getEuDiscountForParallelism() {
return 0;
}
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ log("Fixing Bad Facing. (GT Bug)");
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+ /**
+ * Called every tick the Machine runs
+ */
+ public boolean onRunningTick(ItemStack aStack) {
+ if (mEUt > 0) {
+ addEnergyOutput(((long) mEUt * mEfficiency) / 10000);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean addEnergyOutput(long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ if (this.mAllDynamoHatches.size() > 0) {
+ return addEnergyOutputMultipleDynamos(aEU, true);
+ }
+ return false;
+ }
+ public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) {
+ int injected = 0;
+ long totalOutput = 0;
+ long aFirstVoltageFound = -1;
+ boolean aFoundMixedDynamos = false;
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if(aDynamo == null) {
+ return false;
+ }
+ if (isValidMetaTileEntity(aDynamo)) {
+ long aVoltage = aDynamo.maxEUOutput();
+ long aTotal = aDynamo.maxAmperesOut() * aVoltage;
+ // Check against voltage to check when hatch mixing
+ if (aFirstVoltageFound == -1) {
+ aFirstVoltageFound = aVoltage;
+ }
+ else {
+ if (aFirstVoltageFound != aVoltage) {
+ aFoundMixedDynamos = true;
+ }
+ }
+ totalOutput += aTotal;
+ }
+ }
+
+ if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) {
+ explodeMultiblock();
+ return false;
+ }
+
+ long leftToInject;
+ long aVoltage;
+ int aAmpsToInject;
+ int aRemainder;
+ int ampsOnCurrentHatch;
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if (isValidMetaTileEntity(aDynamo)) {
+ leftToInject = aEU - injected;
+ aVoltage = aDynamo.maxEUOutput();
+ aAmpsToInject = (int) (leftToInject / aVoltage);
+ aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage));
+ ampsOnCurrentHatch= (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject);
+ for (int i = 0; i < ampsOnCurrentHatch; i++) {
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false);
+ }
+ injected+=aVoltage*ampsOnCurrentHatch;
+ if(aRemainder>0 && ampsOnCurrentHatch<aDynamo.maxAmperesOut()){
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false);
+ injected+=aRemainder;
+ }
+ }
+ }
+ return injected > 0;
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
index 78adb094ed..344b7f710a 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
@@ -14,8 +14,7 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -57,6 +56,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
}
protected long mAverageEuUsage = 0;
+ protected long mAverageEuAdded = 0;
+ protected long mAverageEuConsumed = 0;
protected long mTotalEnergyAdded = 0;
protected long mTotalEnergyConsumed = 0;
protected long mTotalEnergyLost = 0;
@@ -87,7 +88,6 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
protected GT_Multiblock_Tooltip_Builder createTooltip() {
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("[BUG] GUI does not work until structure is assembled correctly. (Do Not Report issue)")
.addInfo("Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches")
.addInfo("Does not require maintenance")
.addInfo("Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "")
@@ -128,7 +128,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (mBatteryCapacity <= 0) return false;
+ //if (mBatteryCapacity <= 0) return false;
if (!aBaseMetaTileEntity.isClientSide()) {
aBaseMetaTileEntity.openGUI(aPlayer);
}
@@ -194,7 +194,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
public static int getMaxHatchTier(int aCellTier) {
switch(aCellTier) {
case 9:
- return CORE.GTNH ? 15 : 9;
+ return GT_Values.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9;
default:
if (aCellTier < 4) {
return 0;
@@ -476,6 +476,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setLong("mAverageEuUsage", this.mAverageEuUsage);
+ aNBT.setLong("mAverageEuAdded", this.mAverageEuAdded);
+ aNBT.setLong("mAverageEuConsumed", this.mAverageEuConsumed);
//Usage Stats
aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded);
@@ -493,7 +495,13 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
// Best not to get a long if the Tag Map is holding an int
if (aNBT.hasKey("mAverageEuUsage")) {
this.mAverageEuUsage = aNBT.getLong("mAverageEuUsage");
- }
+ }
+ if (aNBT.hasKey("mAverageEuAdded")) {
+ this.mAverageEuAdded = aNBT.getLong("mAverageEuAdded");
+ }
+ if (aNBT.hasKey("mAverageEuConsumed")) {
+ this.mAverageEuConsumed = aNBT.getLong("mAverageEuConsumed");
+ }
//Usage Stats
this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded");
@@ -510,8 +518,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
@Override
public boolean checkRecipe(final ItemStack aStack) {
- this.mProgresstime = 1;
- this.mMaxProgresstime = 1;
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 200;
this.mEUt = 0;
this.mEfficiencyIncrease = 10000;
this.fixAllMaintenanceIssue();
@@ -528,34 +536,43 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
return 0;
}
- private void drawEnergyFromHatch(MetaTileEntity aHatch) {
- if (!isValidMetaTileEntity(aHatch)) return;
+ private long drawEnergyFromHatch(MetaTileEntity aHatch) {
+ if (!isValidMetaTileEntity(aHatch)) {
+ return 0;
+ }
long stored = aHatch.getEUVar();
long voltage = aHatch.maxEUInput() * aHatch.maxAmperesIn();
if (voltage > stored) {
- return;
+ return 0;
}
if (this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false)) {
aHatch.setEUVar((stored - voltage));
this.mTotalEnergyAdded += voltage;
+ return voltage;
}
+ return 0;
}
- private void addEnergyToHatch(MetaTileEntity aHatch) {
- if (!isValidMetaTileEntity(aHatch)) return;
+ private long addEnergyToHatch(MetaTileEntity aHatch) {
+ if (!isValidMetaTileEntity(aHatch)) {
+ return 0;
+ }
long voltage = aHatch.maxEUOutput() * aHatch.maxAmperesOut();
- if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) return;
+ if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) {
+ return 0;
+ }
if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(voltage, false)) {
aHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false);
this.mTotalEnergyConsumed+=voltage;
+ return voltage;
}
-
+ return 0;
}
private long computeEnergyTax() {
@@ -586,23 +603,32 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
this.mTotalEnergyLost += Math.min(mDecrease, this.getEUVar());
this.setEUVar(Math.max(0, this.getEUVar() - mDecrease));
+ long aInputAverage = 0;
+ long aOutputAverage = 0;
// Input Power
for (Object THatch : this.mDischargeHatches) {
GT_MetaTileEntity_Hatch_OutputBattery tHatch = (GT_MetaTileEntity_Hatch_OutputBattery) THatch;
drawEnergyFromHatch(tHatch);
+ aInputAverage += tHatch.maxEUInput() * tHatch.maxAmperesIn();
}
for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) {
drawEnergyFromHatch(tHatch);
+ aInputAverage += tHatch.maxEUInput() * tHatch.maxAmperesIn();
}
// Output Power
for (Object THatch : this.mChargeHatches) {
GT_MetaTileEntity_Hatch_InputBattery tHatch = (GT_MetaTileEntity_Hatch_InputBattery) THatch;
- addEnergyToHatch(tHatch);
+ aOutputAverage += addEnergyToHatch(tHatch);
}
for (GT_MetaTileEntity_Hatch tHatch : this.mAllDynamoHatches) {
- addEnergyToHatch(tHatch);
+ aOutputAverage += addEnergyToHatch(tHatch);
}
+ // reset progress time
+ mProgresstime = 0;
+
+ this.mAverageEuAdded = aInputAverage;
+ this.mAverageEuConsumed = aOutputAverage;
return true;
@@ -658,6 +684,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
"Requires Maintenance: " + (!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED)+ mMaint + EnumChatFormatting.RESET +" | Code: ["+(!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + errorCode + EnumChatFormatting.RESET +"]",
"----------------------",
"Stats for Nerds",
+ "Average Input: " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(this.mAverageEuAdded) + EnumChatFormatting.RESET + " EU",
+ "Average Output: " + EnumChatFormatting.GOLD + GT_Utility.formatNumbers(this.mAverageEuConsumed) + EnumChatFormatting.RESET + " EU",
"Total Input: " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(this.mTotalEnergyAdded) + EnumChatFormatting.RESET + " EU",
"Total Output: " + EnumChatFormatting.GOLD + GT_Utility.formatNumbers(this.mTotalEnergyConsumed) + EnumChatFormatting.RESET + " EU",
"Total Costs: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.mTotalEnergyLost) + EnumChatFormatting.RESET + " EU",
@@ -726,6 +754,14 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
return 32768;
}
+ public final long getAverageEuAdded() {
+ return this.mAverageEuAdded;
+ }
+
+ public final long getAverageEuConsumed() {
+ return this.mAverageEuConsumed;
+ }
+
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
mIsOutputtingPower = Utils.invertBoolean(mIsOutputtingPower);