From 546b42d7440839477455b818133d80221c70c582 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Sat, 29 May 2021 23:52:15 +0800
Subject: Initial StructureLib integration
---
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 122 +++++++++++++++++++++
.../GT_MetaTileEntity_MultiBlockBase.java | 9 +-
2 files changed, 127 insertions(+), 4 deletions(-)
create mode 100644 src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
new file mode 100644
index 0000000000..7d06378ce1
--- /dev/null
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -0,0 +1,122 @@
+package gregtech.api.metatileentity.implementations;
+
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.alignment.IAlignment;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
+import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
+import com.gtnewhorizon.structurelib.alignment.enumerable.Flip;
+import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * Enhanced multiblock base class, featuring following improvement over {@link GT_MetaTileEntity_MultiBlockBase}
+ *
+ * 1. TecTech style declarative structure check utilizing StructureLib.
+ * 2. Arbitrarily rotating the whole structure, if allowed to.
+ *
+ * @param type of this
+ */
+public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase> extends GT_MetaTileEntity_MultiBlockBase implements IAlignment {
+ private ExtendedFacing mExtendedFacing;
+ private final IAlignmentLimits mLimits;
+
+ protected GT_MetaTileEntity_EnhancedMultiBlockBase(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mLimits = getInitialAlignmentLimits();
+ }
+
+ protected GT_MetaTileEntity_EnhancedMultiBlockBase(String aName) {
+ super(aName);
+ mLimits = getInitialAlignmentLimits();
+ }
+
+ @Override
+ public ExtendedFacing getExtendedFacing() {
+ return mExtendedFacing;
+ }
+
+ @Override
+ public void setExtendedFacing(ExtendedFacing newExtendedFacing) {
+ if (mExtendedFacing != newExtendedFacing) {
+ stopMachine();
+ mExtendedFacing = newExtendedFacing;
+ IGregTechTileEntity base = getBaseMetaTileEntity();
+ mMachine = false;
+ mUpdate = 100;
+ if (getBaseMetaTileEntity().isServerSide()) {
+ StructureLibAPI.sendAlignment((IAlignmentProvider) base,
+ new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId,
+ base.getXCoord(), base.getYCoord(), base.getZCoord(), 512));
+ } else {
+ base.issueTextureUpdate();
+ }
+ }
+ }
+
+ @Override
+ public final boolean isFacingValid(byte aFacing) {
+ return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing));
+ }
+
+ @Override
+ public void onFacingChange() {
+ toolSetDirection(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()));
+ }
+
+ @Override
+ public IAlignmentLimits getAlignmentLimits() {
+ return mLimits;
+ }
+
+ public abstract IStructureDefinition getStructureDefinition();
+
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ return UNLIMITED;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setByte("mRotation", (byte) mExtendedFacing.getRotation().getIndex());
+ aNBT.setByte("mFlip", (byte) mExtendedFacing.getFlip().getIndex());
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mExtendedFacing = ExtendedFacing.of(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()),
+ Rotation.byIndex(aNBT.getByte("mRotation")),
+ Flip.byIndex(aNBT.getByte("mFlip")));
+ }
+
+ @Override
+ public abstract GT_MetaTileEntity_EnhancedMultiBlockBase newMetaEntity(IGregTechTileEntity aTileEntity);
+
+ @SuppressWarnings("unchecked")
+ private IStructureDefinition> getCastedStructureDefinition() {
+ return (IStructureDefinition>) getStructureDefinition();
+ }
+
+ protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) {
+ IGregTechTileEntity tTile = getBaseMetaTileEntity();
+ return getCastedStructureDefinition().check(this, piece, tTile.getWorld(), getExtendedFacing(), tTile.getXCoord(), tTile.getYCoord(), tTile.getZCoord(), horizontalOffset, verticalOffset, depthOffset, !mMachine);
+ }
+
+ protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, int horizontalOffset, int verticalOffset, int depthOffset) {
+ IGregTechTileEntity tTile = getBaseMetaTileEntity();
+ return getCastedStructureDefinition().buildOrHints(this, trigger, piece, tTile.getWorld(), getExtendedFacing(), tTile.getXCoord(), tTile.getYCoord(), tTile.getZCoord(), horizontalOffset, verticalOffset, depthOffset, hintOnly);
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ if (aBaseMetaTileEntity.isClientSide())
+ StructureLibAPI.queryAlignment((IAlignmentProvider) aBaseMetaTileEntity);
+ }
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 0de4dfecbb..3b1a963c9e 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -26,6 +26,7 @@ import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
+import java.util.List;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.GT_Values.VN;
@@ -676,8 +677,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
return false;
}
- private boolean dumpFluid(FluidStack copiedFluidStack, boolean restrictiveHatchesOnly){
- for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ protected static boolean dumpFluid(List aOutputHatches, FluidStack copiedFluidStack, boolean restrictiveHatchesOnly){
+ for (GT_MetaTileEntity_Hatch_Output tHatch : aOutputHatches) {
if (!isValidMetaTileEntity(tHatch) || (restrictiveHatchesOnly && tHatch.mMode == 0)) {
continue;
}
@@ -709,8 +710,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public boolean addOutput(FluidStack aLiquid) {
if (aLiquid == null) return false;
FluidStack copiedFluidStack = aLiquid.copy();
- if (!dumpFluid(copiedFluidStack, true)){
- dumpFluid(copiedFluidStack, false);
+ if (!dumpFluid(mOutputHatches, copiedFluidStack, true)){
+ dumpFluid(mOutputHatches, copiedFluidStack, false);
}
return false;
}
--
cgit
From cb876c46e9f185b73556c1c8ed7ca2751cac2cdc Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Mon, 31 May 2021 01:09:30 +0800
Subject: Implement IConstructable for demo multis
---
.../api/metatileentity/BaseMetaTileEntity.java | 2 +-
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 35 +++++++++++++++++++++-
src/main/java/gregtech/api/util/GT_Utility.java | 15 +++++++++-
.../GT_MetaTileEntity_ElectricBlastFurnace.java | 17 ++---------
.../multi/GT_MetaTileEntity_MultiFurnace.java | 17 ++++++-----
5 files changed, 62 insertions(+), 24 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index d108236a39..6eb06d8fae 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -2383,7 +2383,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
@Override
public void setExtendedFacing(ExtendedFacing alignment) {
- setFrontFacing((byte) Math.max(alignment.getDirection().ordinal(), 5));
+ setFrontFacing((byte) Math.min(alignment.getDirection().ordinal(), ForgeDirection.UNKNOWN.ordinal() - 1));
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index 7d06378ce1..c3d41664b7 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -4,15 +4,21 @@ import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
+import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import com.gtnewhorizon.structurelib.alignment.enumerable.Flip;
import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import cpw.mods.fml.common.network.NetworkRegistry;
+import gregtech.api.GregTech_API;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
+import org.lwjgl.input.Keyboard;
+
+import java.util.concurrent.atomic.AtomicReferenceArray;
/**
* Enhanced multiblock base class, featuring following improvement over {@link GT_MetaTileEntity_MultiBlockBase}
@@ -22,7 +28,8 @@ import net.minecraftforge.common.util.ForgeDirection;
*
* @param type of this
*/
-public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase> extends GT_MetaTileEntity_MultiBlockBase implements IAlignment {
+public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase> extends GT_MetaTileEntity_MultiBlockBase implements IAlignment, IConstructable {
+ private static final AtomicReferenceArray tooltips = new AtomicReferenceArray<>(GregTech_API.METATILEENTITIES.length);
private ExtendedFacing mExtendedFacing;
private final IAlignmentLimits mLimits;
@@ -76,6 +83,32 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase getStructureDefinition();
+ protected abstract GT_Multiblock_Tooltip_Builder createTooltip();
+
+ @Override
+ public String[] getDescription() {
+ if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return getTooltip().getStructureInformation();
+ } else {
+ return getTooltip().getInformation();
+ }
+ }
+
+ protected GT_Multiblock_Tooltip_Builder getTooltip() {
+ int tId = getBaseMetaTileEntity().getMetaTileID();
+ GT_Multiblock_Tooltip_Builder tooltip = tooltips.get(tId);
+ if (tooltip == null) {
+ tooltip = createTooltip();
+ tooltips.set(tId, tooltip);
+ }
+ return tooltip;
+ }
+
+ @Override
+ public String[] getStructureDescription(ItemStack stackSize) {
+ return getTooltip().getStructureInformation();
+ }
+
protected IAlignmentLimits getInitialAlignmentLimits() {
return UNLIMITED;
}
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 28faeae7e3..c7cee8c9c2 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -3,6 +3,8 @@ package gregtech.api.util;
import cofh.api.transport.IItemDuct;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
+import com.gtnewhorizon.structurelib.alignment.IAlignment;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler;
import gregtech.api.GregTech_API;
@@ -1939,7 +1941,7 @@ public class GT_Utility {
tList.add("----- X: " +EnumChatFormatting.AQUA+ aX +EnumChatFormatting.RESET+ " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " D: " +EnumChatFormatting.AQUA+ aWorld.provider.dimensionId +EnumChatFormatting.RESET+ " -----");
try {
- if (tTileEntity != null && tTileEntity instanceof IInventory)
+ if (tTileEntity instanceof IInventory)
tList.add(trans("162","Name: ") +EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName() +EnumChatFormatting.RESET+ trans("163"," MetaData: ") +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ) +EnumChatFormatting.RESET);
else
tList.add(trans("162","Name: ") +EnumChatFormatting.BLUE+ tBlock.getUnlocalizedName() +EnumChatFormatting.RESET+ trans("163"," MetaData: ") +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ) +EnumChatFormatting.RESET);
@@ -1978,6 +1980,17 @@ public class GT_Utility {
} catch (Throwable e) {
if (D1) e.printStackTrace(GT_Log.err);
}
+ try {
+ if (tTileEntity instanceof IAlignmentProvider) {
+ IAlignment tAlignment = ((IAlignmentProvider) tTileEntity).getAlignment();
+ if (tAlignment != null) {
+ rEUAmount += 100;
+ tList.add(trans("219", "Extended Facing: ") + EnumChatFormatting.GREEN + tAlignment.getExtendedFacing() + EnumChatFormatting.RESET);
+ }
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
try {
if (tTileEntity instanceof ic2.api.tile.IWrenchable) {
rEUAmount += 100;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index 733710e539..149c7a4172 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -23,7 +23,6 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -70,8 +69,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
}
@Override
- public String[] getDescription() {
- final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ 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 Electric Blast Furnace")
.addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus")
@@ -95,11 +94,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
.addStructureInfo("Recovery amount scales with Muffler Hatch tier")
.addOutputHatch("Platline fluids, Any bottom layer casing")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -373,10 +368,4 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
public void construct(ItemStack stackSize, boolean hintsOnly) {
buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1,3,0);
}
-
- @Override
- public String[] getStructureDescription(ItemStack stackSize) {
- // TODO implement me
- return new String[0];
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index 14dfe6f237..aae7497f04 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
@@ -1,5 +1,6 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.GregTech_API;
@@ -29,7 +30,7 @@ import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
-public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMultiFurnace {
+public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMultiFurnace implements IConstructable {
private int mLevel = 0;
private int mCostDiscount = 1;
@@ -61,8 +62,8 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
}
@Override
- public String[] getDescription() {
- final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Furnace")
.addInfo("Controller Block for the Multi Smelter")
.addInfo("Smelts up to 8-128 items at once")
@@ -79,9 +80,7 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
.addInputBus("Any bottom casing")
.addOutputBus("Any bottom casing")
.toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
- return tt.getInformation();
- return tt.getStructureInformation();
+ return tt;
}
@Override
@@ -173,7 +172,7 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
mCoilLevel = null;
- if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 3, 0))
+ if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 2, 0))
return false;
if (mCoilLevel == null)
@@ -238,4 +237,8 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
};
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 2, 0);
+ }
}
--
cgit
From f812b4a50c922290d6cdee4d1e5e20530814abdc Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Mon, 31 May 2021 22:59:51 +0800
Subject: Add GT_MetaTileEntity_CubicMultiBlockBase and a few minor changes
1. add ofCoil() IStructureElement to standardise how to add a homogeneous set of coils to the structure definition
2. Changed newMetaEntity's return type back to IMetaTileEntity to prevent addons crying out
3. Initialize mExtendedFacing to ensure rendering code don't step on null
---
.../GT_MetaTileEntity_CubicMultiBlockBase.java | 111 +++++++++++++++++++++
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 9 +-
.../gregtech/api/util/GT_StructureUtility.java | 73 ++++++++++++++
.../java/gregtech/api/util/IGT_HatchAdder.java | 5 +-
.../GT_MetaTileEntity_AbstractMultiFurnace.java | 22 ++--
.../GT_MetaTileEntity_ElectricBlastFurnace.java | 18 ++--
.../GT_MetaTileEntity_ImplosionCompressor.java | 60 ++++-------
.../multi/GT_MetaTileEntity_MultiFurnace.java | 19 ++--
.../multi/GT_MetaTileEntity_ProcessingArray.java | 59 ++++-------
.../multi/GT_MetaTileEntity_VacuumFreezer.java | 85 ++++++----------
10 files changed, 288 insertions(+), 173 deletions(-)
create mode 100644 src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
new file mode 100644
index 0000000000..ef53c1bca2
--- /dev/null
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -0,0 +1,111 @@
+package gregtech.api.metatileentity.implementations;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.item.ItemStack;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+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;
+
+/**
+ * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere.
+ * Controller will be placed in front center of the structure.
+ *
+ * Note: You cannot use different casing for the same Class. Make a new subclass for it.
+ *
+ * Implementation tips:
+ * 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
+ * {@link #getStructureDefinition()} or change {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot
+ * stop the structure check early.
+ * 2. To limit rotation, override {@link #getInitialAlignmentLimits()}
+ *
+ * @param
+ */
+public abstract class GT_MetaTileEntity_CubicMultiBlockBase> extends GT_MetaTileEntity_EnhancedMultiBlockBase {
+ protected static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ConcurrentMap> STRUCTURE_DEFINITIONS = new ConcurrentHashMap<>();
+ private int mCasingAmount = 0;
+
+ protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ protected GT_MetaTileEntity_CubicMultiBlockBase(String aName) {
+ super(aName);
+ }
+
+
+ private static IStructureDefinition extends GT_MetaTileEntity_CubicMultiBlockBase>> createStructure(GT_MetaTileEntity_CubicMultiBlockBase> aTile) {
+ return StructureDefinition.>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"hhh", "hhh", "hhh"},
+ {"h-h", "hhh", "hhh"},
+ {"hhh", "hhh", "hhh"},
+ }))
+ .addElement('h', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, aTile.getHatchTextureIndex(), 1),
+ onElementPass(
+ GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
+ aTile.getCasingElement()
+ )
+ ))
+ .build();
+ }
+
+ /**
+ * Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere.
+ *
+ * The created definition contains a single piece named {@link #STRUCTURE_PIECE_MAIN}.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public IStructureDefinition getStructureDefinition() {
+ return (IStructureDefinition) STRUCTURE_DEFINITIONS.computeIfAbsent(getBaseMetaTileEntity().getMetaTileID(), o -> createStructure(this));
+ }
+
+ @Override
+ public void construct(ItemStack aStack, boolean aHintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, aStack, aHintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasingAmount = 0;
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) &&
+ mCasingAmount > getRequiredCasingCount() &&
+ checkHatches(aBaseMetaTileEntity, aStack);
+ }
+
+ /**
+ * Called by {@link #checkMachine(IGregTechTileEntity, ItemStack)} to check if all required hatches are present.
+ *
+ * Default implementation requires EXACTLY ONE maintenance hatch to be present, and ignore all other conditions.
+ *
+ * @param aBaseMetaTileEntity the tile entity of self
+ * @param aStack The item stack inside the controller
+ * @return true if the test passes, false otherwise
+ */
+ protected boolean checkHatches(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ return mMaintenanceHatches.size() == 1;
+ }
+
+ protected abstract IStructureElement> getCasingElement();
+
+ /**
+ * The hatch's texture index.
+ */
+ protected abstract int getHatchTextureIndex();
+
+ protected abstract int getRequiredCasingCount();
+
+ protected void onCorrectCasingAdded() {
+ mCasingAmount++;
+ }
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index c3d41664b7..89d2ce765e 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -30,17 +30,15 @@ import java.util.concurrent.atomic.AtomicReferenceArray;
*/
public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase> extends GT_MetaTileEntity_MultiBlockBase implements IAlignment, IConstructable {
private static final AtomicReferenceArray tooltips = new AtomicReferenceArray<>(GregTech_API.METATILEENTITIES.length);
- private ExtendedFacing mExtendedFacing;
- private final IAlignmentLimits mLimits;
+ private ExtendedFacing mExtendedFacing = ExtendedFacing.DEFAULT;
+ private final IAlignmentLimits mLimits = getInitialAlignmentLimits();
protected GT_MetaTileEntity_EnhancedMultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mLimits = getInitialAlignmentLimits();
}
protected GT_MetaTileEntity_EnhancedMultiBlockBase(String aName) {
super(aName);
- mLimits = getInitialAlignmentLimits();
}
@Override
@@ -128,9 +126,6 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase newMetaEntity(IGregTechTileEntity aTileEntity);
-
@SuppressWarnings("unchecked")
private IStructureDefinition> getCastedStructureDefinition() {
return (IStructureDefinition>) getStructureDefinition();
diff --git a/src/main/java/gregtech/api/util/GT_StructureUtility.java b/src/main/java/gregtech/api/util/GT_StructureUtility.java
index c8d845ec19..1db672245c 100644
--- a/src/main/java/gregtech/api/util/GT_StructureUtility.java
+++ b/src/main/java/gregtech/api/util/GT_StructureUtility.java
@@ -3,13 +3,24 @@ package gregtech.api.util;
import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.IStructureElementNoPlacement;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
+import java.util.function.BiConsumer;
+import java.util.function.BiPredicate;
+import java.util.function.Function;
+
+import static com.gtnewhorizon.structurelib.StructureLibAPI.HINT_BLOCK_META_GENERIC_11;
+
public class GT_StructureUtility {
+ public static final int HINT_COIL_DEFAULT_DOTS = HINT_BLOCK_META_GENERIC_11;
+
private GT_StructureUtility() {
throw new AssertionError("Not instantiable");
}
@@ -68,4 +79,66 @@ public class GT_StructureUtility {
}
};
}
+
+ /**
+ * Assume a default of LV coil. Assume all coils accepted. Assumes using {@link #HINT_COIL_DEFAULT_DOTS} as dots.
+ * @see #ofCoil(BiPredicate, Function, int, Block, int)
+ */
+ public static IStructureElement ofCoil(BiConsumer heatingCoilSetter, Function heatingCoilGetter) {
+ return ofCoil((t, l) -> {
+ heatingCoilSetter.accept(t, l);
+ return true;
+ }, heatingCoilGetter, HINT_COIL_DEFAULT_DOTS, GregTech_API.sBlockCasings5, 0);
+ }
+
+ /**
+ * Assumes using {@link #HINT_COIL_DEFAULT_DOTS} as dots
+ * @see #ofCoil(BiPredicate, Function, int, Block, int)
+ */
+ public static IStructureElement ofCoil(BiPredicate heatingCoilSetter, Function heatingCoilGetter, Block defaultCoil, int defaultMeta) {
+ return ofCoil(heatingCoilSetter, heatingCoilGetter, HINT_COIL_DEFAULT_DOTS, defaultCoil, defaultMeta);
+ }
+
+ /**
+ * Heating coil structure element.
+ * @param heatingCoilSetter Notify the controller of this new coil.
+ * Got called exactly once per coil.
+ * Might be called less times if structure test fails.
+ * If the setter returns false then it assumes the coil is rejected.
+ * @param heatingCoilGetter Get the current heating level. Null means no coil recorded yet.
+ * @param dots The hinting dots
+ * @param defaultCoil The block to place when auto constructing
+ * @param defaultMeta The block meta to place when auto constructing
+ */
+ public static IStructureElement ofCoil(BiPredicate heatingCoilSetter, Function heatingCoilGetter, int dots, Block defaultCoil, int defaultMeta) {
+ if (heatingCoilSetter == null || heatingCoilGetter == null) {
+ throw new IllegalArgumentException();
+ }
+ return new IStructureElement() {
+ @Override
+ public boolean check(T t, World world, int x, int y, int z) {
+ Block block = world.getBlock(x, y, z);
+ if (!(block instanceof IHeatingCoil))
+ return false;
+ HeatingCoilLevel existingLevel = heatingCoilGetter.apply(t),
+ newLevel = ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z));
+ if (existingLevel == null) {
+ return heatingCoilSetter.test(t, newLevel);
+ } else {
+ return newLevel == existingLevel;
+ }
+ }
+
+ @Override
+ public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
+ StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), dots);
+ return true;
+ }
+
+ @Override
+ public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
+ return world.setBlock(x, y, z, defaultCoil, defaultMeta, 3);
+ }
+ };
+ }
}
diff --git a/src/main/java/gregtech/api/util/IGT_HatchAdder.java b/src/main/java/gregtech/api/util/IGT_HatchAdder.java
index be0194fc65..362fddaf1f 100644
--- a/src/main/java/gregtech/api/util/IGT_HatchAdder.java
+++ b/src/main/java/gregtech/api/util/IGT_HatchAdder.java
@@ -6,9 +6,10 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public interface IGT_HatchAdder {
/**
* Callback to add hatch, needs to check if hatch is valid (and add it)
+ *
* @param iGregTechTileEntity hatch
- * @param aShort requested texture index, or null if not...
+ * @param aShort requested texture index, or null if not...
* @return managed to add hatch (structure still valid)
*/
- boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort);
+ boolean apply(T t, IGregTechTileEntity iGregTechTileEntity, Short aShort);
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java
index ad49c72313..2409c1660c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java
@@ -1,15 +1,13 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.enums.HeatingCoilLevel;
-import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
-import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
public abstract class GT_MetaTileEntity_AbstractMultiFurnace> extends GT_MetaTileEntity_EnhancedMultiBlockBase {
- protected HeatingCoilLevel mCoilLevel;
+ private HeatingCoilLevel mCoilLevel;
protected GT_MetaTileEntity_AbstractMultiFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -24,16 +22,6 @@ public abstract class GT_MetaTileEntity_AbstractMultiFurnace {
public GT_MetaTileEntity_ImplosionCompressor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -40,7 +40,7 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Implosion Compressor")
.addInfo("Explosions are fun")
@@ -57,11 +57,7 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
.addInputBus("Any casing")
.addOutputBus("Any casing")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -94,11 +90,6 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
return true;
}
- @Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList tInputList = getStoredInputs();
@@ -147,31 +138,18 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
}
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
- return false;
- }
- int tAmount = 0;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- for (int h = -1; h < 2; h++) {
- if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addMufflerToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16)) && (!addOutputToMachineList(tTileEntity, 16)) && (!addEnergyInputToMachineList(tTileEntity, 16))) {
- Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
- byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (((tBlock != GregTech_API.sBlockCasings2) || (tMeta != 0)) && ((tBlock != GregTech_API.sBlockCasings3) || (tMeta != 4))) {
- return false;
- }
- tAmount++;
- }
- }
- }
- }
- }
- return tAmount >= 16;
+ protected IStructureElement> getCasingElement() {
+ return ofChain(ofBlock(GregTech_API.sBlockCasings2, 0), ofBlock(GregTech_API.sBlockCasings3, 4));
+ }
+
+ @Override
+ protected int getHatchTextureIndex() {
+ return 17;
+ }
+
+ @Override
+ protected int getRequiredCasingCount() {
+ return 16;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index aae7497f04..96bc87ff74 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
@@ -13,20 +13,23 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_StructureUtility;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAdder;
import static gregtech.api.enums.GT_Values.VN;
-import static gregtech.api.enums.Textures.BlockIcons.*;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_GLOW;
+import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
@@ -44,7 +47,7 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
})
.addElement('c', ofBlock(GregTech_API.sBlockCasings1, CASING_INDEX))
.addElement('m', ofHatchAdder(GT_MetaTileEntity_MultiFurnace::addMufflerToMachineList, CASING_INDEX, 2))
- .addElement('C', ofBlockAdder(GT_MetaTileEntity_MultiFurnace::addCoil, GregTech_API.sBlockCasings5, 0))
+ .addElement('C', GT_StructureUtility.ofCoil(GT_MetaTileEntity_MultiFurnace::setCoilLevel, GT_MetaTileEntity_MultiFurnace::getCoilLevel))
.addElement('b', ofHatchAdderOptional(GT_MetaTileEntity_MultiFurnace::addBottomHatch, CASING_INDEX, 3, GregTech_API.sBlockCasings1, CASING_INDEX))
.build();
@@ -170,16 +173,16 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
replaceDeprecatedCoils(aBaseMetaTileEntity);
- mCoilLevel = null;
+ setCoilLevel(null);
if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 2, 0))
return false;
- if (mCoilLevel == null)
+ if (getCoilLevel() == null)
return false;
- this.mLevel = mCoilLevel.getLevel();
- this.mCostDiscount = mCoilLevel.getCostDiscount();
+ this.mLevel = getCoilLevel().getLevel();
+ this.mCostDiscount = getCoilLevel().getCostDiscount();
return true;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 684cead86c..cf29f13b9b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -1,5 +1,6 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
@@ -9,9 +10,9 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_CubicMultiBlockBase;
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_MultiBlockBase;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_ProcessingArray_Manager;
@@ -24,16 +25,15 @@ 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 org.apache.commons.lang3.ArrayUtils;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.enums.GT_Values.VN;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE;
@@ -41,7 +41,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_AR
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_GLOW;
import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity;
-public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMultiBlockBase {
private GT_Recipe mLastRecipe;
private int tTier = 0;
@@ -62,7 +62,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Processing Array")
.addInfo("Runs supplied machines as if placed in the world")
@@ -83,11 +83,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
.addOutputBus("Any casing")
.addOutputHatch("Any casing")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -146,11 +142,6 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
return aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.");
}
- @Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
private String mMachine = "";
@Override
@@ -328,32 +319,18 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
- return false;
- }
- int tAmount = 0;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- for (int h = -1; h < 2; h++) {
- if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 48)) && (!addInputToMachineList(tTileEntity, 48)) && (!addOutputToMachineList(tTileEntity, 48)) && (!addEnergyInputToMachineList(tTileEntity, 48))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) {
- return false;
- }
- tAmount++;
- }
- }
- }
- }
- }
- return tAmount >= 14;
+ protected IStructureElement> getCasingElement() {
+ return ofBlock(GregTech_API.sBlockCasings4, 0);
+ }
+
+ @Override
+ protected int getHatchTextureIndex() {
+ return 48;
+ }
+
+ @Override
+ protected int getRequiredCasingCount() {
+ return 14;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
index c800592d0d..0050799ea2 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
@@ -1,19 +1,19 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureUtility;
import gregtech.api.GregTech_API;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_CubicMultiBlockBase;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -23,7 +23,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZE
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
-public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMultiBlockBase {
public GT_MetaTileEntity_VacuumFreezer(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -38,25 +38,21 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc
}
@Override
- public String[] getDescription() {
- final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
- tt.addMachineType("Vacuum Freezer")
- .addInfo("Controller Block for the Vacuum Freezer")
- .addInfo("Cools hot ingots and cells")
- .addSeparator()
- .beginStructureBlock(3, 3, 3, true)
- .addController("Front center")
- .addCasingInfo("Frost Proof Machine Casing", 16)
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addInputBus("Any casing")
- .addOutputBus("Any casing")
- .toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Vacuum Freezer")
+ .addInfo("Controller Block for the Vacuum Freezer")
+ .addInfo("Cools hot ingots and cells")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Frost Proof Machine Casing", 16)
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputBus("Any casing")
+ .addOutputBus("Any casing")
+ .toolTipFinisher("Gregtech");
+ return tt;
}
@Override
@@ -95,11 +91,6 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc
return true;
}
- @Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList tInputList = getStoredInputs();
@@ -131,32 +122,18 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc
}
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
- return false;
- }
- int tAmount = 0;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- for (int h = -1; h < 2; h++) {
- if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) {
- return false;
- }
- tAmount++;
- }
- }
- }
- }
- }
- return tAmount >= 16;
+ protected IStructureElement> getCasingElement() {
+ return StructureUtility.ofBlock(GregTech_API.sBlockCasings2, 1);
+ }
+
+ @Override
+ protected int getHatchTextureIndex() {
+ return 17;
+ }
+
+ @Override
+ protected int getRequiredCasingCount() {
+ return 16;
}
@Override
--
cgit
From d736caaf43e43c2bd250f1b5d9a91c8dd06a6147 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Tue, 8 Jun 2021 06:31:42 +0800
Subject: allow gt wrench to rotate the front of controller
also cleaned up GT_Client.java a little bit.
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 13 +
src/main/java/gregtech/common/GT_Client.java | 475 +++++++++++----------
2 files changed, 251 insertions(+), 237 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index 89d2ce765e..d925cc1d84 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -13,6 +13,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
@@ -69,6 +70,18 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase ROTATABLE_VANILLA_BLOCKS;
+
+ private static final int[][] GRID_SWITCH_ARR = new int[][]{
+ {0, 5, 3, 1, 2, 4},
+ {5, 0, 1, 3, 2, 4},
+ {1, 3, 0, 5, 2, 4},
+ {3, 1, 5, 0, 2, 4},
+ {4, 2, 3, 1, 0, 5},
+ {2, 4, 3, 1, 5, 0},
+ };
+
+ public static final Transformation ROTATION_MARKER_TRANSFORM_CENTER = new Scale(0.5);
+ private static final Transformation[] ROTATION_MARKER_TRANSFORMS_SIDES = {
+ new Scale(0.25).with(new Translation(0, 0, 0.375)),
+ new Scale(0.25).with(new Translation(0.375, 0, 0)),
+ new Scale(0.25).with(new Translation(0, 0, -0.375)),
+ new Scale(0.25).with(new Translation(-0.375, 0, 0)),
+ };
+ private static final Transformation[] ROTATION_MARKER_TRANSFORMS_CORNER = {
+ new Scale(0.25).with(new Translation(0.375, 0, 0.375)),
+ new Scale(0.25).with(new Translation(-0.375, 0, 0.375)),
+ new Scale(0.25).with(new Translation(0.375, 0, -0.375)),
+ new Scale(0.25).with(new Translation(-0.375, 0, -0.375)),
+ };
static {
- ROTATABLE_VANILLA_BLOCKS = Arrays.asList(new Block[]{
- Blocks.piston, Blocks.sticky_piston, Blocks.furnace, Blocks.lit_furnace, Blocks.dropper, Blocks.dispenser, Blocks.chest, Blocks.trapped_chest, Blocks.ender_chest, Blocks.hopper,
- Blocks.pumpkin, Blocks.lit_pumpkin
- });
+ ROTATABLE_VANILLA_BLOCKS = Arrays.asList(Blocks.piston, Blocks.sticky_piston, Blocks.furnace, Blocks.lit_furnace, Blocks.dropper, Blocks.dispenser, Blocks.chest, Blocks.trapped_chest, Blocks.ender_chest, Blocks.hopper,
+ Blocks.pumpkin, Blocks.lit_pumpkin);
}
private final HashSet mCapeList = new HashSet<>();
public static final GT_PollutionRenderer mPollutionRenderer = new GT_PollutionRenderer();
private final GT_CapeRenderer mCapeRenderer;
- private final List mPosR;
- private final List mPosG;
- private final List mPosB;
- private final List mPosA = Arrays.asList(new Object[0]);
- private final List mNegR;
- private final List mNegG;
- private final List mNegB;
- private final List mNegA = Arrays.asList(new Object[0]);
- private final List mMoltenPosR;
- private final List mMoltenPosG;
- private final List mMoltenPosB;
- private final List mMoltenPosA = Arrays.asList(new Object[0]);
- private final List mMoltenNegR;
- private final List mMoltenNegG;
- private final List mMoltenNegB;
- private final List mMoltenNegA = Arrays.asList(new Object[0]);
+ private final List mPosR;
+ private final List mPosG;
+ private final List mPosB;
+ private final List mPosA = Collections.emptyList();
+ private final List mNegR;
+ private final List mNegG;
+ private final List mNegB;
+ private final List mNegA = Collections.emptyList();
+ private final List mMoltenPosR;
+ private final List mMoltenPosG;
+ private final List mMoltenPosB;
+ private final List mMoltenPosA = Collections.emptyList();
+ private final List mMoltenNegR;
+ private final List mMoltenNegG;
+ private final List mMoltenNegB;
+ private final List mMoltenNegA = Collections.emptyList();
private long mAnimationTick;
- /**This is the place to def the value used below**/
+ /**
+ * This is the place to def the value used below
+ **/
private long afterSomeTime;
private boolean mAnimationDirection;
private int mLastUpdatedBlockX;
@@ -92,57 +124,34 @@ public class GT_Client extends GT_Proxy
private GT_ClientPreference mPreference;
private boolean mFirstTick = false;
public GT_Client() {
- mCapeRenderer = new GT_CapeRenderer(mCapeList);
+ mCapeRenderer = new GT_CapeRenderer(mCapeList);
mAnimationTick = 0L;
mAnimationDirection = false;
isFirstClientPlayerTick = true;
mMessage = "";
- mPosR = Arrays.asList(new Materials[]{
- /**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
- Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone
- });
- mPosG = Arrays.asList(new Materials[]{
- /**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
- Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth
- });
- mPosB = Arrays.asList(new Materials[]{
- /**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
- Materials.InfusedWater, Materials.Thaumium
- });
- mNegR = Arrays.asList(new Materials[]{
- Materials.InfusedEntropy, Materials.NetherStar
- });
- mNegG = Arrays.asList(new Materials[]{
- Materials.InfusedEntropy, Materials.NetherStar
- });
- mNegB = Arrays.asList(new Materials[]{
- Materials.InfusedEntropy, Materials.NetherStar
- });
- mMoltenPosR = Arrays.asList(new Materials[]{
- Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
- Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone
- });
- mMoltenPosG = Arrays.asList(new Materials[]{
- Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
- Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth
- });
- mMoltenPosB = Arrays.asList(new Materials[]{
- Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
- Materials.InfusedWater, Materials.Thaumium
- });
- mMoltenNegR = Arrays.asList(new Materials[]{
- Materials.InfusedEntropy
- });
- mMoltenNegG = Arrays.asList(new Materials[]{
- Materials.InfusedEntropy
- });
- mMoltenNegB = Arrays.asList(new Materials[]{
- Materials.InfusedEntropy
- });
+ mPosR = Arrays.asList(Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
+ Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone);
+ mPosG = Arrays.asList(Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
+ Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth);
+ mPosB = Arrays.asList(Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
+ Materials.InfusedWater, Materials.Thaumium);
+ mNegR = Arrays.asList(Materials.InfusedEntropy, Materials.NetherStar);
+ mNegG = Arrays.asList(Materials.InfusedEntropy, Materials.NetherStar);
+ mNegB = Arrays.asList(Materials.InfusedEntropy, Materials.NetherStar);
+ mMoltenPosR = Arrays.asList(Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
+ Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone);
+ mMoltenPosG = Arrays.asList(Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
+ Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth);
+ mMoltenPosB = Arrays.asList(Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
+ Materials.InfusedWater, Materials.Thaumium);
+ mMoltenNegR = Collections.singletonList(Materials.InfusedEntropy);
+ mMoltenNegG = Collections.singletonList(Materials.InfusedEntropy);
+ mMoltenNegB = Collections.singletonList(Materials.InfusedEntropy);
}
private static boolean checkedForChicken = false;
+
private static void drawGrid(DrawBlockHighlightEvent aEvent, boolean showCoverConnections) {
if (!checkedForChicken) {
try {
@@ -159,11 +168,13 @@ public class GT_Client extends GT_Proxy
GL11.glPushMatrix();
GL11.glTranslated(-(aEvent.player.lastTickPosX + (aEvent.player.posX - aEvent.player.lastTickPosX) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosY + (aEvent.player.posY - aEvent.player.lastTickPosY) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosZ + (aEvent.player.posZ - aEvent.player.lastTickPosZ) * (double) aEvent.partialTicks));
GL11.glTranslated((float) aEvent.target.blockX + 0.5F, (float) aEvent.target.blockY + 0.5F, (float) aEvent.target.blockZ + 0.5F);
- Rotation.sideRotations[aEvent.target.sideHit].glApply();
+ int tSideHit = aEvent.target.sideHit;
+ Rotation.sideRotations[tSideHit].glApply();
+ // draw grid
GL11.glTranslated(0.0D, -0.501D, 0.0D);
GL11.glLineWidth(2.0F);
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.5F);
- GL11.glBegin(1);
+ GL11.glBegin(GL11.GL_LINES);
GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(+.50D, .0D, +.25D);
@@ -174,88 +185,118 @@ public class GT_Client extends GT_Proxy
GL11.glVertex3d(-.25D, .0D, +.50D);
TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
+ // draw turning indicator
+ if (tTile instanceof IGregTechTileEntity &&
+ ((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof IAlignmentProvider) {
+ IAlignment tAlignment = ((IAlignmentProvider) ((IGregTechTileEntity) tTile).getMetaTileEntity()).getAlignment();
+ if (tAlignment != null) {
+ ForgeDirection direction = tAlignment.getDirection();
+
+ GL11.glEnd();
+ if (direction.ordinal() == tSideHit)
+ drawRotationMarker(ROTATION_MARKER_TRANSFORM_CENTER);
+ else if (direction.getOpposite().ordinal() == tSideHit) {
+ for (Transformation t : ROTATION_MARKER_TRANSFORMS_CORNER) {
+ drawRotationMarker(t);
+ }
+ } else {
+ drawRotationMarker(ROTATION_MARKER_TRANSFORMS_SIDES[Rotation.rotationTo(direction.ordinal(), tSideHit)]);
+ }
+ // resume glBegin
+ GL11.glBegin(GL11.GL_LINES);
+ }
+ }
+
+ // draw connection indicators
byte tConnections = 0;
- if (tTile instanceof ICoverable){
+ if (tTile instanceof ICoverable) {
if (showCoverConnections) {
for (byte i = 0; i < 6; i++) {
- if ( ((ICoverable) tTile).getCoverIDAtSide(i) > 0)
- tConnections = (byte)(tConnections + (1 << i));
+ if (((ICoverable) tTile).getCoverIDAtSide(i) > 0)
+ tConnections = (byte) (tConnections + (1 << i));
}
- }
- else if (tTile instanceof BaseMetaPipeEntity)
+ } else if (tTile instanceof BaseMetaPipeEntity)
tConnections = ((BaseMetaPipeEntity) tTile).mConnections;
}
if (tConnections>0) {
- int[][] GridSwitchArr = new int[][]{
- {0, 5, 3, 1, 2, 4},
- {5, 0, 1, 3, 2, 4},
- {1, 3, 0, 5, 2, 4},
- {3, 1, 5, 0, 2, 4},
- {4, 2, 3, 1, 0, 5},
- {2, 4, 3, 1, 5, 0},
- };
- for (byte i = 0; i < 6; i++) {
- if ((tConnections & (1 << i)) != 0) {
- switch (GridSwitchArr[aEvent.target.sideHit][i]) {
- case 0:
- GL11.glVertex3d(+.25D, .0D, +.25D);
- GL11.glVertex3d(-.25D, .0D, -.25D);
- GL11.glVertex3d(-.25D, .0D, +.25D);
- GL11.glVertex3d(+.25D, .0D, -.25D);
- break;
- case 1:
- GL11.glVertex3d(-.25D, .0D, +.50D);
- GL11.glVertex3d(+.25D, .0D, +.25D);
- GL11.glVertex3d(-.25D, .0D, +.25D);
- GL11.glVertex3d(+.25D, .0D, +.50D);
- break;
- case 2:
- GL11.glVertex3d(-.50D, .0D, -.25D);
- GL11.glVertex3d(-.25D, .0D, +.25D);
- GL11.glVertex3d(-.50D, .0D, +.25D);
- GL11.glVertex3d(-.25D, .0D, -.25D);
- break;
- case 3:
- GL11.glVertex3d(-.25D, .0D, -.50D);
- GL11.glVertex3d(+.25D, .0D, -.25D);
- GL11.glVertex3d(-.25D, .0D, -.25D);
- GL11.glVertex3d(+.25D, .0D, -.50D);
- break;
- case 4:
- GL11.glVertex3d(+.50D, .0D, -.25D);
- GL11.glVertex3d(+.25D, .0D, +.25D);
- GL11.glVertex3d(+.50D, .0D, +.25D);
- GL11.glVertex3d(+.25D, .0D, -.25D);
- break;
- case 5:
- GL11.glVertex3d(+.50D, .0D, +.50D);
- GL11.glVertex3d(+.25D, .0D, +.25D);
- GL11.glVertex3d(+.50D, .0D, +.25D);
- GL11.glVertex3d(+.25D, .0D, +.50D);
- GL11.glVertex3d(+.50D, .0D, -.50D);
- GL11.glVertex3d(+.25D, .0D, -.25D);
- GL11.glVertex3d(+.50D, .0D, -.25D);
- GL11.glVertex3d(+.25D, .0D, -.50D);
- GL11.glVertex3d(-.50D, .0D, +.50D);
- GL11.glVertex3d(-.25D, .0D, +.25D);
- GL11.glVertex3d(-.50D, .0D, +.25D);
- GL11.glVertex3d(-.25D, .0D, +.50D);
- GL11.glVertex3d(-.50D, .0D, -.50D);
- GL11.glVertex3d(-.25D, .0D, -.25D);
- GL11.glVertex3d(-.50D, .0D, -.25D);
- GL11.glVertex3d(-.25D, .0D, -.50D);
- break;
- }
- }
- }
+ for (byte i = 0; i < 6; i++) {
+ if ((tConnections & (1 << i)) != 0) {
+ switch (GRID_SWITCH_ARR[aEvent.target.sideHit][i]) {
+ case 0:
+ GL11.glVertex3d(+.25D, .0D, +.25D);
+ GL11.glVertex3d(-.25D, .0D, -.25D);
+ GL11.glVertex3d(-.25D, .0D, +.25D);
+ GL11.glVertex3d(+.25D, .0D, -.25D);
+ break;
+ case 1:
+ GL11.glVertex3d(-.25D, .0D, +.50D);
+ GL11.glVertex3d(+.25D, .0D, +.25D);
+ GL11.glVertex3d(-.25D, .0D, +.25D);
+ GL11.glVertex3d(+.25D, .0D, +.50D);
+ break;
+ case 2:
+ GL11.glVertex3d(-.50D, .0D, -.25D);
+ GL11.glVertex3d(-.25D, .0D, +.25D);
+ GL11.glVertex3d(-.50D, .0D, +.25D);
+ GL11.glVertex3d(-.25D, .0D, -.25D);
+ break;
+ case 3:
+ GL11.glVertex3d(-.25D, .0D, -.50D);
+ GL11.glVertex3d(+.25D, .0D, -.25D);
+ GL11.glVertex3d(-.25D, .0D, -.25D);
+ GL11.glVertex3d(+.25D, .0D, -.50D);
+ break;
+ case 4:
+ GL11.glVertex3d(+.50D, .0D, -.25D);
+ GL11.glVertex3d(+.25D, .0D, +.25D);
+ GL11.glVertex3d(+.50D, .0D, +.25D);
+ GL11.glVertex3d(+.25D, .0D, -.25D);
+ break;
+ case 5:
+ GL11.glVertex3d(+.50D, .0D, +.50D);
+ GL11.glVertex3d(+.25D, .0D, +.25D);
+ GL11.glVertex3d(+.50D, .0D, +.25D);
+ GL11.glVertex3d(+.25D, .0D, +.50D);
+ GL11.glVertex3d(+.50D, .0D, -.50D);
+ GL11.glVertex3d(+.25D, .0D, -.25D);
+ GL11.glVertex3d(+.50D, .0D, -.25D);
+ GL11.glVertex3d(+.25D, .0D, -.50D);
+ GL11.glVertex3d(-.50D, .0D, +.50D);
+ GL11.glVertex3d(-.25D, .0D, +.25D);
+ GL11.glVertex3d(-.50D, .0D, +.25D);
+ GL11.glVertex3d(-.25D, .0D, +.50D);
+ GL11.glVertex3d(-.50D, .0D, -.50D);
+ GL11.glVertex3d(-.25D, .0D, -.25D);
+ GL11.glVertex3d(-.50D, .0D, -.25D);
+ GL11.glVertex3d(-.25D, .0D, -.50D);
+ break;
+ }
+ }
+ }
}
GL11.glEnd();
GL11.glPopMatrix();
}
- private static void drawGrid(DrawBlockHighlightEvent aEvent) {
- drawGrid(aEvent, false);
+ private static void drawRotationMarker(Transformation transform) {
+ GL11.glPushMatrix();
+ transform.glApply();
+ Tessellator t = Tessellator.instance;
+ t.startDrawing(GL11.GL_LINE_LOOP);
+ t.addVertex(-0.4d, 0d, -0.4d);
+ t.addVertex(-0.4d, 0d, 0.4d);
+ t.addVertex(0.4d, 0d, 0.4d);
+ t.addVertex(0.4d, 0d, -0.325d);
+ t.addVertex(0.45d, 0d, -0.325d);
+ t.addVertex(0.35d, 0d, -0.425d);
+ t.addVertex(0.25d, 0d, -0.325d);
+ t.addVertex(0.3d, 0d, -0.325d);
+ t.addVertex(0.3d, 0d, 0.3d);
+ t.addVertex(-0.3d, 0d, 0.3d);
+ t.addVertex(-0.3d, 0d, -0.4d);
+ t.draw();
+ GL11.glPopMatrix();
}
@Override
@@ -286,7 +327,7 @@ public class GT_Client extends GT_Proxy
@Override
public void onPreLoad() {
super.onPreLoad();
- String arr$[] = {
+ String[] arr = {
"renadi", "hanakocz", "MysteryDump", "Flaver4", "x_Fame", "Peluche321", "Goshen_Ithilien", "manf", "Bimgo", "leagris",
"IAmMinecrafter02", "Cerous", "Devilin_Pixy", "Bkarlsson87", "BadAlchemy", "CaballoCraft", "melanclock", "Resursator", "demanzke", "AndrewAmmerlaan",
"Deathlycraft", "Jirajha", "Axlegear", "kei_kouma", "Dracion", "dungi", "Dorfschwein", "Zero Tw0", "mattiagraz85", "sebastiank30",
@@ -301,12 +342,10 @@ public class GT_Client extends GT_Proxy
"25FiveDetail", "AntiCivilBoy", "michaelbrady", "xXxIceFirexXx", "Speedynutty68", "GarretSidzaka", "HallowCharm977", "mastermind1919", "The_Hypersonic", "diamondguy2798",
"zF4ll3nPr3d4t0r", "CrafterOfMines57", "XxELIT3xSNIP3RxX", "SuterusuKusanagi", "xavier0014", "adamros", "alexbegt"
};
- int len$ = arr$.length;
- for (int i$ = 0; i$ < len$; i$++) {
- String tName = arr$[i$];
+ for (String tName : arr) {
mCapeList.add(tName.toLowerCase());
}
- (new Thread(this)).start();
+ new Thread(this).start();
mPollutionRenderer.preLoad();
@@ -356,47 +395,29 @@ public class GT_Client extends GT_Proxy
@Override
public void run() {
- try {
- GT_Log.out.println("GT_Mod: Downloading Cape List.");
- @SuppressWarnings("resource")
- Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream());
+ GT_Log.out.println("GT_Mod: Downloading Cape List.");
+ try (Scanner tScanner = new Scanner(new URL(GT_CAPE_LIST_URL).openStream())) {
while (tScanner.hasNextLine()) {
- String tName = tScanner.nextLine();
- if (!this.mCapeList.contains(tName.toLowerCase())) {
- this.mCapeList.add(tName.toLowerCase());
- }
+ this.mCapeList.add(tScanner.nextLine().toLowerCase());
}
} catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
}
- try {
- GT_Log.out.println("GT New Horizons: Downloading Cape List.");
- @SuppressWarnings("resource")
- Scanner tScanner = new Scanner(new URL("https://raw.githubusercontent.com/GTNewHorizons/CustomGTCapeHook-Cape-List/master/capes.txt").openStream());
- while (tScanner.hasNextLine()) {
- String tName = tScanner.nextLine();
- if (tName.contains(":")) {
- int splitLocation = tName.indexOf(":");
- String username = tName.substring(0, splitLocation);
- if (!this.mCapeList.contains(username.toLowerCase()) && !this.mCapeList.contains(tName.toLowerCase())) {
- this.mCapeList.add(tName.toLowerCase());
- }
- } else {
- if (!this.mCapeList.contains(tName.toLowerCase())) {
- this.mCapeList.add(tName.toLowerCase());
- }
- }
- }
- } catch (Throwable e) {
- }
- /**try {
- GT_Log.out.println("GT_Mod: Downloading News.");
- @SuppressWarnings("resource")
- Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream());
+ GT_Log.out.println("GT New Horizons: Downloading Cape List.");
+ try (Scanner tScanner = new Scanner(new URL(GTNH_CAPE_LIST_URL).openStream())) {
while (tScanner.hasNextLine()) {
- this.mMessage = (this.mMessage + tScanner.nextLine() + " ");
+ String tName = tScanner.nextLine().toLowerCase();
+ if (tName.contains(":")) {
+ if (!this.mCapeList.contains(tName.substring(0, tName.indexOf(":")))) {
+ this.mCapeList.add(tName);
+ }
+ } else {
+ this.mCapeList.add(tName);
+ }
}
} catch (Throwable e) {
- }**/
+ e.printStackTrace(GT_Log.err);
+ }
}
@Override
@@ -418,34 +439,31 @@ public class GT_Client extends GT_Proxy
GT_Values.NW.sendToServer(new GT_Packet_ClientPreference(mPreference));
}
afterSomeTime++;
- if(afterSomeTime>=100L) {
- afterSomeTime=0;
- StatFileWriter sfw= Minecraft.getMinecraft().thePlayer.getStatFileWriter();
+ if (afterSomeTime >= 100L) {
+ afterSomeTime = 0;
+ StatFileWriter sfw = Minecraft.getMinecraft().thePlayer.getStatFileWriter();
try {
- for(GT_Recipe recipe:GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.mRecipeList) {
- recipe.mHidden=GT_Values.hideAssLineRecipes && !sfw.hasAchievementUnlocked(GT_Mod.achievements.getAchievement(recipe.getOutput(0).getUnlocalizedName()));
+ for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.mRecipeList) {
+ recipe.mHidden = GT_Values.hideAssLineRecipes && !sfw.hasAchievementUnlocked(GT_Mod.achievements.getAchievement(recipe.getOutput(0).getUnlocalizedName()));
}
- } catch (Exception ignored){}
+ } catch (Exception ignored) {
+ }
}
- ArrayList tList = new ArrayList();
- for (Map.Entry tEntry : GT_Utility.sPlayedSoundMap.entrySet()) {
- if (tEntry.getValue().intValue() < 0) {//Integer -> Integer -> int? >_<, fix
- tList.add(tEntry.getKey());
+ for (Iterator> iterator = GT_Utility.sPlayedSoundMap.entrySet().iterator(); iterator.hasNext(); ) {
+ Map.Entry tEntry = iterator.next();
+ if (tEntry.getValue() < 0) {
+ iterator.remove();
} else {
- tEntry.setValue(Integer.valueOf(tEntry.getValue().intValue() - 1));
+ tEntry.setValue(tEntry.getValue() - 1);
}
}
- GT_PlayedSound tKey;
- for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Utility.sPlayedSoundMap.remove(tKey)) {
- tKey = (GT_PlayedSound) i$.next();
- }
- if(!GregTech_API.mServerStarted) GregTech_API.mServerStarted = true;
+ if (!GregTech_API.mServerStarted) GregTech_API.mServerStarted = true;
if (GT_Values.updateFluidDisplayItems) {
MovingObjectPosition trace = Minecraft.getMinecraft().objectMouseOver;
if (trace != null && trace.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK &&
(mLastUpdatedBlockX != trace.blockX &&
- mLastUpdatedBlockY != trace.blockY &&
- mLastUpdatedBlockZ != trace.blockZ || afterSomeTime % 10 == 0)) {
+ mLastUpdatedBlockY != trace.blockY &&
+ mLastUpdatedBlockZ != trace.blockZ || afterSomeTime % 10 == 0)) {
mLastUpdatedBlockX = trace.blockX;
mLastUpdatedBlockY = trace.blockY;
mLastUpdatedBlockZ = trace.blockZ;
@@ -508,102 +526,85 @@ public class GT_Client extends GT_Proxy
public void receiveRenderEvent(net.minecraftforge.client.event.RenderPlayerEvent.Pre aEvent) {
if (GT_Utility.getFullInvisibility(aEvent.entityPlayer)) {
aEvent.setCanceled(true);
- return;
- } else {
- return;
}
}
@SubscribeEvent
public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) {
if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) {
- if(changeDetected>0)changeDetected--;
- int newHideValue=shouldHeldItemHideThings();
- if(newHideValue!=hideValue){
- hideValue=newHideValue;
- changeDetected=5;
+ if (changeDetected > 0) changeDetected--;
+ int newHideValue = shouldHeldItemHideThings();
+ if (newHideValue != hideValue) {
+ hideValue = newHideValue;
+ changeDetected = 5;
}
mAnimationTick++;
- if (mAnimationTick % 50L == 0L)
- {mAnimationDirection = !mAnimationDirection;}
+ if (mAnimationTick % 50L == 0L) {
+ mAnimationDirection = !mAnimationDirection;
+ }
int tDirection = mAnimationDirection ? 1 : -1;
- for (Iterator i$ = mPosR.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Object o : mPosR) {
+ Materials tMaterial = (Materials) o;
tMaterial.mRGBa[0] += tDirection;
}
- for (Iterator i$ = mPosG.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mPosG) {
tMaterial.mRGBa[1] += tDirection;
}
- for (Iterator i$ = mPosB.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mPosB) {
tMaterial.mRGBa[2] += tDirection;
}
- for (Iterator i$ = mPosA.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mPosA) {
tMaterial.mRGBa[3] += tDirection;
}
- for (Iterator i$ = mNegR.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mNegR) {
tMaterial.mRGBa[0] -= tDirection;
}
- for (Iterator i$ = mNegG.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mNegG) {
tMaterial.mRGBa[1] -= tDirection;
}
- for (Iterator i$ = mNegB.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mNegB) {
tMaterial.mRGBa[2] -= tDirection;
}
- for (Iterator i$ = mNegA.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mNegA) {
tMaterial.mRGBa[3] -= tDirection;
}
- for (Iterator i$ = mMoltenPosR.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenPosR) {
tMaterial.mMoltenRGBa[0] += tDirection;
}
- for (Iterator i$ = mMoltenPosG.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenPosG) {
tMaterial.mMoltenRGBa[1] += tDirection;
}
- for (Iterator i$ = mMoltenPosB.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenPosB) {
tMaterial.mMoltenRGBa[2] += tDirection;
}
- for (Iterator i$ = mMoltenPosA.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenPosA) {
tMaterial.mMoltenRGBa[3] += tDirection;
}
- for (Iterator i$ = mMoltenNegR.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenNegR) {
tMaterial.mMoltenRGBa[0] -= tDirection;
}
- for (Iterator i$ = mMoltenNegG.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenNegG) {
tMaterial.mMoltenRGBa[1] -= tDirection;
}
- for (Iterator i$ = mMoltenNegB.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenNegB) {
tMaterial.mMoltenRGBa[2] -= tDirection;
}
- for (Iterator i$ = mMoltenNegA.iterator(); i$.hasNext(); ) {
- Materials tMaterial = (Materials) i$.next();
+ for (Materials tMaterial : mMoltenNegA) {
tMaterial.mMoltenRGBa[3] -= tDirection;
}
@@ -620,8 +621,8 @@ public class GT_Client extends GT_Proxy
do {
if (i >= j)
break;
- if (GT_Utility.areStacksEqual((ItemStack) mSoundItems.get(i), aStack)) {
- tString = (String) mSoundNames.get(i);
+ if (GT_Utility.areStacksEqual(mSoundItems.get(i), aStack)) {
+ tString = mSoundNames.get(i);
break;
}
i++;
--
cgit
From 38e0b4eb935f8aa4d5950889eb1928af085af192 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Tue, 8 Jun 2021 08:54:20 +0800
Subject: migrate a few more multis over
also removed the stupid ConcurrentHashMap in GT_MetaTileEntity_CubicMultiBlockBase
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../GT_MetaTileEntity_CubicMultiBlockBase.java | 39 ++--
.../multi/GT_MetaTileEntity_DieselEngine.java | 117 ++++--------
.../multi/GT_MetaTileEntity_DistillationTower.java | 212 +++++++++++----------
.../GT_MetaTileEntity_ElectricBlastFurnace.java | 2 +
.../GT_MetaTileEntity_ExtremeDieselEngine.java | 17 +-
.../multi/GT_MetaTileEntity_LargeTurbine.java | 147 ++++++--------
.../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 9 +-
.../GT_MetaTileEntity_LargeTurbine_HPSteam.java | 9 +-
.../GT_MetaTileEntity_LargeTurbine_Plasma.java | 11 +-
.../GT_MetaTileEntity_LargeTurbine_Steam.java | 9 +-
10 files changed, 244 insertions(+), 328 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
index ef53c1bca2..c84ca61eec 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -6,9 +6,7 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.item.ItemStack;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
@@ -30,7 +28,20 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
*/
public abstract class GT_MetaTileEntity_CubicMultiBlockBase> extends GT_MetaTileEntity_EnhancedMultiBlockBase {
protected static final String STRUCTURE_PIECE_MAIN = "main";
- private static final ConcurrentMap> STRUCTURE_DEFINITIONS = new ConcurrentHashMap<>();
+ protected static final IStructureDefinition> STRUCTURE_DEFINITION = StructureDefinition.>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"hhh", "hhh", "hhh"},
+ {"h-h", "hhh", "hhh"},
+ {"hhh", "hhh", "hhh"},
+ }))
+ .addElement('h', ofChain(
+ defer(t -> ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, t.getHatchTextureIndex(), 1)),
+ onElementPass(
+ GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
+ defer(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)
+ )
+ ))
+ .build();
private int mCasingAmount = 0;
protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) {
@@ -41,24 +52,6 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase> createStructure(GT_MetaTileEntity_CubicMultiBlockBase> aTile) {
- return StructureDefinition.>builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {"hhh", "hhh", "hhh"},
- {"h-h", "hhh", "hhh"},
- {"hhh", "hhh", "hhh"},
- }))
- .addElement('h', ofChain(
- ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, aTile.getHatchTextureIndex(), 1),
- onElementPass(
- GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
- aTile.getCasingElement()
- )
- ))
- .build();
- }
-
/**
* Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere.
*
@@ -67,7 +60,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase getStructureDefinition() {
- return (IStructureDefinition) STRUCTURE_DEFINITIONS.computeIfAbsent(getBaseMetaTileEntity().getMetaTileID(), o -> createStructure(this));
+ return (IStructureDefinition) STRUCTURE_DEFINITION;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
index e697208a4a..1783a0c328 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
@@ -1,15 +1,16 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
@@ -21,18 +22,35 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Collection;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
-
-public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlockBase {
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
+
+public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMultiBlockBase {
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"---", "iii", "chc", "chc", "ccc", },
+ {"---", "i~i", "hgh", "hgh", "cdc", },
+ {"---", "iii", "chc", "chc", "ccc", },
+ }))
+ .addElement('i', defer(t -> ofBlock(t.getIntakeBlock(), t.getIntakeMeta())))
+ .addElement('c', defer(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta())))
+ .addElement('g', defer(t -> ofBlock(t.getGearboxBlock(), t.getGearboxMeta())))
+ .addElement('d', defer(t -> ofHatchAdder(GT_MetaTileEntity_DieselEngine::addDynamoToMachineList, t.getCasingTextureIndex(), 0)))
+ .addElement('h', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_DieselEngine::addToMachineList, t.getCasingTextureIndex(), 0, t.getCasingBlock(), t.getCasingMeta())))
+ .build();
protected int fuelConsumption = 0;
protected int fuelValue = 0;
protected int fuelRemaining = 0;
@@ -41,13 +59,13 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
public GT_MetaTileEntity_DieselEngine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
-
+
public GT_MetaTileEntity_DieselEngine(String aName) {
super(aName);
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Combustion Generator")
.addInfo("Controller block for the Large Combustion Engine")
@@ -71,11 +89,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
.addInputHatch("Lubricant, next to a Gear Box")
.addInputHatch("Oxygen, optional, next to a Gear Box")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -83,12 +97,12 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
casingTexturePages[0][50],
- TextureFactory.of(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
casingTexturePages[0][50],
- TextureFactory.of(OVERLAY_FRONT_DIESEL_ENGINE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_GLOW).extFacing().glow().build()};
}
return new ITexture[]{casingTexturePages[0][50]};
}
@@ -182,67 +196,13 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
}
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- byte tSide = getBaseMetaTileEntity().getBackFacing();
- int tX = getBaseMetaTileEntity().getXCoord();
- int tY = getBaseMetaTileEntity().getYCoord();
- int tZ = getBaseMetaTileEntity().getZCoord();
-
- if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, 1) != getGearboxBlock() && getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, 2) != getGearboxBlock()) {
- return false;
- }
- if(getBaseMetaTileEntity().getMetaIDAtSideAndDistance(tSide, 1) != getGearboxMeta() && getBaseMetaTileEntity().getMetaIDAtSideAndDistance(tSide, 2) != getGearboxMeta()) {
- return false;
- }
- for (byte i = -1; i < 2; i = (byte) (i + 1)) {
- for (byte j = -1; j < 2; j = (byte) (j + 1)) {
- if ((i != 0) || (j != 0)) {
- for (byte k = 0; k < 4; k = (byte) (k + 1)) {
-
- final int fX = tX - (tSide == 5 ? 1 : tSide == 4 ? -1 : i),
- fZ = tZ - (tSide == 2 ? -1 : tSide == 3 ? 1 : i),
- aY = tY + j,
- aX = tX + (tSide == 5 ? k : tSide == 4 ? -k : i),
- aZ = tZ + (tSide == 2 ? -k : tSide == 3 ? k : i);
-
- final Block frontAir = getBaseMetaTileEntity().getBlock(fX, aY, fZ);
- final String frontAirName = frontAir.getUnlocalizedName();
- if(!(getBaseMetaTileEntity().getAir(fX, aY, fZ) || frontAirName.equalsIgnoreCase("tile.air") || frontAirName.equalsIgnoreCase("tile.railcraft.residual.heat"))) {
- return false; //Fail if vent blocks are obstructed
- }
+ public IStructureDefinition getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
- if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2))) {
- if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) {
- // Do nothing
- } else if (!addMufflerToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? 2 : tSide == 4 ? -2 : 0), tY + 1, tZ + (tSide == 3 ? 2 : tSide == 2 ? -2 : 0)), getCasingTextureIndex())) {
- return false; //Fail if no muffler top middle back
- } else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ))) {
- return false;
- }
- } else if (k == 0) {
- if(!(getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getIntakeBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getIntakeMeta())) {
- return false;
- }
- } else if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) {
- // Do nothing
- } else {
- return false;
- }
- }
- }
- }
- }
- this.mDynamoHatches.clear();
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3);
- if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
- if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
- this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity());
- ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).updateTexture(getCasingTextureIndex());
- } else {
- return false;
- }
- }
- return true;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 1) && !mMufflerHatches.isEmpty() && mMaintenanceHatches.size() == 1;
}
public Block getCasingBlock() {
@@ -353,4 +313,9 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
public boolean isGivingInformation() {
return true;
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 1, 1);
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index e12f36f331..ff7b801b15 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -1,5 +1,8 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+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.enums.Textures.BlockIcons;
@@ -7,30 +10,63 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.render.TextureFactory;
-import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
+import java.util.List;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir;
+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.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_EnhancedMultiBlockBase {
private static final int CASING_INDEX = 49;
- private short controllerY;
+ protected static final String STRUCTURE_PIECE_BASE = "base";
+ protected static final String STRUCTURE_PIECE_LAYER = "layer";
+ private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][]{
+ {"b~b", "bbb", "bbb"},
+ }))
+ .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][]{
+ {"lll", "lcl", "lll"}
+ }))
+ .addElement('b', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addOutputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_DistillationTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ .addElement('l', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_DistillationTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ .addElement('c', ofChain(
+ onElementPass(GT_MetaTileEntity_DistillationTower::onTopLayerFound, ofBlock(GregTech_API.sBlockCasings4, 1)),
+ isAir()
+ ))
+ .build();
+ private final List> mOutputHatchesByLayer = new ArrayList<>();
+ private int mHeight;
+ private int mCasing;
+ private boolean mTopLayerFound;
public GT_MetaTileEntity_DistillationTower(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -46,7 +82,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
}
@Override
- public String[] getDescription() {
+ 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")
@@ -62,11 +98,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
.addOutputBus("Any bottom layer casing")
.addOutputHatch("2-11x Output Hatches (One per layer except bottom layer)")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -75,12 +107,12 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
if (aActive)
return new ITexture[]{
BlockIcons.getCasingTextureForId(CASING_INDEX),
- TextureFactory.of(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
BlockIcons.getCasingTextureForId(CASING_INDEX),
- TextureFactory.of(OVERLAY_FRONT_DISTILLATION_TOWER),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow().build()};
}
return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)};
}
@@ -100,14 +132,8 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
return true;
}
- @Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
@Override
public boolean checkRecipe(ItemStack aStack) {
-
ArrayList tFluidList = getStoredFluids();
for (int i = 0; i < tFluidList.size() - 1; i++) {
for (int j = i + 1; j < tFluidList.size(); j++) {
@@ -152,63 +178,54 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
return false;
}
+ private void onCasingFound() {
+ mCasing++;
+ }
+
+ private void onTopLayerFound() {
+ mTopLayerFound = true;
+ onCasingFound();
+ }
+
+ private boolean addLayerOutputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null || aTileEntity.isDead() || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output))
+ return false;
+ while (mOutputHatchesByLayer.size() < mHeight + 1)
+ mOutputHatchesByLayer.add(new ArrayList<>());
+ GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aTileEntity.getMetaTileEntity();
+ tHatch.updateTexture(aBaseCasingIndex);
+ return mOutputHatchesByLayer.get(mHeight).add(tHatch);
+ }
+
+ @Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ // don't rotate a freaking tower, it won't work
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated();
+ }
+
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- controllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int y = 0; //height
- int casingAmount = 0;
- boolean reachedTop = false;
+ // reset
+ mOutputHatchesByLayer.forEach(List::clear);
+ mHeight = 1;
+ mTopLayerFound = false;
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
- for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
- if (x != 0 || z != 0) {
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (!addInputToMachineList(tileEntity, CASING_INDEX)
- && !addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- casingAmount++;
- } else {
- return false;
- }
- }
- }
- }
- }
- y++;
+ // check base
+ if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0))
+ return false;
- while (y < 12 && !reachedTop) {
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
- for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
- if (x != xDir || z != zDir) {
- return false;
- }
- } else {
- if (x == xDir && z == zDir) {
- reachedTop = true;
- }
- if (!addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- casingAmount++;
- } else {
- return false;
- }
- }
- }
- }
- }
- y++;
- }
- return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ // check each layer
+ while (mHeight < 12 && checkPiece(STRUCTURE_PIECE_LAYER, 1, mHeight, 0) && !mTopLayerFound)
+ // not top
+ mHeight++;
+
+ // validate final invariants...
+ return mCasing >= 7 * mHeight - 5 && mHeight >= 2 && mTopLayerFound && mMaintenanceHatches.size() == 1;
}
@Override
@@ -226,40 +243,25 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
return 0;
}
-
@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
-@Override
- public boolean addOutput(FluidStack aLiquid) {
- if (aLiquid == null) return false;
- FluidStack tLiquid = aLiquid.copy();
- for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
- if (tHatch.getBaseMetaTileEntity().getYCoord() == this.controllerY + 1) {
- int tAmount = tHatch.fill(tLiquid, false);
- if (tAmount >= tLiquid.amount) {
- return tHatch.fill(tLiquid, true) >= tLiquid.amount;
- } else if (tAmount > 0) {
- tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
- }
- }
- }
- }
- return false;
- }
-
- @Override
- protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
- for (int i = 0; i < mOutputFluids2.length; i++) {
- if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
- if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.controllerY + 1 + i) {
- mOutputHatches.get(i).fill(mOutputFluids2[i], true);
- }
- }
- }
+ @Override
+ protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
+ for (int i = 0; i < mOutputFluids2.length && i < mOutputHatchesByLayer.size(); i++) {
+ FluidStack tStack = mOutputFluids2[i].copy();
+ if (!dumpFluid(mOutputHatchesByLayer.get(i), tStack, true))
+ dumpFluid(mOutputHatchesByLayer.get(i), tStack, false);
+ }
+ }
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 1, 0, 0);
+ for (int i = 1; i < 12; i++) {
+ buildPiece(STRUCTURE_PIECE_LAYER, stackSize, hintsOnly, 1, i, 0);
}
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index b7f09203e0..010a73f777 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -264,6 +264,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
if (getCoilLevel() == null)
return false;
+ if (mMaintenanceHatches.size() != 1)
+
this.mHeatingCapacity = (int) getCoilLevel().getHeat() + 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2);
return true;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
index 2457a65dec..f85f27935e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
@@ -16,7 +16,6 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-import org.lwjgl.input.Keyboard;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE;
@@ -35,7 +34,7 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Combustion Generator")
.addInfo("Controller block for the Extreme Combustion Engine")
@@ -59,11 +58,7 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die
.addInputHatch("Lubricant, next to a Gear Box")
.addInputHatch("Liquid Oxygen, optional, next to a Gear Box")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -76,12 +71,12 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
casingTexturePages[0][60],
- TextureFactory.of(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
casingTexturePages[0][60],
- TextureFactory.of(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW).extFacing().glow().build()};
}
return new ITexture[]{casingTexturePages[0][60]};
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
index a43de4cd9d..55c22900bd 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
@@ -1,36 +1,63 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElementCheckOnly;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
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_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlockBase {
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
+
+public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_EnhancedMultiBlockBase {
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {" ", " xxx ", " ", " ", " ",},
+ {" --- ", "xcccx", " chc ", " chc ", " ccc ",},
+ {" --- ", "xc~cx", " h-h ", " h-h ", " cdc ",},
+ {" --- ", "xcccx", " chc ", " chc ", " ccc ",},
+ {" ", " xxx ", " ", " ", " ",},
+ }))
+ .addElement('c', defer(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta())))
+ .addElement('d', defer(t -> ofHatchAdder(GT_MetaTileEntity_LargeTurbine::addDynamoToMachineList, t.getCasingTextureIndex(), 0)))
+ .addElement('h', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_LargeTurbine::addToMachineList, t.getCasingTextureIndex(), 0, t.getCasingBlock(), t.getCasingMeta())))
+ .addElement('x', (IStructureElementCheckOnly) (aContext, aWorld, aX, aY, aZ) -> {
+ TileEntity tTile = aWorld.getTileEntity(aX, aY, aZ);
+ return !(tTile instanceof IGregTechTileEntity) || !(((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine);
+ })
+ .build();
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 boolean looseFit = false;
public GT_MetaTileEntity_LargeTurbine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
+
public GT_MetaTileEntity_LargeTurbine(String aName) {
super(aName);
}
@@ -45,67 +72,14 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png");
}
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- byte tSide = getBaseMetaTileEntity().getBackFacing();
- if ((getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2))) {
- int tAirCount = 0;
- for (byte i = -1; i < 2; i = (byte) (i + 1)) {
- for (byte j = -1; j < 2; j = (byte) (j + 1)) {
- for (byte k = -1; k < 2; k = (byte) (k + 1)) {
- if (getBaseMetaTileEntity().getAirOffset(i, j, k)) {
- tAirCount++;
- }
- }
- }
- }
- if (tAirCount != 10) {
- return false;
- }
- for (byte i = 2; i < 6; i = (byte) (i + 1)) {
- IGregTechTileEntity tTileEntity;
- if ((null != (tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) &&
- (tTileEntity.getFrontFacing() == getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) &&
- ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine))) {
- return false;
- }
- }
- int tX = getBaseMetaTileEntity().getXCoord();
- int tY = getBaseMetaTileEntity().getYCoord();
- int tZ = getBaseMetaTileEntity().getZCoord();
- for (byte i = -1; i < 2; i = (byte) (i + 1)) {
- for (byte j = -1; j < 2; j = (byte) (j + 1)) {
- if ((i != 0) || (j != 0)) {
- for (byte k = 0; k < 4; k = (byte) (k + 1)) {
- if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2))) {
- if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) {
- } else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)))) {
- return false;
- }
- } else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) {
- } else {
- return false;
- }
- }
- }
- }
- }
- this.mDynamoHatches.clear();
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3);
- if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
- if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
- this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity());
- ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).updateTexture(getCasingTextureIndex());
- } else {
- return false;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
- return true;
+ return checkPiece(STRUCTURE_PIECE_MAIN, 2, 2, 1);
}
public abstract Block getCasingBlock();
@@ -114,11 +88,11 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
public abstract byte getCasingTextureIndex();
- private boolean addToMachineList(IGregTechTileEntity tTileEntity) {
- return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex())));
+ @Override
+ public boolean addToMachineList(IGregTechTileEntity tTileEntity, int aBaseCasingIndex) {
+ return addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex()) || addInputToMachineList(tTileEntity, getCasingTextureIndex()) || addOutputToMachineList(tTileEntity, getCasingTextureIndex()) || addMufflerToMachineList(tTileEntity, getCasingTextureIndex());
}
-
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
@@ -131,19 +105,19 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
@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;
+ if ((counter & 7) == 0 && (aStack == null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() > 179)) {
+ stopMachine();
+ return false;
}
ArrayList tFluids = getStoredFluids();
if (tFluids.size() > 0) {
if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
|| this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
counter = 0;
- baseEff = GT_Utility.safeInt((long)((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
- optFlow = GT_Utility.safeInt((long)Math.max(Float.MIN_NORMAL,
+ baseEff = GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
+ optFlow = GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL,
((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
- * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
* 50));
if(optFlow<=0 || baseEff<=0){
stopMachine();//in case the turbine got removed
@@ -197,6 +171,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
}
return 0;
}
+
@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return true;
@@ -234,22 +209,22 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
}
String[] ret = new String[]{
// 8 Lines available for information panels
- tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", /* 1 */
+ 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+GT_Utility.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 */
+ StatCollector.translateToLocal("GT5U.turbine.efficiency") + ": " + EnumChatFormatting.YELLOW + (mEfficiency / 100F) + EnumChatFormatting.RESET + "%", /* 2 */
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " + /* 3 */
+ EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + GT_Utility.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 + tDura + EnumChatFormatting.RESET + "%", /* 7 */
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" /* 8 */
};
if (!this.getClass().getName().contains("Steam"))
- ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t";
+ ret[4] = StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + GT_Utility.safeInt((long) realOptFlow) + EnumChatFormatting.RESET + " L/t";
return ret;
-
-
+
+
}
@Override
@@ -257,4 +232,8 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
return true;
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 2, 2, 1);
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
index b8f3d835fa..88a01dc310 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
@@ -12,7 +12,6 @@ import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,7 +37,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Gas Turbine")
.addInfo("Controller block for the Large Gas Turbine")
@@ -53,11 +52,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
.addMufflerHatch("Side centered")
.addInputHatch("Gas Fuel, Side centered")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
public int getFuelValue(FluidStack aLiquid) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
index fb510f1352..6a0074539d 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
@@ -14,7 +14,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -43,7 +42,7 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Steam Turbine")
.addInfo("Controller block for the Large High Pressure Steam Turbine")
@@ -60,11 +59,7 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
.addInputHatch("Superheated Steam, Side centered")
.addOutputHatch("Steam, Side centered")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
index bf1506ec81..094e7c20f9 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
@@ -6,9 +6,9 @@ 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.render.TextureFactory;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
@@ -20,7 +20,6 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Collection;
@@ -45,7 +44,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Plasma Turbine")
.addInfo("Controller block for the Large Plasma Generator")
@@ -60,11 +59,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
.addInputHatch("Plasma Fluid, Side centered")
.addOutputHatch("Molten Fluid, optional, Side centered")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
public int getFuelValue(FluidStack aLiquid) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
index 44e7dfd695..49bffa1e7e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
@@ -14,7 +14,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -46,7 +45,7 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Steam Turbine")
.addInfo("Controller block for the Large Steam Turbine")
@@ -63,11 +62,7 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
.addInputHatch("Steam, Side centered")
.addOutputHatch("Distilled Water, Side centered")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
--
cgit
From 03a45da45fdd85f1276416c2586a98eba79a9b50 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Fri, 11 Jun 2021 02:48:50 +0800
Subject: migrate all other multis over
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 11 +
.../multi/GT_MetaTileEntity_AssemblyLine.java | 233 ++++++++------------
.../multi/GT_MetaTileEntity_FusionComputer.java | 242 ++++++++++-----------
.../multi/GT_MetaTileEntity_FusionComputer1.java | 8 +-
.../multi/GT_MetaTileEntity_FusionComputer2.java | 9 +-
.../multi/GT_MetaTileEntity_FusionComputer3.java | 8 +-
.../multi/GT_MetaTileEntity_PyrolyseOven.java | 230 +++++++-------------
7 files changed, 293 insertions(+), 448 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index d925cc1d84..e4bfef4a48 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -144,6 +144,17 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase>) getStructureDefinition();
}
+ /**
+ * Explanation of the world coordinate these offset means:
+ *
+ * Imagine you stand in front of the controller, with controller facing towards you not rotated or flipped.
+ *
+ * The horizontalOffset would be the number of blocks on the left side of the controller, not counting controller itself.
+ * The verticalOffset would be the number of blocks on the top side of the controller, not counting controller itself.
+ * The depthOffset would be the number of blocks between you and controller, not counting controller itself.
+ *
+ * All these offsets can be negative.
+ */
protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) {
IGregTechTileEntity tTile = getBaseMetaTileEntity();
return getCastedStructureDefinition().check(this, piece, tTile.getWorld(), getExtendedFacing(), tTile.getXCoord(), tTile.getYCoord(), tTile.getZCoord(), horizontalOffset, verticalOffset, depthOffset, !mMachine);
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index 6695c4d0a2..4c294aadfe 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -1,5 +1,8 @@
package gregtech.common.tileentities.machines.multi;
+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.GT_Values;
import gregtech.api.enums.ItemList;
@@ -9,9 +12,10 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
@@ -19,22 +23,65 @@ import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAnyMeta;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
-public class GT_MetaTileEntity_AssemblyLine
- extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMultiBlockBase {
public ArrayList mDataAccessHatches = new ArrayList<>();
+ private static final String STRUCTURE_PIECE_FIRST = "first";
+ private static final String STRUCTURE_PIECE_SECOND = "second";
+ private static final String STRUCTURE_PIECE_LATER = "later";
+ private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][]{
+ {" ", "e", " "},
+ {"~", "l", "G"},
+ {"g", "m", "g"},
+ {"b", "i", "b"},
+ }))
+ .addShape(STRUCTURE_PIECE_SECOND, transpose(new String[][]{
+ {" ", "e", " "},
+ {"d", "l", "G"},
+ {"g", "m", "g"},
+ {"b", "I", "b"},
+ }))
+ .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][]{
+ {" ", "e", " "},
+ {"G", "l", "G"},
+ {"g", "m", "g"},
+ {"b", "I", "b"},
+ }))
+ .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing
+ .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing
+ .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing
+ .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass")))
+ .addElement('e', ofHatchAdderOptional(GT_MetaTileEntity_AssemblyLine::addEnergyInputToMachineList, 16, 1, GregTech_API.sBlockCasings2, 0))
+ .addElement('d', ofHatchAdderOptional(GT_MetaTileEntity_AssemblyLine::addDataAccessToMachineList, 42, 1, GregTech_API.sBlockCasings3, 10))
+ .addElement('b', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addMaintenanceToMachineList, 16, 2),
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputHatchToMachineList, 16, 2),
+ ofBlock(GregTech_API.sBlockCasings2, 0)
+ ))
+ .addElement('I', ofChain(
+ // all blocks nearby use solid steel casing, so let's use the texture of that
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 2),
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16, 2)
+ ))
+ .addElement('i', ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 2))
+ .build();
public GT_MetaTileEntity_AssemblyLine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -50,7 +97,7 @@ public class GT_MetaTileEntity_AssemblyLine
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Assembling Line")
.addInfo("Controller block for the Assembling Line")
@@ -74,11 +121,7 @@ public class GT_MetaTileEntity_AssemblyLine
.addInputHatch("Any layer 1 casing")
.addOutputBus("Replaces Input Bus on final slice")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -87,12 +130,12 @@ public class GT_MetaTileEntity_AssemblyLine
if (aActive)
return new ITexture[]{
BlockIcons.casingTexturePages[0][16],
- TextureFactory.of(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
BlockIcons.casingTexturePages[0][16],
- TextureFactory.of(OVERLAY_FRONT_ASSEMBLY_LINE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW).extFacing().glow().build()};
}
return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16]};
}
@@ -112,11 +155,6 @@ public class GT_MetaTileEntity_AssemblyLine
return true;
}
- @Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
@Override
public boolean checkRecipe(ItemStack aStack) {
if (GT_Values.D1)
@@ -274,131 +312,21 @@ public class GT_MetaTileEntity_AssemblyLine
}
}
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mDataAccessHatches.clear();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- if (xDir != 0) {
- for (int r = 0; r <= 16; r++) {
- int i = r * xDir;
-
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, 0, i);
- if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(0, 0, i) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(0, 0, i) == 10)) {
- if(r == 1 && !addDataAccessToMachineList(tTileEntity, 16)){
- return false;
- }
- }
- if (!aBaseMetaTileEntity.getBlockOffset(0, -1, i).getUnlocalizedName().equals("blockAlloyGlass")) {
- return false;
- }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i);
- if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
- if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i);
- if (!addEnergyInputToMachineList(tTileEntity, 16)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) {
- return false;
- }
- }
- if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(xDir, 0, i) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i) == 9)) {
- return false;
- }
- if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(xDir, -1, i) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, i) == 5)) {
- return false;
- }
-
-
- if (!(aBaseMetaTileEntity.getBlockOffset(xDir * 2, 0, i) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, 0, i) == 10)) {
- return false;
- }
- if (!aBaseMetaTileEntity.getBlockOffset(xDir * 2, -1, i).getUnlocalizedName().equals("blockAlloyGlass")) {
- return false;
- }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir * 2, -2, i);
- if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -2, i) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -2, i) != 0) {
- return false;
- }
- }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i);
- if (!addInputToMachineList(tTileEntity, 16) && addOutputToMachineList(tTileEntity, 16)) {
- return r > 0 && !mEnergyHatches.isEmpty();
- }
- }
- } else {
- for (int r = 0; r <= 16; r++) {
- int i = r * -zDir;
-
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 0, 0);
- if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(i, 0, 0) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0) == 10)) {
- if(r == 1 && !addDataAccessToMachineList(tTileEntity, 16)){
- return false;
- }
- }
- if (!aBaseMetaTileEntity.getBlockOffset(i, -1, 0).getUnlocalizedName().equals("blockAlloyGlass")) {
- return false;
- }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0);
- if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir);
- if (!addEnergyInputToMachineList(tTileEntity, 16)) {
- if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) {
- return false;
- }
- }
- if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir) == 9)) {
- return false;
- }
- if (i != 0 && !(aBaseMetaTileEntity.getBlockOffset(i, -1, zDir) == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir) == 5)) {
- return false;
- }
-
-
- if (!(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir * 2) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir * 2) == 10)) {
- return false;
- }
- if (!aBaseMetaTileEntity.getBlockOffset(i, -1, zDir * 2).getUnlocalizedName().equals("blockAlloyGlass")) {
- return false;
- }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir * 2);
- if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir * 2) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir * 2) != 0) {
- return false;
- }
- }
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir);
- if (!addInputToMachineList(tTileEntity, 16) && addOutputToMachineList(tTileEntity, 16)) {
- return r > 0 && !mEnergyHatches.isEmpty();
- }
- }
+ if (!checkPiece(STRUCTURE_PIECE_FIRST, 0, 1, 0))
+ return false;
+ for (int i = 1; i < 16; i++) {
+ if (!checkPiece(i == 1 ? STRUCTURE_PIECE_SECOND : STRUCTURE_PIECE_LATER, -i, 1, 0))
+ return false;
+ if (!mOutputBusses.isEmpty())
+ return !mEnergyHatches.isEmpty() && mMaintenanceHatches.size() == 1;
}
return false;
}
@@ -443,6 +371,18 @@ public class GT_MetaTileEntity_AssemblyLine
return false;
}
+ private boolean addInputHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
+ }
+ return false;
+ }
+
@Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
@@ -462,4 +402,13 @@ public class GT_MetaTileEntity_AssemblyLine
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_FIRST, stackSize, hintsOnly, 0, 1, 0);
+ buildPiece(STRUCTURE_PIECE_SECOND, stackSize, hintsOnly, -1, 1, 0);
+ for (int i = 2; i < 16; i++) {
+ buildPiece(STRUCTURE_PIECE_LATER, stackSize, hintsOnly, -i, 1, 0);
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java
index 8e54010ccb..bf2aeadcf8 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java
@@ -1,17 +1,19 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
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_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Recipe;
@@ -23,25 +25,88 @@ 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.util.ArrayList;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW;
-
-public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity_MultiBlockBase {
-
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
+
+public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity_EnhancedMultiBlockBase {
+ public static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {
+ " ",
+ " ihi ",
+ " hh hh ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " hh hh ",
+ " ihi ",
+ " ",
+ },
+ {
+ " xhx ",
+ " hhccchh ",
+ " eccxhxcce ",
+ " eceh hece ",
+ " hce ech ",
+ " hch hch ",
+ "xcx xcx",
+ "hch hch",
+ "xcx xcx",
+ " hch hch ",
+ " hce ech ",
+ " eceh hece ",
+ " eccx~xcce ",
+ " hhccchh ",
+ " xhx ",
+ },
+ {
+ " ",
+ " ihi ",
+ " hh hh ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " hh hh ",
+ " ihi ",
+ " ",
+ }
+ }))
+ .addElement('c', defer(t -> ofBlock(t.getFusionCoil(), t.getFusionCoilMeta())))
+ .addElement('h', defer(t -> ofBlock(t.getCasing(), t.getCasingMeta())))
+ .addElement('i', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addInjector, 53, 1, t.getCasing(), t.getCasingMeta())))
+ .addElement('e', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addEnergyInjector, 53, 1, t.getCasing(), t.getCasingMeta())))
+ .addElement('x', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addExtractor, 53, 1, t.getCasing(), t.getCasingMeta())))
+ .build();
public GT_Recipe mLastRecipe;
public int mEUStore;
static {
Textures.BlockIcons.setCasingTextureForId(52,
TextureFactory.of(
- TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW),
- TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()
+ TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW).extFacing().build(),
+ TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).extFacing().glow().build()
));
}
@@ -87,56 +152,14 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
super.loadNBTData(aNBT);
}
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xCenter = getBaseMetaTileEntity().getXCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX * 5;
- int yCenter = getBaseMetaTileEntity().getYCoord();
- int zCenter = getBaseMetaTileEntity().getZCoord() + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ * 5;
- if (((isAdvancedMachineCasing(xCenter + 5, yCenter, zCenter)) || (xCenter + 5 == getBaseMetaTileEntity().getXCoord()))
- && ((isAdvancedMachineCasing(xCenter - 5, yCenter, zCenter)) || (xCenter - 5 == getBaseMetaTileEntity().getXCoord()))
- && ((isAdvancedMachineCasing(xCenter, yCenter, zCenter + 5)) || (zCenter + 5 == getBaseMetaTileEntity().getZCoord()))
- && ((isAdvancedMachineCasing(xCenter, yCenter, zCenter - 5)) || (zCenter - 5 == getBaseMetaTileEntity().getZCoord())) && (checkCoils(xCenter, yCenter, zCenter))
- && (checkHulls(xCenter, yCenter, zCenter)) && (checkUpperOrLowerHulls(xCenter, yCenter + 1, zCenter)) && (checkUpperOrLowerHulls(xCenter, yCenter - 1, zCenter))
- && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 3, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 3, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter + 5, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter + 4, yCenter, zCenter - 5, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 3, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 3, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter + 5, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 4, yCenter, zCenter - 5, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter + 3, yCenter, zCenter + 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 3, yCenter, zCenter + 4, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter + 5, yCenter, zCenter + 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 5, yCenter, zCenter + 4, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter + 3, yCenter, zCenter - 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 3, yCenter, zCenter - 4, aBaseMetaTileEntity))
- && (addIfEnergyInjector(xCenter + 5, yCenter, zCenter - 4, aBaseMetaTileEntity)) && (addIfEnergyInjector(xCenter - 5, yCenter, zCenter - 4, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter + 1, yCenter, zCenter - 5, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 1, yCenter, zCenter + 5, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter - 1, yCenter, zCenter - 5, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 1, yCenter, zCenter + 5, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter + 1, yCenter, zCenter - 7, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 1, yCenter, zCenter + 7, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter - 1, yCenter, zCenter - 7, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 1, yCenter, zCenter + 7, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter + 5, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 5, yCenter, zCenter + 1, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter - 5, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 5, yCenter, zCenter + 1, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter + 7, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter + 7, yCenter, zCenter + 1, aBaseMetaTileEntity))
- && (addIfExtractor(xCenter - 7, yCenter, zCenter - 1, aBaseMetaTileEntity)) && (addIfExtractor(xCenter - 7, yCenter, zCenter + 1, aBaseMetaTileEntity))
- && (addIfInjector(xCenter + 1, yCenter + 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 1, yCenter + 1, zCenter + 6, aBaseMetaTileEntity))
- && (addIfInjector(xCenter - 1, yCenter + 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter - 1, yCenter + 1, zCenter + 6, aBaseMetaTileEntity))
- && (addIfInjector(xCenter - 6, yCenter + 1, zCenter + 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter + 1, zCenter + 1, aBaseMetaTileEntity))
- && (addIfInjector(xCenter - 6, yCenter + 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter + 1, zCenter - 1, aBaseMetaTileEntity))
- && (addIfInjector(xCenter + 1, yCenter - 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 1, yCenter - 1, zCenter + 6, aBaseMetaTileEntity))
- && (addIfInjector(xCenter - 1, yCenter - 1, zCenter - 6, aBaseMetaTileEntity)) && (addIfInjector(xCenter - 1, yCenter - 1, zCenter + 6, aBaseMetaTileEntity))
- && (addIfInjector(xCenter - 6, yCenter - 1, zCenter + 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter + 1, aBaseMetaTileEntity))
- && (addIfInjector(xCenter - 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity))
- && (this.mEnergyHatches.size() >= 1) && (this.mOutputHatches.size() >= 1) && (this.mInputHatches.size() >= 2)) {
- int mEnergyHatches_sS = this.mEnergyHatches.size();
- for (GT_MetaTileEntity_Hatch_Energy mEnergyHatch : this.mEnergyHatches) {
- if (mEnergyHatch.mTier < tier())
- return false;
- }
- int mOutputHatches_sS = this.mOutputHatches.size();
- for (GT_MetaTileEntity_Hatch_Output mOutputHatch : this.mOutputHatches) {
- if (mOutputHatch.mTier < tier())
- return false;
- }
- int mInputHatches_sS = this.mInputHatches.size();
- for (GT_MetaTileEntity_Hatch_Input mInputHatch : this.mInputHatches) {
- if (mInputHatch.mTier < tier())
- return false;
- }
+ if (checkPiece(STRUCTURE_PIECE_MAIN, 7, 1, 12) && mInputHatches.size() > 1 && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty()) {
mWrench = true;
mScrewdriver = true;
mSoftHammer = true;
@@ -148,97 +171,51 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
return false;
}
- private boolean checkTier(byte tier, ArrayList list) {
- if (list != null) {
- int list_sS=list.size();
- for (GT_MetaTileEntity_Hatch gt_metaTileEntity_hatch : list) {
- if (gt_metaTileEntity_hatch.mTier < tier) {
- return false;
- }
- }
- }
- return true;
- }
-
- private boolean checkCoils(int aX, int aY, int aZ) {
- return (isFusionCoil(aX + 6, aY, aZ - 1)) && (isFusionCoil(aX + 6, aY, aZ)) && (isFusionCoil(aX + 6, aY, aZ + 1)) && (isFusionCoil(aX + 5, aY, aZ - 3)) && (isFusionCoil(aX + 5, aY, aZ - 2))
- && (isFusionCoil(aX + 5, aY, aZ + 2)) && (isFusionCoil(aX + 5, aY, aZ + 3)) && (isFusionCoil(aX + 4, aY, aZ - 4)) && (isFusionCoil(aX + 4, aY, aZ + 4))
- && (isFusionCoil(aX + 3, aY, aZ - 5)) && (isFusionCoil(aX + 3, aY, aZ + 5)) && (isFusionCoil(aX + 2, aY, aZ - 5)) && (isFusionCoil(aX + 2, aY, aZ + 5))
- && (isFusionCoil(aX + 1, aY, aZ - 6)) && (isFusionCoil(aX + 1, aY, aZ + 6)) && (isFusionCoil(aX, aY, aZ - 6)) && (isFusionCoil(aX, aY, aZ + 6)) && (isFusionCoil(aX - 1, aY, aZ - 6))
- && (isFusionCoil(aX - 1, aY, aZ + 6)) && (isFusionCoil(aX - 2, aY, aZ - 5)) && (isFusionCoil(aX - 2, aY, aZ + 5)) && (isFusionCoil(aX - 3, aY, aZ - 5))
- && (isFusionCoil(aX - 3, aY, aZ + 5)) && (isFusionCoil(aX - 4, aY, aZ - 4)) && (isFusionCoil(aX - 4, aY, aZ + 4)) && (isFusionCoil(aX - 5, aY, aZ - 3))
- && (isFusionCoil(aX - 5, aY, aZ - 2)) && (isFusionCoil(aX - 5, aY, aZ + 2)) && (isFusionCoil(aX - 5, aY, aZ + 3)) && (isFusionCoil(aX - 6, aY, aZ - 1))
- && (isFusionCoil(aX - 6, aY, aZ)) && (isFusionCoil(aX - 6, aY, aZ + 1));
- }
-
- private boolean checkUpperOrLowerHulls(int aX, int aY, int aZ) {
- return (isAdvancedMachineCasing(aX + 6, aY, aZ)) && (isAdvancedMachineCasing(aX + 5, aY, aZ - 3)) && (isAdvancedMachineCasing(aX + 5, aY, aZ - 2))
- && (isAdvancedMachineCasing(aX + 5, aY, aZ + 2)) && (isAdvancedMachineCasing(aX + 5, aY, aZ + 3)) && (isAdvancedMachineCasing(aX + 4, aY, aZ - 4))
- && (isAdvancedMachineCasing(aX + 4, aY, aZ + 4)) && (isAdvancedMachineCasing(aX + 3, aY, aZ - 5)) && (isAdvancedMachineCasing(aX + 3, aY, aZ + 5))
- && (isAdvancedMachineCasing(aX + 2, aY, aZ - 5)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 5)) && (isAdvancedMachineCasing(aX, aY, aZ - 6))
- && (isAdvancedMachineCasing(aX, aY, aZ + 6)) && (isAdvancedMachineCasing(aX - 2, aY, aZ - 5)) && (isAdvancedMachineCasing(aX - 2, aY, aZ + 5))
- && (isAdvancedMachineCasing(aX - 3, aY, aZ - 5)) && (isAdvancedMachineCasing(aX - 3, aY, aZ + 5)) && (isAdvancedMachineCasing(aX - 4, aY, aZ - 4))
- && (isAdvancedMachineCasing(aX - 4, aY, aZ + 4)) && (isAdvancedMachineCasing(aX - 5, aY, aZ - 3)) && (isAdvancedMachineCasing(aX - 5, aY, aZ - 2))
- && (isAdvancedMachineCasing(aX - 5, aY, aZ + 2)) && (isAdvancedMachineCasing(aX - 5, aY, aZ + 3)) && (isAdvancedMachineCasing(aX - 6, aY, aZ));
- }
-
- private boolean checkHulls(int aX, int aY, int aZ) {
- return (isAdvancedMachineCasing(aX + 6, aY, aZ - 3)) && (isAdvancedMachineCasing(aX + 6, aY, aZ - 2)) && (isAdvancedMachineCasing(aX + 6, aY, aZ + 2))
- && (isAdvancedMachineCasing(aX + 6, aY, aZ + 3)) && (isAdvancedMachineCasing(aX + 3, aY, aZ - 6)) && (isAdvancedMachineCasing(aX + 3, aY, aZ + 6))
- && (isAdvancedMachineCasing(aX + 2, aY, aZ - 6)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 6)) && (isAdvancedMachineCasing(aX - 2, aY, aZ - 6))
- && (isAdvancedMachineCasing(aX - 2, aY, aZ + 6)) && (isAdvancedMachineCasing(aX - 3, aY, aZ - 6)) && (isAdvancedMachineCasing(aX - 3, aY, aZ + 6))
- && (isAdvancedMachineCasing(aX - 7, aY, aZ)) && (isAdvancedMachineCasing(aX + 7, aY, aZ)) && (isAdvancedMachineCasing(aX, aY, aZ - 7)) && (isAdvancedMachineCasing(aX, aY, aZ + 7))
- && (isAdvancedMachineCasing(aX - 6, aY, aZ - 3)) && (isAdvancedMachineCasing(aX - 6, aY, aZ - 2)) && (isAdvancedMachineCasing(aX - 6, aY, aZ + 2))
- && (isAdvancedMachineCasing(aX - 6, aY, aZ + 3)) && (isAdvancedMachineCasing(aX - 4, aY, aZ - 2)) && (isAdvancedMachineCasing(aX - 4, aY, aZ + 2))
- && (isAdvancedMachineCasing(aX + 4, aY, aZ - 2)) && (isAdvancedMachineCasing(aX + 4, aY, aZ + 2)) && (isAdvancedMachineCasing(aX - 2, aY, aZ - 4))
- && (isAdvancedMachineCasing(aX - 2, aY, aZ + 4)) && (isAdvancedMachineCasing(aX + 2, aY, aZ - 4)) && (isAdvancedMachineCasing(aX + 2, aY, aZ + 4));
- }
-
- private boolean addIfEnergyInjector(int aX, int aY, int aZ, IGregTechTileEntity aBaseMetaTileEntity) {
- if (addEnergyInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntity(aX, aY, aZ), 53)) {
- return true;
- }
- return isAdvancedMachineCasing(aX, aY, aZ);
- }
-
- private boolean addIfInjector(int aX, int aY, int aZ, IGregTechTileEntity aTileEntity) {
- if (addInputToMachineList(aTileEntity.getIGregTechTileEntity(aX, aY, aZ), 53)) {
- return true;
- }
- return isAdvancedMachineCasing(aX, aY, aZ);
+ private boolean addEnergyInjector(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) {
+ IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy)) return false;
+ GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity;
+ if (tHatch.mTier < tier()) return false;
+ tHatch.updateTexture(aBaseCasingIndex);
+ return mEnergyHatches.add(tHatch);
}
- private boolean addIfExtractor(int aX, int aY, int aZ, IGregTechTileEntity aTileEntity) {
- if (addOutputToMachineList(aTileEntity.getIGregTechTileEntity(aX, aY, aZ), 53)) {
- return true;
- }
- return isAdvancedMachineCasing(aX, aY, aZ);
+ private boolean addInjector(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) {
+ IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)) return false;
+ GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity;
+ if (tHatch.mTier < tier()) return false;
+ tHatch.updateTexture(aBaseCasingIndex);
+ tHatch.mRecipeMap = getRecipeMap();
+ return mInputHatches.add(tHatch);
}
- private boolean isAdvancedMachineCasing(int aX, int aY, int aZ) {
- return (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasing()) && (getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta());
+ private boolean addExtractor(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) {
+ if (aBaseMetaTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)) return false;
+ GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity;
+ if (tHatch.mTier < tier()) return false;
+ tHatch.updateTexture(aBaseCasingIndex);
+ return mOutputHatches.add(tHatch);
}
public abstract Block getCasing();
public abstract int getCasingMeta();
- private boolean isFusionCoil(int aX, int aY, int aZ) {
- return (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getFusionCoil() && (getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getFusionCoilMeta()));
- }
-
public abstract Block getFusionCoil();
public abstract int getFusionCoilMeta();
- @Override
- public abstract String[] getDescription();
-
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) return new ITexture[]{TextureFactory.of(MACHINE_CASING_FUSION_GLASS), getTextureOverlay()};
+ if (aSide == aFacing) return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build(), getTextureOverlay()};
if (aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)};
- return new ITexture[]{TextureFactory.of(MACHINE_CASING_FUSION_GLASS)};
+ return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build()};
}
/**
@@ -477,4 +454,9 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
public boolean isGivingInformation() {
return true;
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 7, 1, 12);
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
index 39b78c68bd..fd55bf715b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
@@ -62,7 +62,7 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Fusion Reactor")
.addInfo("It's over 9000!!!")
@@ -81,11 +81,7 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC
.addOutputHatch("1-16, Specified casings")
.addStructureInfo("ALL Hatches must be LuV or better")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
index 2ffa8ba4e1..890b43cc7a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
@@ -7,7 +7,6 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.block.Block;
-import org.lwjgl.input.Keyboard;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2_GLOW;
@@ -62,7 +61,7 @@ public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionC
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Fusion Reactor")
.addInfo("It's over 9000!!!")
@@ -81,11 +80,7 @@ public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionC
.addOutputHatch("1-16, Specified casings")
.addStructureInfo("ALL Hatches must be ZPM or better")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
index e8ae396954..0a3bc89d20 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
@@ -62,7 +62,7 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Fusion Reactor")
.addInfo("A SUN DOWN ON EARTH")
@@ -81,11 +81,7 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC
.addOutputHatch("1-16, Specified casings")
.addStructureInfo("ALL Hatches must be UV or better")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index 41184a17ac..9ad84d061a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -1,5 +1,7 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
@@ -7,11 +9,10 @@ import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Textures;
import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
-import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
@@ -21,19 +22,61 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import org.apache.commons.lang3.mutable.MutableBoolean;
-import org.lwjgl.input.Keyboard;
+import net.minecraftforge.oredict.OreDictionary;
+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.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_GLOW;
+import static gregtech.api.util.GT_StructureUtility.ofCoil;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMultiBlockBase {
private HeatingCoilLevel coilHeat;
//public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa);
private static final int CASING_INDEX = 1090;
+ private static final IStructureDefinition STRUCTURE_DEFINITION = createStructureDefinition();
+
+ private static IStructureDefinition createStructureDefinition() {
+ Block casingBlock;
+ int casingMeta;
+
+ if (Loader.isModLoaded("dreamcraft")) {
+ casingBlock = GameRegistry.findBlock("dreamcraft", "gt.blockcasingsNH");
+ casingMeta = 2;
+ } else {
+ casingBlock = GregTech_API.sBlockCasings1;
+ casingMeta = 0;
+ }
+ return StructureDefinition.builder()
+ .addShape("main", transpose(new String[][]{
+ {"ccccc", "ctttc", "ctttc", "ctttc", "ccccc"},
+ {"ccccc", "c---c", "c---c", "c---c", "ccccc"},
+ {"ccccc", "c---c", "c---c", "c---c", "ccccc"},
+ {"bb~bb", "bCCCb", "bCCCb", "bCCCb", "bbbbb"},
+ }))
+ .addElement('c', onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, ofBlock(casingBlock, casingMeta)))
+ .addElement('C', ofCoil(GT_MetaTileEntity_PyrolyseOven::setCoilLevel, GT_MetaTileEntity_PyrolyseOven::getCoilLevel))
+ .addElement('b', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addMaintenanceToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addOutputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addEnergyInputToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, ofBlock(casingBlock, casingMeta))
+ ))
+ .addElement('t', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addMufflerToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, ofBlock(casingBlock, casingMeta))
+ ))
+ .build();
+ }
+
+ private int mCasingAmount;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -44,7 +87,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Coke Oven")
.addInfo("Controller block for the Pyrolyse Oven")
@@ -66,11 +109,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
.addOutputBus("Any bottom layer casing")
.addOutputHatch("Any bottom layer casing")
.toolTipFinisher("Gregtech");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -79,12 +118,12 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
if (aActive)
return new ITexture[]{
BlockIcons.casingTexturePages[8][66],
- TextureFactory.of(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
BlockIcons.casingTexturePages[8][66],
- TextureFactory.of(OVERLAY_FRONT_PYROLYSE_OVEN),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_GLOW).extFacing().glow().build()};
}
return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]};
}
@@ -128,156 +167,28 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
- Block casingBlock;
- int casingMeta;
-
- if (Loader.isModLoaded("dreamcraft")) {
- casingBlock = GameRegistry.findBlock("dreamcraft", "gt.blockcasingsNH");
- casingMeta = 2;
- } else {
- casingBlock = GregTech_API.sBlockCasings1;
- casingMeta = 0;
- }
-
- replaceDeprecatedCoils(aBaseMetaTileEntity);
- MutableBoolean firstCoil = new MutableBoolean(true);
- for (int i = -2; i < 3; i++) {
- for (int j = -2; j < 3; j++) {
- for (int h = 0; h < 4; h++) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// inner 3x3 without height
- if (checkInnerBroken(
- xDir, zDir,
- i, h, j,
- aBaseMetaTileEntity, tTileEntity,
- casingBlock, casingMeta,
- firstCoil
- )
- )
- return false;
- } else {// outer 5x5 without height
- if (checkOuterBroken(
- xDir, zDir,
- i, h, j,
- aBaseMetaTileEntity, tTileEntity,
- casingBlock, casingMeta
- )
- )
- return false;
- }
- }
- }
- }
- return true;
+ public IStructureDefinition getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
}
- private boolean checkInnerBroken(int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- IGregTechTileEntity tTileEntity,
- Block casingBlock,
- int casingMeta,
- MutableBoolean firstCoil
- ) {
- if (b == 0) {// inner floor (Coils)
- return areCoilsBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, firstCoil);
- } else if (b == 3) {// inner ceiling (ulv casings + input + muffler)
- return checkInnerCeilingBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, tTileEntity, casingBlock, casingMeta);
- } else {// inside air
- return !aBaseMetaTileEntity.getAirOffset(xDir + a, b, zDir + c);
- }
- }
-
- private boolean checkOuterBroken(int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- IGregTechTileEntity tTileEntity,
- Block casingBlock,
- int casingMeta) {
- if (b == 0) {// outer floor (controller, output, energy, maintainance, rest ulv casings)
- if (checkOuterFloorLoopControl(xDir, zDir, a, c, tTileEntity))
- return false;
- }
- // outer above floor (ulv casings)
- if (aBaseMetaTileEntity.getBlockOffset(xDir + a, b, zDir + c) != casingBlock) {
- return true;
- }
- return aBaseMetaTileEntity.getMetaIDOffset(xDir + a, b, zDir + c) != casingMeta;
+ private void onCasingAdded() {
+ mCasingAmount++;
}
- private boolean checkOuterFloorLoopControl(int xDir,
- int zDir,
- int a,
- int c,
- IGregTechTileEntity tTileEntity
- ) {
- if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) {
- return true;
- }
- if (addOutputToMachineList(tTileEntity, CASING_INDEX)) {
- return true;
- }
-
- if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX)) {
- return true;
- }
-
- return (xDir + a == 0) && (zDir + c == 0);
+ public HeatingCoilLevel getCoilLevel() {
+ return coilHeat;
}
- private boolean checkInnerCeilingBroken(int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- IGregTechTileEntity tTileEntity,
- Block casingBlock,
- int casingMeta) {
- if ((addInputToMachineList(tTileEntity, CASING_INDEX)) || (addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + a, b, zDir + c) != casingBlock) {
- return true;
- }
- return aBaseMetaTileEntity.getMetaIDOffset(xDir + a, b, zDir + c) != casingMeta;
+ private void setCoilLevel(HeatingCoilLevel aCoilLevel) {
+ coilHeat = aCoilLevel;
}
- private boolean areCoilsBroken(int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- MutableBoolean firstCoil
- ) {
- Block coil = aBaseMetaTileEntity.getBlockOffset(xDir + a, b, zDir + c);
-
- if (!(coil instanceof IHeatingCoil))
- return true;
-
- int metaID = aBaseMetaTileEntity.getMetaIDOffset(xDir + a, b, zDir + c);
-
- HeatingCoilLevel coilHeat = ((IHeatingCoil) coil).getCoilHeat(metaID);
-
- if (coilHeat == HeatingCoilLevel.None) {
- return true;
- } else {
- if (firstCoil.isTrue()) {
- this.coilHeat = coilHeat;
- firstCoil.setFalse();
- } else return coilHeat != this.coilHeat;
- }
- return false;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ coilHeat = HeatingCoilLevel.None;
+ mCasingAmount = 0;
+ replaceDeprecatedCoils(aBaseMetaTileEntity);
+ return checkPiece("main", 2, 3, 0) && mCasingAmount >= 60;
}
@Override
@@ -325,4 +236,9 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
}
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece("main", stackSize, hintsOnly, 2, 3, 0);
+ }
}
--
cgit
From 6ea3101f0b5604f3f9260a41af6ef1848355c95f Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Tue, 15 Jun 2021 02:16:40 +0800
Subject: use TT serialization form
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index e4bfef4a48..e871146d4b 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -127,16 +127,16 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase
Date: Wed, 16 Jun 2021 11:05:12 +0800
Subject: optimize fuel recipe lookup
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../GT_MetaTileEntity_BasicGenerator.java | 27 +++++-----
src/main/java/gregtech/api/util/GT_Recipe.java | 23 +++++++++
.../multi/GT_MetaTileEntity_DieselEngine.java | 57 ++++++++++------------
.../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 10 ++--
.../GT_MetaTileEntity_LargeTurbine_Plasma.java | 10 ++--
.../postload/GT_ExtremeDieselFuelLoader.java | 13 ++---
6 files changed, 72 insertions(+), 68 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
index 9bbfbf0a3a..63151bde59 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
@@ -18,8 +18,6 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
-import java.util.Collection;
-
import static gregtech.api.enums.GT_Values.V;
public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank {
@@ -271,19 +269,18 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
public int getFuelValue(FluidStack aLiquid) {
//System.out.println("Fluid stack check");
- if (aLiquid == null || getRecipes() == null) return 0;
- FluidStack tLiquid;
- Collection tRecipeList = getRecipes().mRecipeList;
- if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList)
- if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null)
- if (aLiquid.isFluidEqual(tLiquid)){
- long val=(long)tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(tLiquid) / 100;
- if(val> Integer.MAX_VALUE){
- throw new ArithmeticException("Integer LOOPBACK!");
- }
- return (int) val;
- }
- return 0;
+ GT_Recipe_Map tRecipes = getRecipes();
+ if (aLiquid == null || !(tRecipes instanceof GT_Recipe.GT_Recipe_Map_Fuel)) return 0;
+ GT_Recipe.GT_Recipe_Map_Fuel tFuels = (GT_Recipe.GT_Recipe_Map_Fuel) tRecipes;
+ GT_Recipe tFuel = tFuels.findFuel(aLiquid);
+ if (tFuel == null) {
+ return 0;
+ }
+ long val=(long)tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(aLiquid) / 100;
+ if(val> Integer.MAX_VALUE){
+ throw new ArithmeticException("Integer LOOPBACK!");
+ }
+ return (int) val;
}
public int getFuelValue(ItemStack aStack) {
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index a04df205b7..a5b263a145 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -197,6 +197,11 @@ public class GT_Recipe implements Comparable {
this(aInput1, aOutput1, null, null, null, aFuelValue, aType);
}
+ private static FluidStack[] tryGetFluidInputsFromCells(ItemStack aInput) {
+ FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true);
+ return tFluid == null ? null : new FluidStack[] {tFluid};
+ }
+
// aSpecialValue = EU per Liter! If there is no Liquid for this Object, then it gets multiplied with 1000!
public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aSpecialValue, int aType) {
this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1, aOutput2, aOutput3, aOutput4}, null, null, null, null, 0, 0, Math.max(1, aSpecialValue));
@@ -977,6 +982,7 @@ public class GT_Recipe implements Comparable {
* Just a Recipe Map with Utility specifically for Fuels.
*/
public static class GT_Recipe_Map_Fuel extends GT_Recipe_Map {
+ private final Map mRecipesByFluidInput = new HashMap<>();
public GT_Recipe_Map_Fuel(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) {
super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed);
}
@@ -1000,6 +1006,23 @@ public class GT_Recipe implements Comparable {
public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aChance, int aFuelValueInEU) {
return addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, null, new int[]{aChance}, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, 0, 0, aFuelValueInEU);
}
+
+ @Override
+ public GT_Recipe add(GT_Recipe aRecipe) {
+ aRecipe = super.add(aRecipe);
+ if (aRecipe.mInputs != null && aRecipe.mInputs.length == 1 && (aRecipe.mFluidInputs == null || aRecipe.mFluidInputs.length == 0)) {
+ FluidStack tFluid = GT_Utility.getFluidForFilledItem(aRecipe.mInputs[0], true);
+ if (tFluid != null) {
+ tFluid.amount = 0;
+ mRecipesByFluidInput.put(tFluid.getUnlocalizedName(), aRecipe);
+ }
+ }
+ return aRecipe;
+ }
+
+ public GT_Recipe findFuel(FluidStack aFluidInput) {
+ return mRecipesByFluidInput.get(aFluidInput.getUnlocalizedName());
+ }
}
/**
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
index 1783a0c328..567297648a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
@@ -14,7 +14,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffl
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -24,7 +23,6 @@ import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import java.util.Collection;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
@@ -160,34 +158,30 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList tFluids = getStoredFluids();
- Collection tRecipeList = getFuelMap().mRecipeList;
-
- if(!tFluids.isEmpty() && tRecipeList != null) { //Does input hatch have a diesel fuel?
- for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
- for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
- FluidStack tLiquid;
- if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe
- if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a diesel fluid
- fuelConsumption = tLiquid.amount = boostEu ? (getBoostFactor() * getNominalOutput() / aFuel.mSpecialValue) : (getNominalOutput() / aFuel.mSpecialValue); //Calc fuel consumption
- if(depleteInput(tLiquid)) { //Deplete that amount
- boostEu = depleteInput(getBooster().getGas(2L * getAdditiveFactor()));
-
- if(tFluids.contains(Materials.Lubricant.getFluid(1L))) { //Has lubricant?
- //Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048)
- if(mRuntime % 72 == 0 || mRuntime == 0) depleteInput(Materials.Lubricant.getFluid((boostEu ? 2L : 1L) * getAdditiveFactor()));
- } else return false;
-
- fuelValue = aFuel.mSpecialValue;
- fuelRemaining = hatchFluid1.amount; //Record available fuel
- this.mEUt = mEfficiency < 2000 ? 0 : getNominalOutput(); //Output 0 if startup is less than 20%
- this.mProgresstime = 1;
- this.mMaxProgresstime = 1;
- this.mEfficiencyIncrease = getEfficiencyIncrease();
- return true;
- }
- }
- }
- }
+
+ // fast track lookup
+ if (!tFluids.isEmpty()) {
+ for (FluidStack tFluid : tFluids) {
+ GT_Recipe tRecipe = getFuelMap().findFuel(tFluid);
+ if (tRecipe == null) continue;
+
+ FluidStack tLiquid = tFluid.copy();
+ fuelConsumption = tLiquid.amount = boostEu ? (getBoostFactor() * getNominalOutput() / tRecipe.mSpecialValue) : (getNominalOutput() / tRecipe.mSpecialValue); //Calc fuel consumption
+ //Deplete that amount
+ if (!depleteInput(tLiquid)) return false;
+ boostEu = depleteInput(getBooster().getGas(2L * getAdditiveFactor()));
+
+ //Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048)
+ if ((mRuntime % 72 == 0 || mRuntime == 0) && !depleteInput(Materials.Lubricant.getFluid((boostEu ? 2L : 1L) * getAdditiveFactor())))
+ return false;
+
+ fuelValue = tRecipe.mSpecialValue;
+ fuelRemaining = tFluid.amount; //Record available fuel
+ this.mEUt = mEfficiency < 2000 ? 0 : getNominalOutput(); //Output 0 if startup is less than 20%
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = getEfficiencyIncrease();
+ return true;
}
}
this.mEUt = 0;
@@ -195,6 +189,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu
return false;
}
+
@Override
public IStructureDefinition getStructureDefinition() {
return STRUCTURE_DEFINITION;
@@ -299,7 +294,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu
getIdealStatus() == getRepairStatus() ?
EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET :
EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.engine.output")+": " +EnumChatFormatting.RED+(-mEUt*mEfficiency/10000)+EnumChatFormatting.RESET+" EU/t",
+ StatCollector.translateToLocal("GT5U.engine.output")+": " +EnumChatFormatting.RED+(mEUt*mEfficiency/10000)+EnumChatFormatting.RESET+" EU/t",
StatCollector.translateToLocal("GT5U.engine.consumption")+": " +EnumChatFormatting.YELLOW+fuelConsumption+EnumChatFormatting.RESET+" L/t",
StatCollector.translateToLocal("GT5U.engine.value")+": " +EnumChatFormatting.YELLOW+fuelValue+EnumChatFormatting.RESET+" EU/L",
StatCollector.translateToLocal("GT5U.turbine.fuel")+": " +EnumChatFormatting.GOLD+fuelRemaining+EnumChatFormatting.RESET+" L",
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
index 214e0648c2..27e4bf7084 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
@@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import java.util.Collection;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5;
@@ -56,12 +55,9 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
}
public int getFuelValue(FluidStack aLiquid) {
- if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0;
- FluidStack tLiquid;
- Collection tRecipeList = GT_Recipe_Map.sTurbineFuels.mRecipeList;
- if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList)
- if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null)
- if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue;
+ if (aLiquid == null) return 0;
+ GT_Recipe tFuel = GT_Recipe_Map.sTurbineFuels.findFuel(aLiquid);
+ if (tFuel != null) return tFuel.mSpecialValue;
return 0;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
index efc3ecaea3..d1bf1e7c0b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
@@ -22,7 +22,6 @@ import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import java.util.Collection;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
@@ -63,12 +62,9 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
}
public int getFuelValue(FluidStack aLiquid) {
- if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0;
- FluidStack tLiquid;
- Collection tRecipeList = GT_Recipe_Map.sPlasmaFuels.mRecipeList;
- if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList)
- if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null)
- if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue;
+ if (aLiquid == null) return 0;
+ GT_Recipe tFuel = GT_Recipe_Map.sPlasmaFuels.findFuel(aLiquid);
+ if (tFuel != null) return tFuel.mSpecialValue;
return 0;
}
diff --git a/src/main/java/gregtech/loaders/postload/GT_ExtremeDieselFuelLoader.java b/src/main/java/gregtech/loaders/postload/GT_ExtremeDieselFuelLoader.java
index dcb76ae17b..d85a47e3c9 100644
--- a/src/main/java/gregtech/loaders/postload/GT_ExtremeDieselFuelLoader.java
+++ b/src/main/java/gregtech/loaders/postload/GT_ExtremeDieselFuelLoader.java
@@ -3,7 +3,6 @@ package gregtech.loaders.postload;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
import net.minecraftforge.fluids.FluidStack;
public class GT_ExtremeDieselFuelLoader implements Runnable {
@@ -11,13 +10,11 @@ public class GT_ExtremeDieselFuelLoader implements Runnable {
public void run() {
GT_Log.out.println("GT_Mod: Adding extreme diesel fuel.");
FluidStack tHOGStack = Materials.GasolinePremium.getFluid(1);
- for (GT_Recipe tFuel : GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList) {
- FluidStack tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true);
- if (tLiquid != null && tHOGStack.isFluidEqual(tLiquid)) {
- GT_Recipe.GT_Recipe_Map.sExtremeDieselFuels.add(tFuel);
- return;
- }
+ GT_Recipe tFuel = GT_Recipe.GT_Recipe_Map.sDieselFuels.findFuel(tHOGStack);
+ if (tFuel != null) {
+ GT_Recipe.GT_Recipe_Map.sExtremeDieselFuels.add(tFuel);
+ } else {
+ GT_Log.out.println("GT_Mod: No extreme diesel fuel found.");
}
- GT_Log.out.println("GT_Mod: No extreme diesel fuel found.");
}
}
--
cgit
From 62f04c2893a66c4f80383da1a973fad4708171d4 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Wed, 16 Jun 2021 16:15:18 +0800
Subject: draw flipped textures & flipping markers
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
build.properties | 2 +-
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 4 +-
src/main/java/gregtech/common/GT_Client.java | 66 +++++++++++++++---
.../gregtech/common/render/GT_IconFlipped.java | 80 ++++++++++++++++++++++
.../gregtech/common/render/GT_RenderedTexture.java | 20 ++++--
5 files changed, 154 insertions(+), 18 deletions(-)
create mode 100644 src/main/java/gregtech/common/render/GT_IconFlipped.java
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/build.properties b/build.properties
index 8392f3c2a1..e4f67386b8 100644
--- a/build.properties
+++ b/build.properties
@@ -1,7 +1,7 @@
minecraft.version=1.7.10
forge.version=10.13.4.1614-1.7.10
gt.version=5.09.37.02
-structurelib.version=1.0.1
+structurelib.version=1.0.2
ae2.version=rv3-beta-22
applecore.version=1.7.10-1.2.1+107.59407
buildcraft.version=7.1.11
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index e871146d4b..76dbca86b1 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -75,7 +75,9 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase 0) {
- drawGrid(aEvent, true);
+ drawGrid(aEvent, true, false, true);
return;
}
return;
@@ -538,7 +586,7 @@ public class GT_Client extends GT_Proxy
if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet()))
{
if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0)
- drawGrid(aEvent, true);
+ drawGrid(aEvent, true, false, aEvent.player.isSneaking());
}
}
diff --git a/src/main/java/gregtech/common/render/GT_IconFlipped.java b/src/main/java/gregtech/common/render/GT_IconFlipped.java
new file mode 100644
index 0000000000..c3eee2900f
--- /dev/null
+++ b/src/main/java/gregtech/common/render/GT_IconFlipped.java
@@ -0,0 +1,80 @@
+package gregtech.common.render;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.util.IIcon;
+
+@SideOnly(Side.CLIENT)
+public class GT_IconFlipped implements IIcon {
+ private final IIcon baseIcon;
+ private final boolean flipU;
+ private final boolean flipV;
+
+ public GT_IconFlipped(IIcon baseIcon, boolean flipU, boolean flipV) {
+ this.baseIcon = baseIcon;
+ this.flipU = flipU;
+ this.flipV = flipV;
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ */
+ public int getIconWidth() {
+ return this.baseIcon.getIconWidth();
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ */
+ public int getIconHeight() {
+ return this.baseIcon.getIconHeight();
+ }
+
+ /**
+ * Returns the minimum U coordinate to use when rendering with this icon.
+ */
+ public float getMinU() {
+ return this.flipU ? this.baseIcon.getMaxU() : this.baseIcon.getMinU();
+ }
+
+ /**
+ * Returns the maximum U coordinate to use when rendering with this icon.
+ */
+ public float getMaxU() {
+ return this.flipU ? this.baseIcon.getMinU() : this.baseIcon.getMaxU();
+ }
+
+ /**
+ * Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values.
+ */
+ public float getInterpolatedU(double p_94214_1_) {
+ float f = this.getMaxU() - this.getMinU();
+ return this.getMinU() + f * ((float) p_94214_1_ / 16.0F);
+ }
+
+ /**
+ * Returns the minimum V coordinate to use when rendering with this icon.
+ */
+ public float getMinV() {
+ return this.flipV ? this.baseIcon.getMaxV() : this.baseIcon.getMinV();
+ }
+
+ /**
+ * Returns the maximum V coordinate to use when rendering with this icon.
+ */
+ public float getMaxV() {
+ return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMaxV();
+ }
+
+ /**
+ * Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values.
+ */
+ public float getInterpolatedV(double p_94207_1_) {
+ float f = this.getMaxV() - this.getMinV();
+ return this.getMinV() + f * ((float) p_94207_1_ / 16.0F);
+ }
+
+ public String getIconName() {
+ return this.baseIcon.getIconName();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java
index 135ebf28c6..e35e2dbb6b 100644
--- a/src/main/java/gregtech/common/render/GT_RenderedTexture.java
+++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java
@@ -2,6 +2,7 @@ package gregtech.common.render;
import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
+import com.gtnewhorizon.structurelib.alignment.enumerable.Flip;
import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
import gregtech.GT_Mod;
import gregtech.api.interfaces.IColorModulationContainer;
@@ -12,7 +13,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.LightingHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.IconFlipped;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
@@ -225,7 +225,8 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
break;
}
- aRenderer.renderFaceYNeg(Blocks.air, x, y, z, new IconFlipped(icon, !stdOrient, false));
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceYNeg(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped() ^ !stdOrient, aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateBottom = 0;
}
@@ -249,7 +250,8 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
break;
}
- aRenderer.renderFaceYPos(Blocks.air, x, y, z, icon);
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceYPos(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateTop = 0;
}
@@ -274,7 +276,8 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
break;
}
- aRenderer.renderFaceZNeg(Blocks.air, x, y, z, icon);
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceZNeg(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateEast = 0;
aRenderer.field_152631_f = false;
}
@@ -299,7 +302,8 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
break;
}
- aRenderer.renderFaceZPos(Blocks.air, x, y, z, icon);
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceZPos(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateWest = 0;
}
@@ -323,7 +327,8 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
break;
}
- aRenderer.renderFaceXNeg(Blocks.air, x, y, z, icon);
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceXNeg(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateNorth = 0;
}
@@ -348,7 +353,8 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
break;
}
- aRenderer.renderFaceXPos(Blocks.air, x, y, z, icon);
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceXPos(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateSouth = 0;
aRenderer.field_152631_f = false;
}
--
cgit
From cb5c00dbf4100abfec238fd52722e9dfe60292e1 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Wed, 16 Jun 2021 17:45:04 +0800
Subject: turn off flipping as it bothers some people too much
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java | 2 +-
.../tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java | 6 +++++-
.../machines/multi/GT_MetaTileEntity_DistillationTower.java | 2 +-
.../tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java | 2 +-
.../machines/multi/GT_MetaTileEntity_HeatExchanger.java | 2 +-
5 files changed, 9 insertions(+), 5 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index 76dbca86b1..5897de8f68 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -123,7 +123,7 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase f.isNotFlipped();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index 4c294aadfe..5d363d9aa1 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -322,8 +322,12 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu
mDataAccessHatches.clear();
if (!checkPiece(STRUCTURE_PIECE_FIRST, 0, 1, 0))
return false;
+ return checkMachine(true) || checkMachine(false);
+ }
+
+ private boolean checkMachine(boolean leftToRight) {
for (int i = 1; i < 16; i++) {
- if (!checkPiece(i == 1 ? STRUCTURE_PIECE_SECOND : STRUCTURE_PIECE_LATER, -i, 1, 0))
+ if (!checkPiece(i == 1 ? STRUCTURE_PIECE_SECOND : STRUCTURE_PIECE_LATER, leftToRight ? -i : i, 1, 0))
return false;
if (!mOutputBusses.isEmpty())
return !mEnergyHatches.isEmpty() && mMaintenanceHatches.size() == 1;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index ff7b801b15..ef77ab10c2 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -200,7 +200,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan
@Override
protected IAlignmentLimits getInitialAlignmentLimits() {
// don't rotate a freaking tower, it won't work
- return (d, r, f) -> d.offsetY == 0 && r.isNotRotated();
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
index f1bfbe80f0..676da3d7ac 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
@@ -350,7 +350,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En
@Override
protected IAlignmentLimits getInitialAlignmentLimits() {
- return (d, r, f) -> d.offsetY == 0 && r.isNotRotated();
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
index 0579c4871b..c820731415 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
@@ -136,7 +136,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM
@Override
protected IAlignmentLimits getInitialAlignmentLimits() {
- return (d, r, f) -> !r.isUpsideDown();
+ return (d, r, f) -> !r.isUpsideDown() && f.isNotFlipped();
}
@Override
--
cgit
From 5bd3126615e09906d4bf769c063cedea68e10d43 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Wed, 16 Jun 2021 18:00:35 +0800
Subject: Allow modifying alignment limits after instance initialization
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index 5897de8f68..e4169c58be 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray;
public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase> extends GT_MetaTileEntity_MultiBlockBase implements IAlignment, IConstructable {
private static final AtomicReferenceArray tooltips = new AtomicReferenceArray<>(GregTech_API.METATILEENTITIES.length);
private ExtendedFacing mExtendedFacing = ExtendedFacing.DEFAULT;
- private final IAlignmentLimits mLimits = getInitialAlignmentLimits();
+ private IAlignmentLimits mLimits = getInitialAlignmentLimits();
protected GT_MetaTileEntity_EnhancedMultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -94,6 +94,10 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase getStructureDefinition();
protected abstract GT_Multiblock_Tooltip_Builder createTooltip();
--
cgit
From d80698def4c2c6fe6ee7875e08836563c630271c Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Thu, 17 Jun 2021 23:28:54 +0800
Subject: fix distillation tower not outputting bottom fluid
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java | 5 +++++
.../machines/multi/GT_MetaTileEntity_DistillationTower.java | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index e4169c58be..597a645699 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -98,6 +98,11 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase getStructureDefinition();
protected abstract GT_Multiblock_Tooltip_Builder createTooltip();
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index 64c7bd7535..11e7ec0d6d 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -190,11 +190,11 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan
protected boolean addLayerOutputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null || aTileEntity.isDead() || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output))
return false;
- while (mOutputHatchesByLayer.size() < mHeight + 1)
+ while (mOutputHatchesByLayer.size() < mHeight)
mOutputHatchesByLayer.add(new ArrayList<>());
GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aTileEntity.getMetaTileEntity();
tHatch.updateTexture(aBaseCasingIndex);
- return mOutputHatchesByLayer.get(mHeight).add(tHatch);
+ return mOutputHatchesByLayer.get(mHeight - 1).add(tHatch);
}
@Override
--
cgit
From 3d5ac0c8953df1249b964335452d45ffee75c8a7 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Fri, 18 Jun 2021 00:19:14 +0800
Subject: re-enable flipping, but add an option to render them not flipped
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
src/main/java/gregtech/GT_Mod.java | 1 +
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 2 +-
src/main/java/gregtech/common/GT_Proxy.java | 5 +++++
src/main/java/gregtech/common/render/GT_RenderedTexture.java | 12 ++++++------
.../machines/multi/GT_MetaTileEntity_DistillationTower.java | 2 +-
.../machines/multi/GT_MetaTileEntity_DrillerBase.java | 2 +-
.../machines/multi/GT_MetaTileEntity_HeatExchanger.java | 2 +-
7 files changed, 16 insertions(+), 10 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index 278908b9a0..590f01292e 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -329,6 +329,7 @@ public class GT_Mod implements IGT_Mod {
);
gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true);
gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true);
+ gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile.get("render", "RenderFlippedMachinesFlipped", true);
gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get(aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3).getInt(3);
gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get(aTextGeneral, "SkeletonsShootGTArrows", 16).getInt(16);
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index 597a645699..a9b50e6662 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -132,7 +132,7 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase f.isNotFlipped();
+ return (d, r, f) -> !f.isVerticallyFliped();
}
@Override
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index e35661a617..82dd4e3ba2 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -252,6 +252,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
*/
public boolean mRenderGlowTextures = true;
+ /**
+ * Render flipped textures
+ */
+ public boolean mRenderFlippedMachinesFlipped = true;
+
public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15
public static Map oreDictBurnTimes = new HashMap<>();
diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java
index e35e2dbb6b..f456b563b5 100644
--- a/src/main/java/gregtech/common/render/GT_RenderedTexture.java
+++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java
@@ -226,7 +226,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
}
Flip aFlip = extendedFacing.getFlip();
- aRenderer.renderFaceYNeg(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped() ^ !stdOrient, aFlip.isVerticallyFliped()) : icon);
+ aRenderer.renderFaceYNeg(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped() ^ !stdOrient, aFlip.isVerticallyFliped()) : new GT_IconFlipped(icon, !stdOrient, false));
aRenderer.uvRotateBottom = 0;
}
@@ -251,7 +251,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
}
Flip aFlip = extendedFacing.getFlip();
- aRenderer.renderFaceYPos(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.renderFaceYPos(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateTop = 0;
}
@@ -277,7 +277,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
}
Flip aFlip = extendedFacing.getFlip();
- aRenderer.renderFaceZNeg(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.renderFaceZNeg(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateEast = 0;
aRenderer.field_152631_f = false;
}
@@ -303,7 +303,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
}
Flip aFlip = extendedFacing.getFlip();
- aRenderer.renderFaceZPos(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.renderFaceZPos(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateWest = 0;
}
@@ -328,7 +328,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
}
Flip aFlip = extendedFacing.getFlip();
- aRenderer.renderFaceXNeg(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.renderFaceXNeg(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateNorth = 0;
}
@@ -354,7 +354,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
}
Flip aFlip = extendedFacing.getFlip();
- aRenderer.renderFaceXPos(Blocks.air, x, y, z, useExtFacing ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.renderFaceXPos(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
aRenderer.uvRotateSouth = 0;
aRenderer.field_152631_f = false;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index 11e7ec0d6d..73bbfe056a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -200,7 +200,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan
@Override
protected IAlignmentLimits getInitialAlignmentLimits() {
// don't rotate a freaking tower, it won't work
- return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped();
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
index 676da3d7ac..9bd2a66250 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
@@ -350,7 +350,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En
@Override
protected IAlignmentLimits getInitialAlignmentLimits() {
- return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped();
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
index c820731415..392726e13a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
@@ -136,7 +136,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM
@Override
protected IAlignmentLimits getInitialAlignmentLimits() {
- return (d, r, f) -> !r.isUpsideDown() && f.isNotFlipped();
+ return (d, r, f) -> !r.isUpsideDown() && !f.isVerticallyFliped();
}
@Override
--
cgit
From 875ff766ce3801918c9d726a8a14a6710e655147 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Mon, 19 Jul 2021 19:25:36 +0800
Subject: Make block hint text more informative
Also migrated from defer to lazy where possible
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../GT_MetaTileEntity_CubicMultiBlockBase.java | 38 ++--
.../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 2 +-
.../api/util/GT_Multiblock_Tooltip_Builder.java | 200 +++++++++++++++++++--
.../multi/GT_MetaTileEntity_AssemblyLine.java | 25 ++-
.../GT_MetaTileEntity_ConcreteBackfillerBase.java | 10 +-
.../multi/GT_MetaTileEntity_DieselEngine.java | 45 ++---
.../multi/GT_MetaTileEntity_DistillationTower.java | 18 +-
.../multi/GT_MetaTileEntity_DrillerBase.java | 51 +++---
.../GT_MetaTileEntity_ElectricBlastFurnace.java | 14 +-
.../GT_MetaTileEntity_ExtremeDieselEngine.java | 12 +-
.../multi/GT_MetaTileEntity_FusionComputer.java | 129 ++++++-------
.../multi/GT_MetaTileEntity_FusionComputer1.java | 6 +-
.../multi/GT_MetaTileEntity_FusionComputer2.java | 6 +-
.../multi/GT_MetaTileEntity_FusionComputer3.java | 6 +-
.../multi/GT_MetaTileEntity_HeatExchanger.java | 11 +-
.../GT_MetaTileEntity_ImplosionCompressor.java | 10 +-
.../multi/GT_MetaTileEntity_LargeBoiler.java | 61 ++++---
.../GT_MetaTileEntity_LargeChemicalReactor.java | 22 +--
.../multi/GT_MetaTileEntity_LargeTurbine.java | 41 +++--
.../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 8 +-
.../GT_MetaTileEntity_LargeTurbine_HPSteam.java | 8 +-
.../GT_MetaTileEntity_LargeTurbine_Plasma.java | 8 +-
.../GT_MetaTileEntity_LargeTurbine_Steam.java | 8 +-
.../multi/GT_MetaTileEntity_MultiFurnace.java | 12 +-
.../multi/GT_MetaTileEntity_OilCracker.java | 13 +-
.../multi/GT_MetaTileEntity_OilDrillBase.java | 8 +-
.../GT_MetaTileEntity_OreDrillingPlantBase.java | 10 +-
.../multi/GT_MetaTileEntity_ProcessingArray.java | 12 +-
.../multi/GT_MetaTileEntity_PyrolyseOven.java | 18 +-
.../multi/GT_MetaTileEntity_VacuumFreezer.java | 8 +-
src/main/resources/assets/gregtech/lang/en_US.lang | 20 +++
31 files changed, 531 insertions(+), 309 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
index c84ca61eec..5499e756ba 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -6,7 +6,7 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.item.ItemStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
@@ -16,7 +16,8 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
* A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere.
* Controller will be placed in front center of the structure.
*
- * Note: You cannot use different casing for the same Class. Make a new subclass for it.
+ * Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the casing
+ * dynamically, i.e. it should be a dumb method returning some sort of constant.
*
* Implementation tips:
* 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
@@ -28,20 +29,25 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
*/
public abstract class GT_MetaTileEntity_CubicMultiBlockBase> extends GT_MetaTileEntity_EnhancedMultiBlockBase {
protected static final String STRUCTURE_PIECE_MAIN = "main";
- protected static final IStructureDefinition> STRUCTURE_DEFINITION = StructureDefinition.>builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {"hhh", "hhh", "hhh"},
- {"h-h", "hhh", "hhh"},
- {"hhh", "hhh", "hhh"},
- }))
- .addElement('h', ofChain(
- defer(t -> ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, t.getHatchTextureIndex(), 1)),
- onElementPass(
- GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
- defer(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)
- )
- ))
- .build();
+ protected static final ClassValue>> STRUCTURE_DEFINITION = new ClassValue>>() {
+ @Override
+ protected IStructureDefinition> computeValue(Class> type) {
+ return StructureDefinition.>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"hhh", "hhh", "hhh"},
+ {"h-h", "hhh", "hhh"},
+ {"hhh", "hhh", "hhh"},
+ }))
+ .addElement('h', ofChain(
+ lazy(t -> ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, t.getHatchTextureIndex(), 1)),
+ onElementPass(
+ GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
+ lazy(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)
+ )
+ ))
+ .build();
+ }
+ };
private int mCasingAmount = 0;
protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) {
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
index a9b50e6662..cc2513f5c2 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java
@@ -128,7 +128,7 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase
* Info section order should be:
@@ -32,12 +39,16 @@ import net.minecraft.util.StatCollector;
public class GT_Multiblock_Tooltip_Builder {
private static final String TAB = " ";
private static final String COLON = ": ";
-
+ private static final String SEPARATOR = ", ";
+
private final List iLines;
private final List sLines;
-
+ private final List hLines;
+ private final SetMultimap hBlocks;
+
private String[] iArray;
private String[] sArray;
+ private String[] hArray;
//Localized tooltips
private static final String TT_machineType = StatCollector.translateToLocal("GT5U.MBTT.MachineType");
@@ -58,11 +69,17 @@ public class GT_Multiblock_Tooltip_Builder {
private static final String TT_pps = StatCollector.translateToLocal("GT5U.MBTT.PPS");
private static final String TT_hold = StatCollector.translateToLocal("GT5U.MBTT.Hold");
private static final String TT_todisplay = StatCollector.translateToLocal("GT5U.MBTT.Display");
+ private static final String TT_structurehint = StatCollector.translateToLocal("GT5U.MBTT.StructureHint");
private static final String TT_mod = StatCollector.translateToLocal("GT5U.MBTT.Mod");
+ private static final String TT_air = StatCollector.translateToLocal("GT5U.MBTT.Air");
+ private static final String[] TT_dots = IntStream.range(0, 16).mapToObj(i -> StatCollector.translateToLocal("GT5U.MBTT.Dots." + i)).toArray(String[]::new);
public GT_Multiblock_Tooltip_Builder() {
iLines = new LinkedList<>();
sLines = new LinkedList<>();
+ hLines = new LinkedList<>();
+ hBlocks = Multimaps.newSetMultimap(new HashMap<>(), HashSet::new);
+ hBlocks.put(0, TT_air);
}
/**
@@ -103,11 +120,10 @@ public class GT_Multiblock_Tooltip_Builder {
}
/**
- * Add a line telling you what the machine type is. Usually, this will be the name of a SB version.
- * Machine Type: machine
+ * Add a line telling how much this machine pollutes.
*
- * @param machine
- * Name of the machine type
+ * @param pollution
+ * Amount of pollution per second when active
*
* @return Instance this method was called on.
*/
@@ -307,7 +323,136 @@ public class GT_Multiblock_Tooltip_Builder {
sLines.add(TAB + TT_outputhatch + COLON + info);
return this;
}
-
+
+ /**
+ * Use this method to add a structural part that isn't covered by the other methods.
+ * (indent)name: info
+ * @param name
+ * Name of the hatch or other component.
+ * @param info
+ * Positional information.
+ * @param dots
+ * The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addOtherStructurePart(String name, String info, int... dots) {
+ sLines.add(TAB + name + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, name);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Maintenance Hatch: info
+ *
+ * @param info Positional information.
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addMaintenanceHatch(String info, int... dots) {
+ sLines.add(TAB + TT_maintenancehatch + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_maintenancehatch);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Muffler Hatch: info
+ *
+ * @param info Location where the hatch goes
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addMufflerHatch(String info, int... dots) {
+ sLines.add(TAB + TT_mufflerhatch + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_mufflerhatch);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Energy Hatch: info
+ *
+ * @param info Positional information.
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addEnergyHatch(String info, int... dots) {
+ sLines.add(TAB + TT_energyhatch + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_energyhatch);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Dynamo Hatch: info
+ *
+ * @param info Positional information.
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addDynamoHatch(String info, int... dots) {
+ sLines.add(TAB + TT_dynamohatch + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_dynamohatch);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Input Bus: info
+ *
+ * @param info Location where the bus goes
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addInputBus(String info, int... dots) {
+ sLines.add(TAB + TT_inputbus + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_inputbus);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Input Hatch: info
+ *
+ * @param info Location where the hatch goes
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addInputHatch(String info, int... dots) {
+ sLines.add(TAB + TT_inputhatch + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_inputhatch);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Output Bus: info
+ *
+ * @param info Location where the bus goes
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addOutputBus(String info, int... dots) {
+ sLines.add(TAB + TT_outputbus + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_outputbus);
+ return this;
+ }
+
+ /**
+ * Add a line of information about the structure:
+ * (indent)Output Hatch: info
+ *
+ * @param info Location where the bus goes
+ * @param dots The valid locations for this part when asked to display hints
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addOutputHatch(String info, int... dots) {
+ sLines.add(TAB + TT_outputhatch + COLON + info);
+ for (int dot : dots) hBlocks.put(dot, TT_outputhatch);
+ return this;
+ }
+
/**
* Use this method to add non-standard structural info.
* (indent)info
@@ -319,6 +464,30 @@ public class GT_Multiblock_Tooltip_Builder {
sLines.add(TAB + info);
return this;
}
+
+ /**
+ * Use this method to add non-standard structural hint. This info will appear before the standard structural hint.
+ * @param info
+ * The line to be added. This should be an entry into minecraft's localization system.
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addStructureHint(String info) {
+ hLines.add(StatCollector.translateToLocal(info));
+ return this;
+ }
+
+ /**
+ * Use this method to add an entry to standard structural hint without creating a corresponding line in structure information
+ * @param name
+ * The name of block This should be an entry into minecraft's localization system.
+ * @param dots
+ * Possible locations of this block
+ * @return Instance this method was called on.
+ */
+ public GT_Multiblock_Tooltip_Builder addStructureHint(String name, int... dots) {
+ for (int dot : dots) hBlocks.put(dot, StatCollector.translateToLocal(name));
+ return this;
+ }
/**
* Call at the very end.
@@ -331,10 +500,10 @@ public class GT_Multiblock_Tooltip_Builder {
public void toolTipFinisher(String mod) {
iLines.add(TT_hold + " " + EnumChatFormatting.BOLD + "[LSHIFT]" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + " " + TT_todisplay);
iLines.add(TT_mod + COLON + EnumChatFormatting.GREEN + mod + EnumChatFormatting.GRAY);
- iArray = new String[iLines.size()];
- sArray = new String[sLines.size()];
- iLines.toArray(iArray);
- sLines.toArray(sArray);
+ hLines.add(TT_structurehint);
+ iArray = iLines.toArray(new String[0]);
+ sArray = sLines.toArray(new String[0]);
+ hArray = Stream.concat(hLines.stream(), hBlocks.asMap().entrySet().stream().map(e -> TT_dots[e.getKey()] + COLON + String.join(SEPARATOR, e.getValue()))).toArray(String[]::new);
}
public String[] getInformation() {
@@ -345,4 +514,7 @@ public class GT_Multiblock_Tooltip_Builder {
return sArray;
}
+ public String[] getStructureHint() {
+ return hArray;
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index dd10b2465d..60aa372d20 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -69,18 +69,18 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu
.addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing
.addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass")))
.addElement('e', ofHatchAdderOptional(GT_MetaTileEntity_AssemblyLine::addEnergyInputToMachineList, 16, 1, GregTech_API.sBlockCasings2, 0))
- .addElement('d', ofHatchAdderOptional(GT_MetaTileEntity_AssemblyLine::addDataAccessToMachineList, 42, 1, GregTech_API.sBlockCasings3, 10))
+ .addElement('d', ofHatchAdderOptional(GT_MetaTileEntity_AssemblyLine::addDataAccessToMachineList, 42, 2, GregTech_API.sBlockCasings3, 10))
.addElement('b', ofChain(
- ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addMaintenanceToMachineList, 16, 2),
- ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputHatchToMachineList, 16, 2),
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addMaintenanceToMachineList, 16, 3),
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputHatchToMachineList, 16, 3),
ofBlock(GregTech_API.sBlockCasings2, 0)
))
.addElement('I', ofChain(
// all blocks nearby use solid steel casing, so let's use the texture of that
- ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 2),
- ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16, 2)
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 4),
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16,4)
))
- .addElement('i', ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 2))
+ .addElement('i', ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 5))
.build();
public GT_MetaTileEntity_AssemblyLine(int aID, String aName, String aNameRegional) {
@@ -111,15 +111,14 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu
.addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing")
.addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty")
.addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes, aside from the last")
- .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller")
- .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller")//TT
.addController("Either Grate on layer 3 of the first slice")
- .addEnergyHatch("Any layer 4 casing")
- .addMaintenanceHatch("Any layer 1 casing")
- .addInputBus("As specified on layer 1")
- .addInputHatch("Any layer 1 casing")
- .addOutputBus("Replaces Input Bus on final slice")
+ .addEnergyHatch("Any layer 4 casing", 1)
+ .addMaintenanceHatch("Any layer 1 casing", 3)
+ .addInputBus("As specified on layer 1", 4, 5)
+ .addInputHatch("Any layer 1 casing", 3)
+ .addOutputBus("Replaces Input Bus on final slice", 4)
+ .addOtherStructurePart("Data Access Hatch", "Optional, next to controller", 2)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
index 2341452ebe..8c1f28dd1c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
@@ -39,11 +39,11 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
.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("GT Concrete, any base casing")
- .addOutputBus("Mining Pipes, optional, any base casing")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1)
+ .addMaintenanceHatch("Any base casing", 1)
+ .addInputBus("Mining Pipes, optional, any base casing", 1)
+ .addInputHatch("GT Concrete, any base casing", 1)
+ .addOutputBus("Mining Pipes, optional, any base casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
index 567297648a..8dfc605d6b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
@@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE;
@@ -37,18 +37,23 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMultiBlockBase {
private static final String STRUCTURE_PIECE_MAIN = "main";
- private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {"---", "iii", "chc", "chc", "ccc", },
- {"---", "i~i", "hgh", "hgh", "cdc", },
- {"---", "iii", "chc", "chc", "ccc", },
- }))
- .addElement('i', defer(t -> ofBlock(t.getIntakeBlock(), t.getIntakeMeta())))
- .addElement('c', defer(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta())))
- .addElement('g', defer(t -> ofBlock(t.getGearboxBlock(), t.getGearboxMeta())))
- .addElement('d', defer(t -> ofHatchAdder(GT_MetaTileEntity_DieselEngine::addDynamoToMachineList, t.getCasingTextureIndex(), 0)))
- .addElement('h', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_DieselEngine::addToMachineList, t.getCasingTextureIndex(), 0, t.getCasingBlock(), t.getCasingMeta())))
- .build();
+ private static final ClassValue> STRUCTURE_DEFINITION = new ClassValue>() {
+ @Override
+ protected IStructureDefinition computeValue(Class> type) {
+ return StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"---", "iii", "chc", "chc", "ccc", },
+ {"---", "i~i", "hgh", "hgh", "cdc", },
+ {"---", "iii", "chc", "chc", "ccc", },
+ }))
+ .addElement('i', lazy(t -> ofBlock(t.getIntakeBlock(), t.getIntakeMeta())))
+ .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta())))
+ .addElement('g', lazy(t -> ofBlock(t.getGearboxBlock(), t.getGearboxMeta())))
+ .addElement('d', lazy(t -> ofHatchAdder(GT_MetaTileEntity_DieselEngine::addDynamoToMachineList, t.getCasingTextureIndex(), 2)))
+ .addElement('h', lazy(t -> ofHatchAdderOptional(GT_MetaTileEntity_DieselEngine::addToMachineList, t.getCasingTextureIndex(), 1, t.getCasingBlock(), t.getCasingMeta())))
+ .build();
+ }
+ };
protected int fuelConsumption = 0;
protected int fuelValue = 0;
protected int fuelRemaining = 0;
@@ -80,12 +85,12 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu
.addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks")
.addOtherStructurePart("Engine Intake Machine Casing", "8x, ring around controller")
.addStructureInfo("Engine Intake Casings must not be obstructed in front (only air blocks)")
- .addDynamoHatch("Back center")
- .addMaintenanceHatch("One of the casings next to a Gear Box")
- .addMufflerHatch("Top middle back, above the rear Gear Box")
- .addInputHatch("Diesel Fuel, next to a Gear Box")
- .addInputHatch("Lubricant, next to a Gear Box")
- .addInputHatch("Oxygen, optional, next to a Gear Box")
+ .addDynamoHatch("Back center", 2)
+ .addMaintenanceHatch("One of the casings next to a Gear Box", 1)
+ .addMufflerHatch("Top middle back, above the rear Gear Box", 1)
+ .addInputHatch("Diesel Fuel, next to a Gear Box", 1)
+ .addInputHatch("Lubricant, next to a Gear Box", 1)
+ .addInputHatch("Oxygen, optional, next to a Gear Box", 1)
.toolTipFinisher("Gregtech");
return tt;
}
@@ -192,7 +197,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu
@Override
public IStructureDefinition getStructureDefinition() {
- return STRUCTURE_DEFINITION;
+ return STRUCTURE_DEFINITION.get(getClass());
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index b35d6e3c56..3710112c9b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -53,14 +53,14 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan
onElementPass(GT_MetaTileEntity_DistillationTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1))
))
.addElement('l', ofChain(
- ofHatchAdder(GT_MetaTileEntity_DistillationTower::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addEnergyInputToMachineList, CASING_INDEX, 2),
ofHatchAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch, CASING_INDEX, 2),
- ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 2),
onElementPass(GT_MetaTileEntity_DistillationTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1))
))
.addElement('c', ofChain(
- onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GT_MetaTileEntity_DistillationTower::addOutputToMachineList, CASING_INDEX, 1)),
- onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 1)),
+ onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GT_MetaTileEntity_DistillationTower::addOutputToMachineList, CASING_INDEX, 3)),
+ onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 3)),
onElementPass(t -> t.onTopLayerFound(true), ofBlock(GregTech_API.sBlockCasings4, 1)),
isAir()
))
@@ -94,11 +94,11 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan
.beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true)
.addController("Front bottom")
.addOtherStructurePart("Clean Stainless Steel Machine Casing", "7 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 (At least one per layer except bottom layer)")
+ .addEnergyHatch("Any casing", 1, 2)
+ .addMaintenanceHatch("Any casing", 1, 2, 3)
+ .addInputHatch("Any bottom layer casing", 1)
+ .addOutputBus("Any bottom layer casing", 1)
+ .addOutputHatch("2-11x Output Hatches (At least one per layer except bottom layer)", 2, 3)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
index 0ea04f1cfa..a610a502f9 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
@@ -30,7 +30,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+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.transpose;
@@ -48,27 +48,32 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En
private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe);
private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(miningPipeTip);
protected static final String STRUCTURE_PIECE_MAIN = "main";
- protected static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {" ", " f ", " "},
- {" ", " f ", " "},
- {" ", " f ", " "},
- {" f ", "fcf", " f "},
- {" f ", "fcf", " f "},
- {" f ", "fcf", " f "},
- {"b~b", "bbb", "bbb"},
- }))
- .addElement('f', defer(t -> ofBlock(GregTech_API.sBlockMachines, t.frameMeta)))
- .addElement('c', defer(t -> ofBlock(t.casingBlock, t.casingMeta)))
- .addElement('b', defer(t -> ofChain(
- ofBlock(t.casingBlock, t.casingMeta),
- ofHatchAdder(GT_MetaTileEntity_DrillerBase::addMaintenanceToMachineList, t.casingTextureIndex, 1),
- ofHatchAdder(GT_MetaTileEntity_DrillerBase::addInputToMachineList, t.casingTextureIndex, 1),
- ofHatchAdder(GT_MetaTileEntity_DrillerBase::addOutputToMachineList, t.casingTextureIndex, 1),
- ofHatchAdder(GT_MetaTileEntity_DrillerBase::addEnergyInputToMachineList, t.casingTextureIndex, 1),
- ofHatchAdder(GT_MetaTileEntity_DrillerBase::addDataAccessToMachineList, t.casingTextureIndex, 1)
- )))
- .build();
+ protected static final ClassValue> STRUCTURE_DEFINITION = new ClassValue>() {
+ @Override
+ protected IStructureDefinition computeValue(Class> type) {
+ return StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {" ", " f ", " "},
+ {" ", " f ", " "},
+ {" ", " f ", " "},
+ {" f ", "fcf", " f "},
+ {" f ", "fcf", " f "},
+ {" f ", "fcf", " f "},
+ {"b~b", "bbb", "bbb"},
+ }))
+ .addElement('f', lazy(t -> ofBlock(GregTech_API.sBlockMachines, t.frameMeta)))
+ .addElement('c', lazy(t -> ofBlock(t.casingBlock, t.casingMeta)))
+ .addElement('b', lazy(t -> ofChain(
+ ofBlock(t.casingBlock, t.casingMeta),
+ ofHatchAdder(GT_MetaTileEntity_DrillerBase::addMaintenanceToMachineList, t.casingTextureIndex, 1),
+ ofHatchAdder(GT_MetaTileEntity_DrillerBase::addInputToMachineList, t.casingTextureIndex, 1),
+ ofHatchAdder(GT_MetaTileEntity_DrillerBase::addOutputToMachineList, t.casingTextureIndex, 1),
+ ofHatchAdder(GT_MetaTileEntity_DrillerBase::addEnergyInputToMachineList, t.casingTextureIndex, 1),
+ ofHatchAdder(GT_MetaTileEntity_DrillerBase::addDataAccessToMachineList, t.casingTextureIndex, 1)
+ )))
+ .build();
+ }
+ };
private Block casingBlock;
private int casingMeta;
@@ -355,7 +360,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En
@Override
public final IStructureDefinition getStructureDefinition() {
- return STRUCTURE_DEFINITION;
+ return STRUCTURE_DEFINITION.get(getClass());
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index c7a3c3490d..d3c9e7176b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -90,13 +90,13 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
.addController("Front bottom")
.addCasingInfo("Heat Proof Machine Casing", 0)
.addOtherStructurePart("Heating Coils", "Two middle Layers")
- .addEnergyHatch("Any bottom layer casing")
- .addMaintenanceHatch("Any bottom layer casing")
- .addMufflerHatch("Top middle")
- .addInputBus("Any bottom layer casing")
- .addInputHatch("Any bottom layer casing")
- .addOutputBus("Any bottom layer casing")
- .addOutputHatch("Gasses, Any top layer casing")
+ .addEnergyHatch("Any bottom layer casing", 3)
+ .addMaintenanceHatch("Any bottom layer casing", 3)
+ .addMufflerHatch("Top middle", 2)
+ .addInputBus("Any bottom layer casing", 3)
+ .addInputHatch("Any bottom layer casing", 3)
+ .addOutputBus("Any bottom layer casing", 3)
+ .addOutputHatch("Gasses, Any top layer casing", 1)
.addStructureInfo("Recovery amount scales with Muffler Hatch tier")
.addOutputHatch("Platline fluids, Any bottom layer casing")
.toolTipFinisher("Gregtech");
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
index f85f27935e..1878f25a5f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
@@ -51,12 +51,12 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die
.addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks")
.addOtherStructurePart("Extreme Engine Intake Machine Casing", "8x, ring around controller")
.addStructureInfo("Extreme Engine Intake Casings must not be obstructed in front (only air blocks)")
- .addDynamoHatch("Back center")
- .addMaintenanceHatch("One of the casings next to a Gear Box")
- .addMufflerHatch("Top middle back, above the rear Gear Box")
- .addInputHatch("HOG, next to a Gear Box")
- .addInputHatch("Lubricant, next to a Gear Box")
- .addInputHatch("Liquid Oxygen, optional, next to a Gear Box")
+ .addDynamoHatch("Back center", 2)
+ .addMaintenanceHatch("One of the casings next to a Gear Box", 1)
+ .addMufflerHatch("Top middle back, above the rear Gear Box", 1)
+ .addInputHatch("HOG, next to a Gear Box", 1)
+ .addInputHatch("Lubricant, next to a Gear Box", 1)
+ .addInputHatch("Liquid Oxygen, optional, next to a Gear Box", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java
index bf2aeadcf8..88604979d2 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java
@@ -29,7 +29,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS;
@@ -39,66 +39,71 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity_EnhancedMultiBlockBase {
public static final String STRUCTURE_PIECE_MAIN = "main";
- private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {
- " ",
- " ihi ",
- " hh hh ",
- " h h ",
- " h h ",
- " h h ",
- " i i ",
- " h h ",
- " i i ",
- " h h ",
- " h h ",
- " h h ",
- " hh hh ",
- " ihi ",
- " ",
- },
- {
- " xhx ",
- " hhccchh ",
- " eccxhxcce ",
- " eceh hece ",
- " hce ech ",
- " hch hch ",
- "xcx xcx",
- "hch hch",
- "xcx xcx",
- " hch hch ",
- " hce ech ",
- " eceh hece ",
- " eccx~xcce ",
- " hhccchh ",
- " xhx ",
- },
- {
- " ",
- " ihi ",
- " hh hh ",
- " h h ",
- " h h ",
- " h h ",
- " i i ",
- " h h ",
- " i i ",
- " h h ",
- " h h ",
- " h h ",
- " hh hh ",
- " ihi ",
- " ",
- }
- }))
- .addElement('c', defer(t -> ofBlock(t.getFusionCoil(), t.getFusionCoilMeta())))
- .addElement('h', defer(t -> ofBlock(t.getCasing(), t.getCasingMeta())))
- .addElement('i', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addInjector, 53, 1, t.getCasing(), t.getCasingMeta())))
- .addElement('e', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addEnergyInjector, 53, 1, t.getCasing(), t.getCasingMeta())))
- .addElement('x', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addExtractor, 53, 1, t.getCasing(), t.getCasingMeta())))
- .build();
+ private static final ClassValue> STRUCTURE_DEFINITION = new ClassValue>() {
+ @Override
+ protected IStructureDefinition computeValue(Class> type) {
+ return StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {
+ " ",
+ " ihi ",
+ " hh hh ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " hh hh ",
+ " ihi ",
+ " ",
+ },
+ {
+ " xhx ",
+ " hhccchh ",
+ " eccxhxcce ",
+ " eceh hece ",
+ " hce ech ",
+ " hch hch ",
+ "xcx xcx",
+ "hch hch",
+ "xcx xcx",
+ " hch hch ",
+ " hce ech ",
+ " eceh hece ",
+ " eccx~xcce ",
+ " hhccchh ",
+ " xhx ",
+ },
+ {
+ " ",
+ " ihi ",
+ " hh hh ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " i i ",
+ " h h ",
+ " h h ",
+ " h h ",
+ " hh hh ",
+ " ihi ",
+ " ",
+ }
+ }))
+ .addElement('c', lazy(t -> ofBlock(t.getFusionCoil(), t.getFusionCoilMeta())))
+ .addElement('h', lazy(t -> ofBlock(t.getCasing(), t.getCasingMeta())))
+ .addElement('i', lazy(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addInjector, 53, 1, t.getCasing(), t.getCasingMeta())))
+ .addElement('e', lazy(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addEnergyInjector, 53, 2, t.getCasing(), t.getCasingMeta())))
+ .addElement('x', lazy(t -> ofHatchAdderOptional(GT_MetaTileEntity_FusionComputer::addExtractor, 53, 3, t.getCasing(), t.getCasingMeta())))
+ .build();
+ }
+ };
public GT_Recipe mLastRecipe;
public int mEUStore;
@@ -154,7 +159,7 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
@Override
public IStructureDefinition getStructureDefinition() {
- return STRUCTURE_DEFINITION;
+ return STRUCTURE_DEFINITION.get(getClass());
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
index 2901a9e4f1..dd942d2635 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
@@ -75,9 +75,9 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC
.addCasingInfo("LuV Machine Casing", 79)
.addStructureInfo("Cover the coils with casing")
.addOtherStructurePart("Superconducting Coil Block", "Center part of the ring")
- .addEnergyHatch("1-16, Specified casings")
- .addInputHatch("2-16, Specified casings")
- .addOutputHatch("1-16, Specified casings")
+ .addEnergyHatch("1-16, Specified casings", 2)
+ .addInputHatch("2-16, Specified casings", 1)
+ .addOutputHatch("1-16, Specified casings", 3)
.addStructureInfo("ALL Hatches must be LuV or better")
.toolTipFinisher("Gregtech");
return tt;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
index 6cefdc6812..de9d863529 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
@@ -75,9 +75,9 @@ public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionC
.addCasingInfo("Fusion Machine Casing", 79)
.addStructureInfo("Cover the coils with casing")
.addOtherStructurePart("Fusion Coil Block", "Center part of the ring")
- .addEnergyHatch("1-16, Specified casings")
- .addInputHatch("2-16, Specified casings")
- .addOutputHatch("1-16, Specified casings")
+ .addEnergyHatch("1-16, Specified casings", 2)
+ .addInputHatch("2-16, Specified casings", 1)
+ .addOutputHatch("1-16, Specified casings", 3)
.addStructureInfo("ALL Hatches must be ZPM or better")
.toolTipFinisher("Gregtech");
return tt;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
index b879c7923b..4e5c6c3cad 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
@@ -75,9 +75,9 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC
.addCasingInfo("Fusion Machine Casing Mk II", 79)
.addStructureInfo("Cover the coils with casing")
.addOtherStructurePart("Fusion Coil Block", "Center part of the ring")
- .addEnergyHatch("1-16, Specified casings")
- .addInputHatch("2-16, Specified casings")
- .addOutputHatch("1-16, Specified casings")
+ .addEnergyHatch("1-16, Specified casings", 2)
+ .addInputHatch("2-16, Specified casings", 1)
+ .addOutputHatch("1-16, Specified casings", 3)
.addStructureInfo("ALL Hatches must be UV or better")
.toolTipFinisher("Gregtech");
return tt;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
index 392726e13a..e8beb270e0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
@@ -52,7 +52,6 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM
ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addInputToMachineList, CASING_INDEX, 1),
ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addOutputToMachineList, CASING_INDEX, 1),
ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addMaintenanceToMachineList, CASING_INDEX, 1),
- ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addEnergyInputToMachineList, CASING_INDEX, 1),
onElementPass(GT_MetaTileEntity_HeatExchanger::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, (byte) 2))
))
.build();
@@ -87,11 +86,11 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM
.addController("Front bottom")
.addCasingInfo("Stable Titanium Machine Casing", 20)
.addOtherStructurePart("Titanium Pipe Casing", "Center 2 blocks")
- .addMaintenanceHatch("Any casing")
- .addInputHatch("Hot fluid, bottom center")
- .addInputHatch("Distilled water, any casing")
- .addOutputHatch("Cold fluid, top center")
- .addOutputHatch("Steam/SH Steam, any casing")
+ .addMaintenanceHatch("Any casing", 1)
+ .addInputHatch("Hot fluid, bottom center", 2)
+ .addInputHatch("Distilled water, any casing", 1)
+ .addOutputHatch("Cold fluid, top center", 3)
+ .addOutputHatch("Steam/SH Steam, any casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
index 41b40f56fa..17417a09c8 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
@@ -51,11 +51,11 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Cub
.addController("Front center")
.addCasingInfo("Solid Steel Machine Casing", 16)
.addStructureInfo("Casings can be replaced with Explosion Warning Signs")
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addMufflerHatch("Any casing")
- .addInputBus("Any casing")
- .addOutputBus("Any casing")
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
index 7f409f38f4..8565ae8774 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
@@ -26,7 +26,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+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;
@@ -40,26 +40,31 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_EnhancedMultiBlockBase {
private static final String STRUCTURE_PIECE_MAIN = "main";
- private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {"ccc", "ccc", "ccc"},
- {"ccc", "cPc", "ccc"},
- {"ccc", "cPc", "ccc"},
- {"ccc", "cPc", "ccc"},
- {"f~f", "fff", "fff"},
- }))
- .addElement('P', defer(t -> ofBlock(t.getPipeBlock(), t.getPipeMeta())))
- .addElement('c', defer(t -> ofChain(
- ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addOutputToMachineList, t.getCasingTextureIndex(), 2),
- onElementPass(GT_MetaTileEntity_LargeBoiler::onCasingAdded, ofBlock(t.getCasingBlock(), t.getCasingMeta()))
- )))
- .addElement('f', defer(t -> ofChain(
- ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addMaintenanceToMachineList, t.getCasingTextureIndex(), 1),
- ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addInputToMachineList, t.getCasingTextureIndex(), 1),
- ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addMufflerToMachineList, t.getCasingTextureIndex(), 1),
- onElementPass(GT_MetaTileEntity_LargeBoiler::onFireboxAdded, ofBlock(t.getCasingBlock(), t.getCasingMeta()))
- )))
- .build();
+ private static final ClassValue> STRUCTURE_DEFINITION =new ClassValue>() {
+ @Override
+ protected IStructureDefinition computeValue(Class> type) {
+ return StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"ccc", "ccc", "ccc"},
+ {"ccc", "cPc", "ccc"},
+ {"ccc", "cPc", "ccc"},
+ {"ccc", "cPc", "ccc"},
+ {"f~f", "fff", "fff"},
+ }))
+ .addElement('P', lazy(t -> ofBlock(t.getPipeBlock(), t.getPipeMeta())))
+ .addElement('c', lazy(t -> ofChain(
+ ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addOutputToMachineList, t.getCasingTextureIndex(), 2),
+ onElementPass(GT_MetaTileEntity_LargeBoiler::onCasingAdded, ofBlock(t.getCasingBlock(), t.getCasingMeta()))
+ )))
+ .addElement('f', lazy(t -> ofChain(
+ ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addMaintenanceToMachineList, t.getCasingTextureIndex(), 1),
+ ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addInputToMachineList, t.getCasingTextureIndex(), 1),
+ ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addMufflerToMachineList, t.getCasingTextureIndex(), 1),
+ onElementPass(GT_MetaTileEntity_LargeBoiler::onFireboxAdded, ofBlock(t.getCasingBlock(), t.getCasingMeta()))
+ )))
+ .build();
+ }
+ };
private boolean firstRun = true;
private int mSuperEfficencyIncrease = 0;
private int integratedCircuitConfig = 0; //Steam output is reduced by 1000L per config
@@ -92,13 +97,13 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En
.addCasingInfo(getCasingMaterial() + " " + getCasingBlockType() + " Casing", 24)//?
.addOtherStructurePart(getCasingMaterial() + " Fire Boxes", "Bottom layer, 3 minimum")
.addOtherStructurePart(getCasingMaterial() + " Pipe Casing Blocks", "Inner 3 blocks")
- .addMaintenanceHatch("Any firebox")
- .addMufflerHatch("Any firebox")
- .addInputBus("Solid fuel, Any firebox")
- .addInputHatch("Liquid fuel, Any firebox")
+ .addMaintenanceHatch("Any firebox", 1)
+ .addMufflerHatch("Any firebox", 1)
+ .addInputBus("Solid fuel, Any firebox", 1)
+ .addInputHatch("Liquid fuel, Any firebox", 1)
.addStructureInfo("You can use either, or both")
- .addInputHatch("Water, Any firebox")
- .addOutputHatch("Steam, any casing")
+ .addInputHatch("Water, Any firebox", 1)
+ .addOutputHatch("Steam, any casing", 2)
.toolTipFinisher("Gregtech");
return tt;
}
@@ -271,7 +276,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En
@Override
public IStructureDefinition getStructureDefinition() {
- return STRUCTURE_DEFINITION;
+ return STRUCTURE_DEFINITION.get(getClass());
}
private void onCasingAdded() {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
index 072f54e4af..63b536fc72 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
@@ -47,10 +47,10 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En
onElementPass(GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, ofBlock(GregTech_API.sBlockCasings8, 0))
))
.addElement('x', ofChain(
- ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addInputToMachineList, CASING_INDEX, 1),
- ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addOutputToMachineList, CASING_INDEX, 1),
- ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addMaintenanceToMachineList, CASING_INDEX, 1),
- ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addInputToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addOutputToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addMaintenanceToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_LargeChemicalReactor::addEnergyInputToMachineList, CASING_INDEX, 2),
onElementPass(GT_MetaTileEntity_LargeChemicalReactor::onCoilAdded, ofBlock(GregTech_API.sBlockCasings5, 0)),
onElementPass(GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, ofBlock(GregTech_API.sBlockCasings8, 0))
))
@@ -84,13 +84,13 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En
.addController("Front center")
.addCasingInfo("Chemically Inert Machine Casing", 8)
.addOtherStructurePart("PTFE Pipe Machine Casing", "Center")
- .addOtherStructurePart("Cupronickel Coil Block", "Adjacent to the PTFE Pipe Machine Casing")
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addInputBus("Any casing")
- .addInputHatch("Any casing")
- .addOutputBus("Any casing")
- .addOutputHatch("Any casing")
+ .addOtherStructurePart("Cupronickel Coil Block", "Adjacent to the PTFE Pipe Machine Casing", 1)
+ .addEnergyHatch("Any casing", 1, 2)
+ .addMaintenanceHatch("Any casing", 1, 2)
+ .addInputBus("Any casing", 1, 2)
+ .addInputHatch("Any casing", 1, 2)
+ .addOutputBus("Any casing", 1, 2)
+ .addOutputHatch("Any casing", 1, 2)
.addStructureInfo("You can have multiple hatches/busses")
.toolTipFinisher("Gregtech");
return tt;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
index fd3117e451..f0a5abbe62 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
@@ -22,7 +22,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
@@ -30,22 +30,27 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_EnhancedMultiBlockBase {
private static final String STRUCTURE_PIECE_MAIN = "main";
- private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition.builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {" ", "xxxxx", "xxxxx", "xxxxx", "xxxxx",},
- {" --- ", "xcccx", "xchcx", "xchcx", "xcccx",},
- {" --- ", "xc~cx", "xh-hx", "xh-hx", "xcdcx",},
- {" --- ", "xcccx", "xchcx", "xchcx", "xcccx",},
- {" ", "xxxxx", "xxxxx", "xxxxx", "xxxxx",},
- }))
- .addElement('c', defer(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta())))
- .addElement('d', defer(t -> ofHatchAdder(GT_MetaTileEntity_LargeTurbine::addDynamoToMachineList, t.getCasingTextureIndex(), 0)))
- .addElement('h', defer(t -> ofHatchAdderOptional(GT_MetaTileEntity_LargeTurbine::addToMachineList, t.getCasingTextureIndex(), 0, t.getCasingBlock(), t.getCasingMeta())))
- .addElement('x', (IStructureElementCheckOnly) (aContext, aWorld, aX, aY, aZ) -> {
- TileEntity tTile = aWorld.getTileEntity(aX, aY, aZ);
- return !(tTile instanceof IGregTechTileEntity) || !(((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine);
- })
- .build();
+ private static final ClassValue> STRUCTURE_DEFINITION = new ClassValue>() {
+ @Override
+ protected IStructureDefinition computeValue(Class> type) {
+ return StructureDefinition.builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {" ", "xxxxx", "xxxxx", "xxxxx", "xxxxx",},
+ {" --- ", "xcccx", "xchcx", "xchcx", "xcccx",},
+ {" --- ", "xc~cx", "xh-hx", "xh-hx", "xcdcx",},
+ {" --- ", "xcccx", "xchcx", "xchcx", "xcccx",},
+ {" ", "xxxxx", "xxxxx", "xxxxx", "xxxxx",},
+ }))
+ .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta())))
+ .addElement('d', lazy(t -> ofHatchAdder(GT_MetaTileEntity_LargeTurbine::addDynamoToMachineList, t.getCasingTextureIndex(), 1)))
+ .addElement('h', lazy(t -> ofHatchAdderOptional(GT_MetaTileEntity_LargeTurbine::addToMachineList, t.getCasingTextureIndex(), 2, t.getCasingBlock(), t.getCasingMeta())))
+ .addElement('x', (IStructureElementCheckOnly) (aContext, aWorld, aX, aY, aZ) -> {
+ TileEntity tTile = aWorld.getTileEntity(aX, aY, aZ);
+ return !(tTile instanceof IGregTechTileEntity) || !(((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine);
+ })
+ .build();
+ }
+ };
protected int baseEff = 0;
protected int optFlow = 0;
@@ -74,7 +79,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E
@Override
public IStructureDefinition getStructureDefinition() {
- return STRUCTURE_DEFINITION;
+ return STRUCTURE_DEFINITION.get(getClass());
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
index 27e4bf7084..20f795572e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
@@ -46,10 +46,10 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
.beginStructureBlock(3, 3, 4, true)
.addController("Front center")
.addCasingInfo("Stainless Steel Turbine Casing", 24)
- .addDynamoHatch("Back center")
- .addMaintenanceHatch("Side centered")
- .addMufflerHatch("Side centered")
- .addInputHatch("Gas Fuel, Side centered")
+ .addDynamoHatch("Back center", 1)
+ .addMaintenanceHatch("Side centered", 2)
+ .addMufflerHatch("Side centered", 2)
+ .addInputHatch("Gas Fuel, Side centered", 2)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
index 0d22271a34..2c803712f1 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
@@ -54,10 +54,10 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
.beginStructureBlock(3, 3, 4, true)
.addController("Front center")
.addCasingInfo("Titanium Turbine Casing", 24)
- .addDynamoHatch("Back center")
- .addMaintenanceHatch("Side centered")
- .addInputHatch("Superheated Steam, Side centered")
- .addOutputHatch("Steam, Side centered")
+ .addDynamoHatch("Back center", 1)
+ .addMaintenanceHatch("Side centered", 2)
+ .addInputHatch("Superheated Steam, Side centered", 2)
+ .addOutputHatch("Steam, Side centered", 2)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
index d1bf1e7c0b..c34f190242 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
@@ -53,10 +53,10 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
.beginStructureBlock(3, 3, 4, true)
.addController("Front center")
.addCasingInfo("Tungstensteel Turbine Casing", 24)
- .addDynamoHatch("Back center")
- .addMaintenanceHatch("Side centered")
- .addInputHatch("Plasma Fluid, Side centered")
- .addOutputHatch("Molten Fluid, optional, Side centered")
+ .addDynamoHatch("Back center", 1)
+ .addMaintenanceHatch("Side centered", 2)
+ .addInputHatch("Plasma Fluid, Side centered", 2)
+ .addOutputHatch("Molten Fluid, optional, Side centered", 2)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
index 8990ad3324..356dda9183 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
@@ -57,10 +57,10 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
.beginStructureBlock(3, 3, 4, true)
.addController("Front center")
.addCasingInfo("Turbine Casing", 24)
- .addDynamoHatch("Back center")
- .addMaintenanceHatch("Side centered")
- .addInputHatch("Steam, Side centered")
- .addOutputHatch("Distilled Water, Side centered")
+ .addDynamoHatch("Back center", 1)
+ .addMaintenanceHatch("Side centered", 2)
+ .addInputHatch("Steam, Side centered", 2)
+ .addOutputHatch("Distilled Water, Side centered", 2)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index edfce02aad..907de38f6b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
@@ -51,7 +51,7 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
.addElement('c', ofBlock(GregTech_API.sBlockCasings1, CASING_INDEX))
.addElement('m', ofHatchAdder(GT_MetaTileEntity_MultiFurnace::addMufflerToMachineList, CASING_INDEX, 2))
.addElement('C', GT_StructureUtility.ofCoil(GT_MetaTileEntity_MultiFurnace::setCoilLevel, GT_MetaTileEntity_MultiFurnace::getCoilLevel))
- .addElement('b', ofHatchAdderOptional(GT_MetaTileEntity_MultiFurnace::addBottomHatch, CASING_INDEX, 3, GregTech_API.sBlockCasings1, CASING_INDEX))
+ .addElement('b', ofHatchAdderOptional(GT_MetaTileEntity_MultiFurnace::addBottomHatch, CASING_INDEX, 1, GregTech_API.sBlockCasings1, CASING_INDEX))
.build();
public GT_MetaTileEntity_MultiFurnace(int aID, String aName, String aNameRegional) {
@@ -80,11 +80,11 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
.addController("Front bottom")
.addCasingInfo("Heat Proof Machine Casing", 8)
.addOtherStructurePart("Heating Coils", "Middle layer")
- .addEnergyHatch("Any bottom casing")
- .addMaintenanceHatch("Any bottom casing")
- .addMufflerHatch("Top Middle")
- .addInputBus("Any bottom casing")
- .addOutputBus("Any bottom casing")
+ .addEnergyHatch("Any bottom casing", 1)
+ .addMaintenanceHatch("Any bottom casing", 1)
+ .addMufflerHatch("Top Middle", 2)
+ .addInputBus("Any bottom casing", 1)
+ .addOutputBus("Any bottom casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
index 8a257db8ee..c8dbe2321a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
@@ -52,7 +52,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult
onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1))
))
.addElement('r', ofChain(
- ofHatchAdder(GT_MetaTileEntity_OilCracker::addRightHatchToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addRightHatchToMachineList, CASING_INDEX, 3),
onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1))
))
.addElement('m', ofChain(
@@ -91,12 +91,13 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult
.addCasingInfo("Clean Stainless Steel Machine Casing", 18)
.addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller")
.addInfo("Gets 5% EU/t reduction per coil tier")
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addInputHatch("Steam/Hydrogen ONLY, Any middle ring casing")
- .addInputHatch("Any left/right side casing")
- .addOutputHatch("Any left/right side casing")
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addInputHatch("Steam/Hydrogen ONLY, Any middle ring casing", 1)
+ .addInputHatch("Any left/right side casing",2, 3)
+ .addOutputHatch("Any right/left side casing", 2, 3)
.addStructureInfo("Input/Output Hatches must be on opposite sides!")
+ .addStructureHint("GT5U.cracker.io_side")
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
index 554e5dfd63..76231980ec 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -92,10 +92,10 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
.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 or Circuits, optional, any base casing")
- .addOutputHatch("Any base casing")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1)
+ .addMaintenanceHatch("Any base casing", 1)
+ .addInputBus("Mining Pipes or Circuits, optional, any base casing", 1)
+ .addOutputHatch("Any base casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
index 5b4444cec3..b168e44c41 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
@@ -350,11 +350,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
.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("Drilling Fluid, any base casing")
- .addOutputBus("Any base casing")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1)
+ .addMaintenanceHatch("Any base casing", 1)
+ .addInputBus("Mining Pipes, optional, any base casing", 1)
+ .addInputHatch("Drilling Fluid, any base casing", 1)
+ .addOutputBus("Any base casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 0a46c47f7c..ea56266b41 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -76,12 +76,12 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu
.beginStructureBlock(3, 3, 3, true)
.addController("Front center")
.addCasingInfo("Robust Tungstensteel Machine Casing", 14)
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addInputBus("Any casing")
- .addInputHatch("Any casing")
- .addOutputBus("Any casing")
- .addOutputHatch("Any casing")
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addInputBus("Any casing", 1)
+ .addInputHatch("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addOutputHatch("Any casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index 7312e0d992..48da2c5dce 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -63,8 +63,8 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu
onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement)
))
.addElement('t', ofChain(
- ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addInputToMachineList, CASING_INDEX, 1),
- ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addMufflerToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addInputToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addMufflerToMachineList, CASING_INDEX, 2),
onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement)
))
.build();
@@ -95,13 +95,13 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu
.addController("Front center")
.addCasingInfo("Pyrolyse Oven Casing", 60)
.addOtherStructurePart("Heating Coils", "Center 3x1x3 of the bottom layer")
- .addEnergyHatch("Any bottom layer casing")
- .addMaintenanceHatch("Any bottom layer casing")
- .addMufflerHatch("Center 3x1x3 area in top layer")
- .addInputBus("Center 3x1x3 area in top layer")
- .addInputHatch("Center 3x1x3 area in top layer")
- .addOutputBus("Any bottom layer casing")
- .addOutputHatch("Any bottom layer casing")
+ .addEnergyHatch("Any bottom layer casing", 1)
+ .addMaintenanceHatch("Any bottom layer casing", 1)
+ .addMufflerHatch("Center 3x1x3 area in top layer", 2)
+ .addInputBus("Center 3x1x3 area in top layer", 2)
+ .addInputHatch("Center 3x1x3 area in top layer", 2)
+ .addOutputBus("Any bottom layer casing", 1)
+ .addOutputHatch("Any bottom layer casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
index bef433e626..b7f24f7e7a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
@@ -47,10 +47,10 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult
.beginStructureBlock(3, 3, 3, true)
.addController("Front center")
.addCasingInfo("Frost Proof Machine Casing", 16)
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addInputBus("Any casing")
- .addOutputBus("Any casing")
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
.toolTipFinisher("Gregtech");
return tt;
}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index b0d0018312..ce60b8d70e 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -18,7 +18,27 @@ GT5U.MBTT.Causes=Causes
GT5U.MBTT.PPS=pollution per second
GT5U.MBTT.Hold=Hold
GT5U.MBTT.Display=to display structure guidelines
+GT5U.MBTT.StructureHint=Some blocks have multiple candidates or can use any tier
GT5U.MBTT.Mod=Added by
+GT5U.MBTT.Air=Mandatory Air
+GT5U.MBTT.Dots.0=No Dot
+GT5U.MBTT.Dots.1=Dot 1
+GT5U.MBTT.Dots.2=Dot 2
+GT5U.MBTT.Dots.3=Dot 3
+GT5U.MBTT.Dots.4=Dot 4
+GT5U.MBTT.Dots.5=Dot 5
+GT5U.MBTT.Dots.6=Dot 6
+GT5U.MBTT.Dots.7=Dot 7
+GT5U.MBTT.Dots.8=Dot 8
+GT5U.MBTT.Dots.9=Dot 9
+GT5U.MBTT.Dots.10=Dot 10
+GT5U.MBTT.Dots.11=Dot 11
+GT5U.MBTT.Dots.12=Dot 12
+GT5U.MBTT.Dots.13=Dot 13
+GT5U.MBTT.Dots.14=Dot 14
+GT5U.MBTT.Dots.15=Dot 15
+
+GT5U.cracker.io_side=Input/Output Hatches must be on opposite sides!
GT5U.turbine.running.true=Turbine running
GT5U.turbine.running.false=Turbine stopped
--
cgit
From 77f1cb5502d0efad3b76453b2b577d0105e5fd11 Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Wed, 21 Jul 2021 18:58:04 +0800
Subject: Fix ClassCastException in GT_MetaTileEntity_CubicMultiBlockBase
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../implementations/GT_MetaTileEntity_CubicMultiBlockBase.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
index 5499e756ba..b9a3df5e73 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -66,7 +66,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase getStructureDefinition() {
- return (IStructureDefinition) STRUCTURE_DEFINITION;
+ return (IStructureDefinition) STRUCTURE_DEFINITION.get(getClass());
}
@Override
--
cgit
From b7257bb6f7f19400dfdf00c858b1377b32c4dffe Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Thu, 22 Jul 2021 20:35:16 +0800
Subject: Fix typo in cubic base structure definition
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
---
.../implementations/GT_MetaTileEntity_CubicMultiBlockBase.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
index b9a3df5e73..fa7bb739a9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -35,7 +35,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase>builder()
.addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
{"hhh", "hhh", "hhh"},
- {"h-h", "hhh", "hhh"},
+ {"h~h", "h-h", "hhh"},
{"hhh", "hhh", "hhh"},
}))
.addElement('h', ofChain(
--
cgit
From ea5c515f4769fa83f4eb6268f0b8048f76fbb0ac Mon Sep 17 00:00:00 2001
From: Glease <4586901+Glease@users.noreply.github.com>
Date: Fri, 30 Jul 2021 17:34:20 +0800
Subject: Make GT_MetaTileEntity_CubicMultiBlockBase easier to use
---
.../GT_MetaTileEntity_CubicMultiBlockBase.java | 55 ++++++++++++++++++++--
.../GT_MetaTileEntity_ImplosionCompressor.java | 5 ++
2 files changed, 55 insertions(+), 5 deletions(-)
(limited to 'src/main/java/gregtech/api/metatileentity/implementations')
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
index fa7bb739a9..de36b845b2 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java
@@ -13,19 +13,56 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
/**
- * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere.
+ * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing, accepts hatches everywhere.
+ *
* Controller will be placed in front center of the structure.
*
* Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the casing
* dynamically, i.e. it should be a dumb method returning some sort of constant.
*
* Implementation tips:
- * 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
+ *
+ * - To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
* {@link #getStructureDefinition()} or change {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot
* stop the structure check early.
- * 2. To limit rotation, override {@link #getInitialAlignmentLimits()}
- *
- * @param
+ * Example 1: Require ULV input only:
+ *
+ * {@code
+ * @Override
+ * public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ * if (aTileEntity == null) return false;
+ * IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ * if (aMetaTileEntity == null) return false;
+ * if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ * if (((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier != 0) return false; // addition
+ * ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ * ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ * return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
+ * }
+ * if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ * if (((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier != 0) return false; // addition
+ * ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ * ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ * return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity);
+ * }
+ * return false;
+ * }
+ * }
+ * Example 2: Allow dynamo, muffler and prevent energy hatch
+ *
+ * {@code
+ * @Override
+ * public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ * return addInputToMachineList(aTileEntity, aBaseCasingIndex) ||
+ * addOutputToMachineList(aTileEntity, aBaseCasingIndex) ||
+ * addDynamoToMachineList(aTileEntity, aBaseCasingIndex) ||
+ * addMufflerToMachineList(aTileEntity, aBaseCasingIndex) ||
+ * addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex);
+ * }
+ * }
+ * - To limit rotation, override {@link #getInitialAlignmentLimits()}
+ *
+ * @param this
*/
public abstract class GT_MetaTileEntity_CubicMultiBlockBase> extends GT_MetaTileEntity_EnhancedMultiBlockBase {
protected static final String STRUCTURE_PIECE_MAIN = "main";
@@ -58,6 +95,14 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
index 86792ac81d..b71d01ec07 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
@@ -60,6 +60,11 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Cub
return tt;
}
+ @Override
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex) || addMufflerToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
--
cgit