aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2021-07-30 11:56:23 +0200
committerGitHub <noreply@github.com>2021-07-30 11:56:23 +0200
commit97770547e364cde3c32c95900d0f7dd5f28dda34 (patch)
tree4c3b132304e8b81cc5576bacaa7d3e37aab5b208 /src/main/java/com
parente58ad90b53da98a185c2202994fd982c67fdf4a7 (diff)
parentf5729c0aa7f818e09f299ce2fcd8b243f79042d0 (diff)
downloadGT5-Unofficial-97770547e364cde3c32c95900d0f7dd5f28dda34.tar.gz
GT5-Unofficial-97770547e364cde3c32c95900d0f7dd5f28dda34.tar.bz2
GT5-Unofficial-97770547e364cde3c32c95900d0f7dd5f28dda34.zip
Merge pull request #15 from GTNewHorizons/structurelib-integration
adjust multiblocks to work with structurelib Former-commit-id: a177f8d31c1a9767abfc0ae3146ced3c488a7bd4
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java40
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java240
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java230
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java10
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java12
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/GT_TileEntity_VoidMiner_Base.java42
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/BW_TT_HeatExchanger.java369
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement.java110
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_Abstract_GT_Replacement_Coils.java27
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ElectronicBlastFurnace.java375
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java248
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java269
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java314
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_PyrolyseOven.java231
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VacuumFreezer.java195
15 files changed, 337 insertions, 2375 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java
index 35e9667204..381d17463f 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java
@@ -23,6 +23,7 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
+import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
@@ -32,6 +33,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase;
import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric;
@@ -45,6 +47,8 @@ import net.minecraftforge.fluids.FluidRegistry;
import java.lang.reflect.Field;
import java.util.Arrays;
+import static gregtech.api.enums.GT_Values.VN;
+
public class GT_TileEntity_DEHP extends GT_MetaTileEntity_DrillerBase {
private static float nulearHeatMod = 2f;
private byte mMode;
@@ -99,10 +103,36 @@ public class GT_TileEntity_DEHP extends GT_MetaTileEntity_DrillerBase {
}
@Override
- public String[] getDescription() {
- String[] dscSteam = {"Controller Block for the Deep Earth Heat Pump " + (this.mTier > 1 ? this.mTier : ""), "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)", "3x1x3 Base of " + this.getCasingBlockItem().name(), "1x3x1 " + this.getCasingBlockItem().name() + " pillar (Center of base)", "1x3x1 " + this.getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)", "1x Input Hatch (One of base casings)", "1x Output Hatch (One of base casings)", "1x Maintenance Hatch (One of base casings)", "1x " + GT_Values.VN[this.getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", "Consumes " + GT_Values.V[this.mTier + 2] + "EU/t", "Has 4 Modes, use the Screwdriver to change them:", "0 Idle, 1 Steam, 2 Superheated Steam (requires Distilled Water), 3 Retract", "Explodes when it runs out of Water/Distilled Water", "Converts " + (long) (this.mTier * 1200 * 20) + "L/s Water(minus 10% per Maintenance Problem) to Steam", "Converts " + (long) (this.mTier * 600 * 20) + "L/s Distilled Water(minus 10% per Maintenance Problem) to SuperheatedSteam"};
- String[] dscCooleant = {"Controller Block for the Deep Earth Heat Pump " + (this.mTier > 1 ? this.mTier : ""), "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)", "3x1x3 Base of " + this.getCasingBlockItem().name(), "1x3x1 " + this.getCasingBlockItem().name() + " pillar (Center of base)", "1x3x1 " + this.getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)", "1x Input Hatch (One of base casings)", "1x Output Hatch (One of base casings)", "1x Maintenance Hatch (One of base casings)", "1x " + GT_Values.VN[this.getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", "Consumes " + GT_Values.V[this.mTier + 2] + "EU/t", "Has 4 Modes, use the Screwdriver to change them:", "0 Idle, 1 & 2 Coolant Heating Mode (no Difference between them), 3 Retract", "Explodes when it runs out of Coolant", "Heats up " + (long) (this.mTier * 24 * ((double) GT_TileEntity_DEHP.nulearHeatMod)) * 20 + "L/s Coolant(minus 10% per Maintenance Problem)"};
- return ConfigHandler.DEHPDirectSteam ? dscSteam : dscCooleant;
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ String casings = getCasingBlockItem().get(0).getDisplayName();
+ tt.addMachineType("Geothermal Heat Pump")
+ .addInfo("Consumes " + GT_Values.V[this.mTier + 2] + "EU/t")
+ .addInfo("Has 4 Modes, use the Screwdriver to change them:");
+ if (ConfigHandler.DEHPDirectSteam) {
+ tt.addInfo("0 Idle, 1 Steam, 2 Superheated Steam (requires Distilled Water), 3 Retract")
+ .addInfo("Explodes when it runs out of Water/Distilled Water")
+ .addInfo("Converts " + (long) (this.mTier * 1200 * 20) + "L/s Water(minus 10% per Maintenance Problem) to Steam")
+ .addInfo("Converts " + (long) (this.mTier * 600 * 20) + "L/s Distilled Water(minus 10% per Maintenance Problem) to SuperheatedSteam");
+
+ } else {
+ tt.addInfo("0 Idle, 1 & 2 Coolant Heating Mode (no Difference between them), 3 Retract")
+ .addInfo("Explodes when it runs out of Coolant")
+ .addInfo("Heats up " + (long) (this.mTier * 24 * ((double) GT_TileEntity_DEHP.nulearHeatMod)) * 20 + "L/s Coolant(minus 10% per Maintenance Problem)");
+ }
+ tt.addSeparator()
+ .beginStructureBlock(3, 7, 3, false)
+ .addController("Front bottom")
+ .addStructureInfo(casings + " form the 3x1x3 Base")
+ .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)")
+ .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing")
+ .addMaintenanceHatch("Any base casing")
+ .addInputBus("Mining Pipes, optional, any base casing")
+ .addInputHatch("Any base casing")
+ .addOutputHatch("Any base casing")
+ .toolTipFinisher(BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get());
+ return tt;
}
@Override
@@ -188,7 +218,7 @@ public class GT_TileEntity_DEHP extends GT_MetaTileEntity_DrillerBase {
return true;
}
- if (!this.tryLowerPipe()) {
+ if (tryLowerPipeState(false) != 0) {
if (this.waitForPipes()) {
return false;
} else {
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java
index 74e540f46e..f13352e09d 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java
@@ -23,7 +23,6 @@
package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import com.github.bartimaeusnek.bartworks.API.LoaderReference;
-import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry;
import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference;
@@ -32,49 +31,94 @@ import com.github.bartimaeusnek.bartworks.util.MegaUtils;
import com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti;
import com.github.bartimaeusnek.crossmod.tectech.helper.TecTechUtils;
import com.github.bartimaeusnek.crossmod.tectech.tileentites.tiered.LowPowerLaser;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.HeatingCoilLevel;
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_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAdder;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.util.GT_StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
@Optional.Interface(iface = "com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti", modid = "tectech", striprefs = true)
public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBlastFurnace implements TecTechEnabledMulti {
+ private static final int CASING_INDEX = 11;
+ private static final IStructureDefinition<GT_TileEntity_MegaBlastFurnace> STRUCTURE_DEFINITION = StructureDefinition.<GT_TileEntity_MegaBlastFurnace>builder()
+ .addShape("main", createShape())
+ .addElement('t', ofHatchAdderOptional(GT_TileEntity_MegaBlastFurnace::addOutputHatchToTopList, CASING_INDEX, 1, GregTech_API.sBlockCasings1, CASING_INDEX))
+ .addElement('m', ofHatchAdder(GT_TileEntity_MegaBlastFurnace::addMufflerToMachineList, CASING_INDEX, 2))
+ .addElement('C', ofCoil(GT_TileEntity_MegaBlastFurnace::setCoilLevel, GT_MetaTileEntity_ElectricBlastFurnace::getCoilLevel))
+ .addElement('g', ofBlockAdder(GT_TileEntity_MegaBlastFurnace::addGlas, ItemRegistry.bw_glasses[0], 1))
+ .addElement('b', ofHatchAdderOptional(GT_TileEntity_MegaBlastFurnace::addBottomHatch, CASING_INDEX, 3, GregTech_API.sBlockCasings1, CASING_INDEX))
+ .build();
+
+ private static String[][] createShape() {
+ String[][] raw = new String[20][];
+
+ raw[0] = new String[15];
+ String topCasing = "ttttttttttttttt";
+ String mufflerLine = "tmmmmmmmmmmmmmt";
+ raw[0][0] = topCasing;
+ for (int i = 1; i < 14; i++) {
+ raw[0][i] = mufflerLine;
+ }
+ raw[0][14] = topCasing;
+
+ raw[1] = new String[15];
+ String allGlass = "ggggggggggggggg";
+ String allCoil = "gCCCCCCCCCCCCCg";
+ String middleLine = "gC-----------Cg";
+ raw[1][0] = allGlass;
+ raw[1][1] = allCoil;
+ raw[1][13] = allCoil;
+ raw[1][14] = allGlass;
+ for (int i = 2; i < 13; i++) {
+ raw[1][i] = middleLine;
+ }
+ for (int i = 2; i < 19; i++) {
+ raw[i] = raw[1];
+ }
+ String bottomCasing = "bbbbbbbbbbbbbbb";
+ raw[19] = new String[15];
+ for (int i = 0; i < 15; i++) {
+ raw[19][i] = bottomCasing;
+ }
+
+ raw[17] = Arrays.copyOf(raw[17], raw[17].length);
+ raw[17][0] = "ggggggg~ggggggg";
+
+ return transpose(raw);
+ }
+
private int mHeatingCapacity;
private byte glasTier;
private int polPtick = super.getPollutionPerTick(null) * ConfigHandler.megaMachinesMax;
- static Field controllerY;
-
- static {
- try {
- controllerY = GT_MetaTileEntity_ElectricBlastFurnace.class.getDeclaredField("controllerY");
- } catch (NoSuchFieldException e) {
- MainMod.LOGGER.catching(e);
- }
- controllerY.setAccessible(true);
- }
public GT_TileEntity_MegaBlastFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -84,16 +128,36 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl
super(aName);
}
- public String[] getDescription() {
- String[] dsc = StatCollector.translateToLocal("tooltip.tile.mbf.0.name").split(";");
- String tmp = dsc[dsc.length - 1];
- dsc[dsc.length - 1] = tmp + " " + 20 * this.getPollutionPerTick(null) + " " + StatCollector.translateToLocal("tooltip.tile.mbf.1.name");
- String[] fdsc = new String[dsc.length + 1];
- for (int i = 0; i < dsc.length; i++) {
- fdsc[i] = dsc[i];
- fdsc[dsc.length] = BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get();
- }
- return fdsc;
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Blast Furnace")
+ .addInfo("Controller block for the Mega Blast Furnace")
+ .addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus")
+ .addInfo("Each 900K over the min. Heat required multiplies EU/t by 0.95")
+ .addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal")
+ .addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%")
+ .addInfo("Additionally gives +100K for every tier past MV")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(15, 20, 15, true)
+ .addController("Front bottom")
+ .addCasingInfo("Heat Proof Machine Casing", 0)
+ .addOtherStructurePart("Heating Coils", "Inner 13x18x13 (Hollow)")
+ .addOtherStructurePart("Borosilicate Glass", "Outer 15x18x15")
+ .addStructureInfo("The glass tier limits the Energy Input tier")
+ .addEnergyHatch("Any bottom layer casing")
+ .addMaintenanceHatch("Any bottom layer casing")
+ .addMufflerHatch("Top middle 13x13")
+ .addInputBus("Any bottom layer casing")
+ .addInputHatch("Any bottom layer casing")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("Gasses, Any top layer casing")
+ .addStructureInfo("Recovery amount scales with Muffler Hatch tier")
+ .addOutputHatch("Platline fluids, Any bottom layer casing")
+ .addStructureHint("This Mega Multiblock is too big to have its structure hologram displayed fully.")
+ .toolTipFinisher(BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get());
+ return tt;
}
@SuppressWarnings("rawtypes")
@@ -223,6 +287,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl
return timesOverclocked;
}
+ @Override
public String[] getInfoData() {
int mPollutionReduction = 0;
@@ -263,60 +328,6 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl
return super.getMaxInputVoltage();
}
- private boolean getCoilHeat(IGregTechTileEntity iGregTechTileEntity, int y) {
- int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 7;
- int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 7;
- int internalH = 0;
- for (int x = -6; x <= 6; x++) {
- for (int z = -6; z <= 6; z++) {
- if (Math.abs(x) < 6 && Math.abs(z) != 6)
- continue;
- byte tUsedMeta = iGregTechTileEntity.getMetaIDOffset(xDir + x, y, zDir + z);
- switch (tUsedMeta) {
- case 0: // cupronickel coil
- internalH = 1801;
- break;
- case 1: // Kanthal coil
- internalH = 2701;
- break;
- case 2: // nichrome coil
- internalH = 3601;
- break;
- case 3: // tungstensteel coil
- internalH = 4501;
- break;
- case 4: // HSS-G coil
- internalH = 5401;
- break;
- case 5: // naquadah coil
- internalH = 7201;
- break;
- case 6: // naquadah alloy coil
- internalH = 8101;
- break;
- case 7: // fluxed electrum coil
- internalH = 9901;
- break;
- case 8: // awakened draconium coil
- internalH = 10801;
- break;
- case 9: // HSS-S coil
- internalH = 6301;
- break;
- case 10: // trinium coil
- internalH = 9001;
- default:
- break;
- }
- if (this.mHeatingCapacity > 0 && internalH != this.mHeatingCapacity)
- return false;
- else if (this.mHeatingCapacity == 0)
- this.mHeatingCapacity = internalH;
- }
- }
- return true;
- }
-
@Override
public int getPollutionPerTick(ItemStack aStack) {
return this.polPtick;
@@ -409,45 +420,54 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl
}
@Override
- public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
- try {
- controllerY.set(this, iGregTechTileEntity.getYCoord() - 2);
- } catch (IllegalAccessException e) {
- MainMod.LOGGER.catching(e);
- }
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped();
+ }
+
+ @Override
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public IStructureDefinition<GT_MetaTileEntity_ElectricBlastFurnace> getStructureDefinition() {
+ // hack to get around generic
+ return (IStructureDefinition) STRUCTURE_DEFINITION;
+ }
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece("main", stackSize, hintsOnly, 7, 17, 0);
+ }
+
+ private boolean addGlas(Block block, int meta) {
+ if (block != ItemRegistry.bw_glasses[0])
+ return false;
+ byte tier = BW_Util.getTierFromGlasMeta(meta);
+ if (glasTier > 0)
+ return tier == glasTier;
+ glasTier = tier;
+ return true;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
if (LoaderReference.tectech) {
this.getTecTechEnergyMultis().clear();
this.getTecTechEnergyTunnels().clear();
}
this.mHeatingCapacity = 0;
- boolean ret;
- ret = BW_Util.check_layer(iGregTechTileEntity, 7, -2, -1, GregTech_API.sBlockCasings1, 11, 7, false, false, true, GregTech_API.sBlockCasings1, 11, true, 11);
- ret &= BW_Util.check_layer(iGregTechTileEntity, 7, 17, 18, GregTech_API.sBlockCasings1, 11, 7, false, null, -1, 11);
- ret &= BW_Util.check_layer(iGregTechTileEntity, 6, -1, 17, GregTech_API.sBlockCasings5, -1, 7, false, false, true, Blocks.air, -1, false, 11);
-
- for (int y = -1; y < 17; y++) {
- ret &= BW_Util.check_layer(iGregTechTileEntity, 7, y, y + 1, ItemRegistry.bw_glasses[0], -1, 7, y == 0, false, false, null, -1, false, 11);
- if (!this.getCoilHeat(iGregTechTileEntity, y))
- return false;
- List<Byte> metasFromLayer = BW_Util.getMetasFromLayer(iGregTechTileEntity, 7, y, y + 1, 7, y == 0, false, false);
- for (Byte meta : metasFromLayer) {
- byte inttier = BW_Util.getTierFromGlasMeta(meta);
- if (this.glasTier > 0 && inttier != this.glasTier)
- return false;
- else if (this.glasTier == 0)
- this.glasTier = inttier;
- }
- }
+ glasTier = 0;
- int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 7;
- int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 7;
+ setCoilLevel(HeatingCoilLevel.None);
- for (int z = -6; z <= 6; z++)
- for (int x = -6; x <= 6; x++)
- if (!this.addMufflerToMachineList(iGregTechTileEntity.getIGregTechTileEntityOffset(xDir + x, 17, zDir + z), 11))
- return false;
+ this.mPollutionOutputHatches.clear();
+
+ if (!checkPiece("main", 7, 17, 0))
+ return false;
+
+ if (getCoilLevel() == HeatingCoilLevel.None)
+ return false;
+
+ if (mMaintenanceHatches.size() != 1)
+ return false;
if (LoaderReference.tectech && this.glasTier != 8)
if (!areLazorsLowPowa() || areThingsNotProperlyTiered(this.getTecTechEnergyTunnels()) || areThingsNotProperlyTiered(this.getTecTechEnergyMultis()))
@@ -458,7 +478,9 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl
if (this.glasTier < hatchEnergy.mTier)
return false;
- return ret && !this.mMaintenanceHatches.isEmpty() && !this.mOutputBusses.isEmpty() && !this.mInputBusses.isEmpty();
+ this.mHeatingCapacity = (int) getCoilLevel().getHeat() + 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2);
+
+ return true;
}
@SuppressWarnings("rawtypes")
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java
index 64b0dd182f..7c1f13d200 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java
@@ -24,25 +24,111 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega;
import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler;
import com.github.bartimaeusnek.bartworks.util.*;
-import com.google.common.collect.ArrayListMultimap;
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-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.tileentities.machines.multi.GT_MetaTileEntity_DistillationTower;
-import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import java.util.List;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
public class GT_TileEntity_MegaDistillTower extends GT_MetaTileEntity_DistillationTower {
+ private static final IStructureDefinition<GT_TileEntity_MegaDistillTower> STRUCTURE_DEFINITION = StructureDefinition.<GT_TileEntity_MegaDistillTower>builder()
+ .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][]{
+ {"bbbbbbb~bbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbb"},
+ }))
+ .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][]{
+ {"lllllllllllllll", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lcccccccccccccl", "lllllllllllllll"},
+ {"lllllllllllllll", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "lllllllllllllll"},
+ {"lllllllllllllll", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "lllllllllllllll"},
+ {"lllllllllllllll", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "lllllllllllllll"},
+ {"lllllllllllllll", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "l-------------l", "lllllllllllllll"},
+ }))
+ .addElement('b', ofChain(
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addOutputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_TileEntity_MegaDistillTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ .addElement('l', ofChain(
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addLayerOutputHatch, CASING_INDEX, 2),
+ ofHatchAdder(GT_TileEntity_MegaDistillTower::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_TileEntity_MegaDistillTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ // this one is too complex and cannot be expressed with a combination of existing IStructureElement
+ .addElement('c', new IStructureElement<GT_TileEntity_MegaDistillTower>() {
+ @Override
+ public boolean check(GT_TileEntity_MegaDistillTower t, World world, int x, int y, int z) {
+ if (world.isAirBlock(x, y, z)) {
+ if (t.mTopState < 1) {
+ t.mTopState = 0;
+ return true;
+ }
+ // definitely top - cannot be air
+ return false;
+ }
+ // from here on we must be looking at a top layer, since it's not air
+ if (t.mTopState == 0)
+ // must be air but failed, so no
+ return false;
+ t.mTopState = 1;
+ // hatch adder
+ TileEntity tileEntity = world.getTileEntity(x, y, z);
+ if (tileEntity instanceof IGregTechTileEntity) {
+ IGregTechTileEntity entity = (IGregTechTileEntity) tileEntity;
+ if (t.addLayerOutputHatch(entity, CASING_INDEX)) {
+ t.onTopLayerFound(false);
+ return true;
+ }
+ }
+ // block adder
+ if(world.getBlock(x, y, z) == GregTech_API.sBlockCasings4 && world.getBlockMetadata(x, y, z) == 1) {
+ t.onTopLayerFound(true);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean spawnHint(GT_TileEntity_MegaDistillTower t, World world, int x, int y, int z, ItemStack trigger) {
+ if (trigger.stackSize == 1)
+ StructureLibAPI.hintParticle(world, x, y, z, GregTech_API.sBlockCasings4, 1);
+ return true;
+ }
- private static final int CASING_INDEX = 49;
+ @Override
+ public boolean placeBlock(GT_TileEntity_MegaDistillTower t, World world, int x, int y, int z, ItemStack trigger) {
+ if (trigger.stackSize == 1) {
+ world.setBlock(x, y, z, GregTech_API.sBlockCasings4, 1, 3);
+ return true;
+ }
+ world.setBlockToAir(x, y, z);
+ return false;
+ }
+ }
+ )
+ .build();
+
+ // -1 => maybe top, maybe not, 0 => definitely not top, 1 => definitely top
+ private int mTopState = -1;
public GT_TileEntity_MegaDistillTower(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -58,106 +144,64 @@ public class GT_TileEntity_MegaDistillTower extends GT_MetaTileEntity_Distillati
}
@Override
- public String[] getDescription() {
- return new String[]{
- "Controller Block for the Mega Distillation Tower",
- "Size(WxHxD): 15xhx15 (Hollow), with h ranging from 16 to 56",
- "Controller (Front bottom)",
- "1+ Input Hatch (Any bottom layer casing)",
- "1+ Output Bus (Any bottom layer casing)",
- "An \"Output Layer\" consists of 5 layers!",
- "2-11+ Output Hatch (One or more per Output Layer)",
- "1x Maintenance Hatch (Any casing)",
- "1+ Energy Hatch (Any casing)",
- "Fluids are only put out at the correct height",
- "The correct height equals the slot number in the NEI recipe",
- "Clean Stainless Steel Machine Casings for the rest (15 x h - 5 at least!)",
- BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()
- };
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Distillery")
+ .addInfo("Controller block for the Distillation Tower")
+ .addInfo("Fluids are only put out at the correct height")
+ .addInfo("The correct height equals the slot number in the NEI recipe")
+ .addSeparator()
+ .beginVariableStructureBlock(15, 15, 16, 56, 15, 15, true)
+ .addController("Front bottom")
+ .addOtherStructurePart("Clean Stainless Steel Machine Casing", "15 x h - 5 (minimum)")
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputHatch("Any bottom layer casing")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("2-11x Output Hatches (One per Output Layer except bottom layer)")
+ .addStructureInfo("An \"Output Layer\" consists of 5 layers!")
+ .addStructureHint("This Mega Multiblock is too big to have its structure hologram displayed fully.")
+ .toolTipFinisher(BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get());
+ return tt;
}
- private short controllerY = 0;
-
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) {
- LAYERMAP.clear();
- controllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7;
- int x, z, y = 0, casingAmount = 0;
- boolean reachedTop = false;
-
- IGregTechTileEntity tileEntity;
- Block block;
- for (x = xDir - 7; x <= xDir + 7; ++x) {
- for (z = zDir - 7; z <= zDir + 7; ++z) {
- if (x != 0 || z != 0) {
- tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (!this.addInputToMachineList(tileEntity, CASING_INDEX) && !this.addOutputToMachineList(tileEntity, CASING_INDEX) && !this.addMaintenanceToMachineList(tileEntity, CASING_INDEX) && !this.addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 1) {
- return false;
- }
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public IStructureDefinition<GT_MetaTileEntity_DistillationTower> getStructureDefinition() {
+ return (IStructureDefinition) STRUCTURE_DEFINITION;
+ }
- ++casingAmount;
- }
- }
- }
- }
- for (y = y + 1; y <= 60 &