aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorboubou_19 <miisterunknown@gmail.com>2021-08-16 20:32:53 +0200
committerboubou_19 <miisterunknown@gmail.com>2021-08-16 20:32:53 +0200
commit8f5dd5625e4632bbecda0771caad47bbbbd35d4c (patch)
tree15d544c783cd17606e6d71259eefc062ba4ea8e5 /src/main/java/gregtech/common
parent99030ff940686562c7e4f133919fb1496b0575f4 (diff)
parentc543724aa11d696fa049855e7b330364c1000a17 (diff)
downloadGT5-Unofficial-8f5dd5625e4632bbecda0771caad47bbbbd35d4c.tar.gz
GT5-Unofficial-8f5dd5625e4632bbecda0771caad47bbbbd35d4c.tar.bz2
GT5-Unofficial-8f5dd5625e4632bbecda0771caad47bbbbd35d4c.zip
Merge remote-tracking branch 'upstream/experimental' into experimental
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GT_Client.java629
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java324
-rw-r--r--src/main/java/gregtech/common/GT_ThaumcraftCompat.java4
-rw-r--r--src/main/java/gregtech/common/bees/GT_Bee_Mutation.java7
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings4.java447
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings5.java29
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java14
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Arm.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Crafting.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Drain.java4
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_EnergyOnly.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java4
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java23
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Lens.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Pump.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Screen.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Shutter.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java6
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Vent.java5
-rw-r--r--src/main/java/gregtech/common/entities/GT_Entity_Arrow.java2
-rw-r--r--src/main/java/gregtech/common/gui/GT_Container_Boiler.java12
-rw-r--r--src/main/java/gregtech/common/gui/GT_Container_Regulator.java2
-rw-r--r--src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java4
-rw-r--r--src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java18
-rw-r--r--src/main/java/gregtech/common/items/GT_MetaGenerated_Item_99.java200
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java2
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java4
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java2
-rw-r--r--src/main/java/gregtech/common/misc/GT_Command.java9
-rw-r--r--src/main/java/gregtech/common/render/GT_FlaskRenderer.java23
-rw-r--r--src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java2
-rw-r--r--src/main/java/gregtech/common/render/GT_IconFlipped.java80
-rw-r--r--src/main/java/gregtech/common/render/GT_MetaGenerated_Item_Renderer.java120
-rw-r--r--src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java213
-rw-r--r--src/main/java/gregtech/common/render/GT_RenderedTexture.java392
-rw-r--r--src/main/java/gregtech/common/render/GT_StdRenderedTexture.java36
-rw-r--r--src/main/java/gregtech/common/render/GT_TextureBuilder.java11
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java15
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java13
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java32
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java13
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java144
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java40
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java71
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java274
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java35
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java22
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java218
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java239
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java97
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java194
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java60
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java273
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java175
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java83
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java156
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java145
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java158
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java29
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java55
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java19
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java129
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java312
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java25
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java18
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java103
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java264
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java93
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java36
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java10
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java10
106 files changed, 3191 insertions, 3255 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index d66972e882..55efd20920 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -6,6 +6,11 @@
package gregtech.common;
import codechicken.lib.vec.Rotation;
+import codechicken.lib.vec.Scale;
+import codechicken.lib.vec.Transformation;
+import codechicken.lib.vec.Translation;
+import com.gtnewhorizon.structurelib.alignment.IAlignment;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
@@ -21,15 +26,28 @@ import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.net.GT_Packet_ClientPreference;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.*;
+import gregtech.api.util.GT_ClientPreference;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_PlayedSound;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.WorldSpawnedEventBuilder;
import gregtech.common.entities.GT_Entity_Arrow;
import gregtech.common.entities.GT_Entity_Arrow_Potion;
import gregtech.common.net.MessageUpdateFluidDisplayItem;
-import gregtech.common.render.*;
+import gregtech.common.render.GT_CapeRenderer;
+import gregtech.common.render.GT_FlaskRenderer;
+import gregtech.common.render.GT_FluidDisplayStackRenderer;
+import gregtech.common.render.GT_MetaGenerated_Item_Renderer;
+import gregtech.common.render.GT_MetaGenerated_Tool_Renderer;
+import gregtech.common.render.GT_PollutionRenderer;
+import gregtech.common.render.GT_Renderer_Block;
+import gregtech.common.render.GT_Renderer_Entity_Arrow;
import ic2.api.tile.IWrenchable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.client.renderer.GLAllocation;
+import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -39,12 +57,20 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
-import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import java.net.URL;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+
+import static org.lwjgl.opengl.GL11.GL_LINE_LOOP;
// Referenced classes of package gregtech.common:
// GT_Proxy
@@ -52,98 +78,109 @@ import java.util.*;
public class GT_Client extends GT_Proxy
implements Runnable {
- private static List ROTATABLE_VANILLA_BLOCKS;
+ public static final String GTNH_CAPE_LIST_URL = "https://raw.githubusercontent.com/GTNewHorizons/CustomGTCapeHook-Cape-List/master/capes.txt";
+ public static final String GT_CAPE_LIST_URL = "http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt";
+ private static final List<Block> ROTATABLE_VANILLA_BLOCKS;
+
+ private static final int[][] GRID_SWITCH_TABLE = 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},
+ };
+
+ // don't ask. these "just works"
+ private static final Transformation ROTATION_MARKER_TRANSFORM_CENTER = new Scale(0.5);
+ private static final Transformation[] ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS = {
+ new Scale(0.25).with(new Translation(0, 0, 0.375)).compile(),
+ new Scale(0.25).with(new Translation(0.375, 0, 0)).compile(),
+ new Scale(0.25).with(new Translation(0, 0, -0.375)).compile(),
+ new Scale(0.25).with(new Translation(-0.375, 0, 0)).compile(),
+ };
+ private static final int[] ROTATION_MARKER_TRANSFORMS_SIDES = {
+ -1, -1, 2, 0, 3, 1,
+ -1, -1, 0, 2, 3, 1,
+ 0, 2, -1, -1, 3, 1,
+ 2, 0, -1, -1, 3, 1,
+ 1, 3, 2, 0, -1, -1,
+ 3, 1, 2, 0, -1, -1
+ };
+ private static final Transformation[] ROTATION_MARKER_TRANSFORMS_CORNER = {
+ new Scale(0.25).with(new Translation(0.375, 0, 0.375)).compile(),
+ new Scale(0.25).with(new Translation(-0.375, 0, 0.375)).compile(),
+ new Scale(0.25).with(new Translation(0.375, 0, -0.375)).compile(),
+ new Scale(0.25).with(new Translation(-0.375, 0, -0.375)).compile(),
+ };
+ private static int rotationMarkerDisplayList;
+ private static boolean rotationMarkerDisplayListCompiled = false;
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<String> 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<Materials> mPosR;
+ private final List<Materials> mPosG;
+ private final List<Materials> mPosB;
+ private final List<Materials> mPosA = Collections.emptyList();
+ private final List<Materials> mNegR;
+ private final List<Materials> mNegG;
+ private final List<Materials> mNegB;
+ private final List<Materials> mNegA = Collections.emptyList();
+ private final List<Materials> mMoltenPosR;
+ private final List<Materials> mMoltenPosG;
+ private final List<Materials> mMoltenPosB;
+ private final List<Materials> mMoltenPosA = Collections.emptyList();
+ private final List<Materials> mMoltenNegR;
+ private final List<Materials> mMoltenNegG;
+ private final List<Materials> mMoltenNegB;
+ private final List<Materials> 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;
private int mLastUpdatedBlockY;
private int mLastUpdatedBlockZ;
- private boolean isFirstClientPlayerTick;
- private String mMessage;
private GT_ClientPreference mPreference;
private boolean mFirstTick = false;
+ public static final int ROTATION_MARKER_RESOLUTION = 120;
+
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) {
+
+ private static void drawGrid(DrawBlockHighlightEvent aEvent, boolean showCoverConnections, boolean aIsWrench, boolean aIsSneaking) {
if (!checkedForChicken) {
try {
Class.forName("codechicken.lib.vec.Rotation");
@@ -159,11 +196,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 +213,169 @@ 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 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;
- }
- }
- }
+ if (tConnections > 0) {
+ for (byte i = 0; i < 6; i++) {
+ if ((tConnections & (1 << i)) != 0) {
+ switch (GRID_SWITCH_TABLE[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();
+ // draw turning indicator
+ if (aIsWrench && tTile instanceof IGregTechTileEntity &&
+ ((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof IAlignmentProvider) {
+ IAlignment tAlignment = ((IAlignmentProvider) ((IGregTechTileEntity) tTile).getMetaTileEntity()).getAlignment();
+ if (tAlignment != null) {
+ ForgeDirection direction = tAlignment.getDirection();
+ if (direction.ordinal() == tSideHit)
+ drawExtendedRotationMarker(ROTATION_MARKER_TRANSFORM_CENTER, aIsSneaking, false);
+ else if (direction.getOpposite().ordinal() == tSideHit) {
+ for (Transformation t : ROTATION_MARKER_TRANSFORMS_CORNER) {
+ drawExtendedRotationMarker(t, aIsSneaking, true);
+ }
+ } else {
+ drawExtendedRotationMarker(ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ROTATION_MARKER_TRANSFORMS_SIDES[tSideHit * 6 + direction.ordinal()]], aIsSneaking, true);
+ }
+ }
+ }
+ GL11.glPopMatrix(); // get back to player center
+ }
+
+ private static void drawExtendedRotationMarker(Transformation transform, boolean sneaking, boolean small) {
+ if (sneaking)
+ drawFlipMarker(transform);
+ else
+ drawRotationMarker(transform);
+ }
+
+ private static void drawRotationMarker(Transformation transform) {
+ if (!rotationMarkerDisplayListCompiled) {
+ rotationMarkerDisplayList = GLAllocation.generateDisplayLists(1);
+ compileRotationMarkerDisplayList(rotationMarkerDisplayList);
+ rotationMarkerDisplayListCompiled = true;
+ }
+ GL11.glPushMatrix();
+ transform.glApply();
+ GL11.glCallList(rotationMarkerDisplayList);
GL11.glPopMatrix();
}
- private static void drawGrid(DrawBlockHighlightEvent aEvent) {
- drawGrid(aEvent, false);
+ private static void compileRotationMarkerDisplayList(int displayList) {
+ GL11.glNewList(displayList, GL11.GL_COMPILE);
+ GL11.glBegin(GL_LINE_LOOP);
+ for (int i = 0; i <= ROTATION_MARKER_RESOLUTION; i++) {
+ GL11.glVertex3d(Math.cos(i * Math.PI * 1.75 / ROTATION_MARKER_RESOLUTION) * 0.4, 0, Math.sin(i * Math.PI * 1.75 / ROTATION_MARKER_RESOLUTION) * 0.4);
+ }
+ for (int i = ROTATION_MARKER_RESOLUTION; i >=0; i--) {
+ GL11.glVertex3d(Math.cos(i * Math.PI * 1.75 / ROTATION_MARKER_RESOLUTION) * 0.24, 0, Math.sin(i * Math.PI * 1.75 / ROTATION_MARKER_RESOLUTION) * 0.24);
+ }
+ GL11.glVertex3d(0.141114561800, 0, 0);
+ GL11.glVertex3d(0.32, 0, -0.178885438199);
+ GL11.glVertex3d(0.498885438199, 0, 0);
+ GL11.glEnd();
+ GL11.glEndList();
+ }
+
+ private static void drawFlipMarker(Transformation transform) {
+ GL11.glPushMatrix();
+ transform.glApply();
+ Tessellator t = Tessellator.instance;
+ // right shape
+ GL11.glLineStipple(4, (short) 0xAAAA);
+ GL11.glEnable(GL11.GL_LINE_STIPPLE);
+ t.startDrawing(GL11.GL_LINE_STRIP);
+ t.addVertex(0.1d, 0d, 0.04d);
+ t.addVertex(0.1d, 0d, 0.2d);
+ t.addVertex(0.35d, 0d, 0.35d);
+ t.addVertex(0.35d, 0d, -0.35d);
+ t.addVertex(0.1d, 0d, -0.2d);
+ t.addVertex(0.1d, 0d, -0.04d);
+ t.draw();
+ GL11.glDisable(GL11.GL_LINE_STIPPLE);
+ // left shape
+ t.startDrawing(GL11.GL_LINE_STRIP);
+ t.addVertex(-0.1d, 0d, 0.04d);
+ t.addVertex(-0.1d, 0d, 0.2d);
+ t.addVertex(-0.35d, 0d, 0.35d);
+ t.addVertex(-0.35d, 0d, -0.35d);
+ t.addVertex(-0.1d, 0d, -0.2d);
+ t.addVertex(-0.1d, 0d, -0.04d);
+ t.draw();
+ // arrow
+ t.startDrawing(GL11.GL_LINE_LOOP);
+ t.addVertex(0.15d, 0d, -0.04d);
+ t.addVertex(0.15d, 0d, -0.1d);
+ t.addVertex(0.25d, 0d, 0.d);
+ t.addVertex(0.15d, 0d, 0.1d);
+ t.addVertex(0.15d, 0d, 0.04d);
+ t.addVertex(-0.15d, 0d, 0.04d);
+ t.addVertex(-0.15d, 0d, 0.1d);
+ t.addVertex(-0.25d, 0d, 0.d);
+ t.addVertex(-0.15d, 0d, -0.1d);
+ t.addVertex(-0.15d, 0d, -0.04d);
+ t.draw();
+ GL11.glPopMatrix();
}
@Override
@@ -286,7 +406,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 +421,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();
@@ -340,7 +458,9 @@ public class GT_Client extends GT_Proxy
}
i++;
} while (true);
- } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
// super.onPostLoad();
@@ -356,47 +476,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 +520,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<GT_PlayedSound> tList = new ArrayList();
- for (Map.Entry<GT_PlayedSound, Integer> tEntry : GT_Utility.sPlayedSoundMap.entrySet()) {
- if (tEntry.getValue().intValue() < 0) {//Integer -> Integer -> int? >_<, fix
- tList.add(tEntry.getKey());
+ for (Iterator<Map.Entry<GT_PlayedSound, Integer>> iterator = GT_Utility.sPlayedSoundMap.entrySet().iterator(); iterator.hasNext(); ) {
+ Map.Entry<GT_PlayedSound, Integer> 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;
@@ -469,7 +568,7 @@ public class GT_Client extends GT_Proxy
if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList))
{
if (aTileEntity instanceof ITurnable || ROTATABLE_VANILLA_BLOCKS.contains(aBlock) || aTileEntity instanceof IWrenchable)
- drawGrid(aEvent, false);
+ drawGrid(aEvent, false, true, aEvent.player.isSneaking());
return;
}
@@ -477,30 +576,27 @@ public class GT_Client extends GT_Proxy
return;
if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList) ||
- GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList) )
- {
+ GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList)) {
if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0)
- drawGrid(aEvent, false);
+ drawGrid(aEvent, false, false, aEvent.player.isSneaking());
return;
}
if ((aEvent.currentItem == null && aEvent.player.isSneaking()) ||
- GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList) ||
- GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList))
- {
+ GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList) ||
+ GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)) {
if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0)
for (byte i = 0; i < 6; i++)
if (((ICoverable) aTileEntity).getCoverIDAtSide(i) > 0) {
- drawGrid(aEvent, true);
+ drawGrid(aEvent, true, false, true);
return;
}
return;
}
- if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet()))
- {
+ 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());
}
}
@@ -508,102 +604,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 +699,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++;
@@ -685,13 +764,12 @@ public class GT_Client extends GT_Proxy
tString = (new StringBuilder()).append(tString).append("wherearewenow").toString();
break;
}
- if (tString.startsWith("streaming.")){
+ if (tString.startsWith("streaming.")) {
new WorldSpawnedEventBuilder.RecordEffectEventBuilder()
.setIdentifier(tString.substring(10))
.setPosition(aX, aY, aZ)
.run();
- }
- else{
+ } else {
new WorldSpawnedEventBuilder.SoundEventBuilder()
.setVolume(3f)
.setPitch(tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F)
@@ -701,13 +779,14 @@ public class GT_Client extends GT_Proxy
}
}
- public static int hideValue=0;
+ public static int hideValue = 0;
- /** <p>Client tick counter that is set to 5 on hiding pipes and covers.</p>
+ /**
+ * <p>Client tick counter that is set to 5 on hiding pipes and covers.</p>
* <p>It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
* spreading client change detection related work and network traffic on different ticks, until it reaches 0.</p>
*/
- public static int changeDetected=0;
+ public static int changeDetected = 0;
private static int shouldHeldItemHideThings() {
try {
@@ -724,17 +803,17 @@ public class GT_Client extends GT_Proxy
}
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)
- || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)
- || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)
- || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)
- || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)
- || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)
- || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)
- || GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) {
- hide |= 0x2;
+ || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)
+ || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)
+ || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)
+ || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)
+ || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)
+ || GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)
+ || GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) {
+ hide |= 0x2;
}
return hide;
- }catch(Exception e){
+ } catch (Exception e) {
return 0;
}
}
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 636d78be51..76a7b01e85 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -1,10 +1,6 @@
package gregtech.common;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.IFuelHandler;
-import cpw.mods.fml.common.Loader;
-import cpw.mods.fml.common.ModContainer;
-import cpw.mods.fml.common.ProgressManager;
+import cpw.mods.fml.common.*;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
@@ -15,16 +11,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.genetics.AlleleManager;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.ConfigCategories;
-import gregtech.api.enums.Dyes;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OreDictNames;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.SubTag;
+import gregtech.api.enums.*;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
-import gregtech.api.enums.ToolDictNames;
import gregtech.api.interfaces.IBlockOnWalkOver;
import gregtech.api.interfaces.IProjectileItem;
import gregtech.api.interfaces.internal.IGT_Mod;
@@ -60,6 +48,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
@@ -70,10 +59,7 @@ import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
-import net.minecraftforge.event.entity.player.ArrowLooseEvent;
-import net.minecraftforge.event.entity.player.ArrowNockEvent;
-import net.minecraftforge.event.entity.player.PlayerEvent;
-import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.OreGenEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.ChunkDataEvent;
@@ -90,23 +76,13 @@ import org.apache.commons.lang3.text.WordUtils;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.stream.Collectors;
import java.util.concurrent.locks.ReentrantLock;
+import java.util.stream.Collectors;
+import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.GT_Values.debugEntityCramming;
@@ -253,6 +229,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<String, Integer> oreDictBurnTimes = new HashMap<>();
@@ -477,39 +458,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
OrePrefixes.cellMolten.mContainerItem = ItemList.Cell_Empty.get(1L);
OrePrefixes.cell.mContainerItem = ItemList.Cell_Empty.get(1L);
- GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767));
- GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767));
- GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767));
- GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767));
-
- GregTech_API.sHeatHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767));
- GregTech_API.sHeatHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767));
- GregTech_API.sHeatHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767));
- GregTech_API.sHeatHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767));
-
- GregTech_API.sBioHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767));
- GregTech_API.sBioHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767));
- GregTech_API.sBioHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767));
- GregTech_API.sBioHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767));
-
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767));
-
- GregTech_API.sRadioHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767));
- GregTech_API.sRadioHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767));
- GregTech_API.sRadioHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767));
- GregTech_API.sRadioHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767));
-
- GregTech_API.sElectroHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767));
- GregTech_API.sElectroHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767));
- GregTech_API.sElectroHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767));
- GregTech_API.sElectroHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767));
- GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_helmet, 1, 32767));
- GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_chestplate, 1, 32767));
- GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_leggings, 1, 32767));
- GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_boots, 1, 32767));
+
GT_ModHandler.sNonReplaceableItems.add(new ItemStack(Items.bow, 1, 32767));
GT_ModHandler.sNonReplaceableItems.add(new ItemStack(Items.fishing_rod, 1, 32767));
@@ -586,10 +535,100 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
GT_OreDictUnificator.registerOre("cropGrape", GT_ModHandler.getModItem("magicalcrops", "magicalcrops_CropProduce", 1L, 4));
GT_OreDictUnificator.registerOre("cropTea", GT_ModHandler.getModItem("ganyssurface", "teaLeaves", 1L, 0));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getModItem("EMT", "NanoBootsTraveller", 1L, 32767));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getModItem("EMT", "NanosuitGogglesRevealing", 1L, 32767));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getModItem("EMT", "QuantumBootsTraveller", 1L, 32767));
- GregTech_API.sGasHazmatList.add(GT_ModHandler.getModItem("EMT", "QuantumGogglesRevealing", 1L, 32767));
+ // Clay buckets, which don't get registered until Iguana Tweaks pre-init
+ if (Loader.isModLoaded("IguanaTweaksTConstruct")) {
+ OrePrefixes.bucketClay.mContainerItem = GT_ModHandler.getModItem("IguanaTweaksTConstruct", "clayBucketFired", 1L, 0);
+ GT_OreDictUnificator.set(OrePrefixes.bucketClay, Materials.Empty, GT_ModHandler.getModItem("IguanaTweaksTConstruct", "clayBucketFired", 1L, 0));
+ GT_OreDictUnificator.set(OrePrefixes.bucketClay, Materials.Water, GT_ModHandler.getModItem("IguanaTweaksTConstruct", "clayBucketWater", 1L, 0));
+ GT_OreDictUnificator.set(OrePrefixes.bucketClay, Materials.Lava, GT_ModHandler.getModItem("IguanaTweaksTConstruct", "clayBucketLava", 1L, 0));
+ GT_OreDictUnificator.set(OrePrefixes.bucketClay, Materials.Milk, GT_ModHandler.getModItem("IguanaTweaksTConstruct", "clayBucketMilk", 1L, 0));
+
+ FluidContainerRegistry.registerFluidContainer(
+ new FluidContainerRegistry.FluidContainerData(
+ Materials.Milk.getFluid(1000L),
+ GT_OreDictUnificator.get(OrePrefixes.bucketClay, Materials.Milk, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.bucketClay, Materials.Empty, 1L)));
+ }
+
+ // IC2 Hazmat
+ addFullHazmatToIC2Item("hazmatHelmet");
+ addFullHazmatToIC2Item("hazmatChestplate");
+ addFullHazmatToIC2Item("hazmatLeggings");
+ addFullHazmatToIC2Item("hazmatBoots");
+ addFullHazmatToIC2Item("nanoHelmet");
+ addFullHazmatToIC2Item("nanoBoots");
+ addFullHazmatToIC2Item("nanoLeggings");
+ addFullHazmatToIC2Item("nanoBodyarmor");
+ addFullHazmatToIC2Item("quantumHelmet");
+ addFullHazmatToIC2Item("quantumBodyarmor");
+ addFullHazmatToIC2Item("quantumLeggings");
+ addFullHazmatToIC2Item("quantumBoots");
+
+ //GraviSuite Hazmat
+ addFullHazmatToGeneralItem("GraviSuite", "graviChestPlate", 1L);
+ addFullHazmatToGeneralItem("GraviSuite", "advNanoChestPlate", 1L);
+
+ // EMT Hazmat
+ addFullHazmatToGeneralItem("EMT", "itemArmorQuantumChestplate", 1L);
+ addFullHazmatToGeneralItem("EMT", "NanoBootsTraveller", 1L);
+ addFullHazmatToGeneralItem("EMT", "NanosuitGogglesRevealing", 1L);
+ addFullHazmatToGeneralItem("EMT", "QuantumBootsTraveller", 1L);
+ addFullHazmatToGeneralItem("EMT", "QuantumGogglesRevealing", 1L);
+ addFullHazmatToGeneralItem("EMT", "SolarHelmetRevealing", 1L);
+ addFullHazmatToGeneralItem("EMT", "NanosuitWing", 1L);
+ addFullHazmatToGeneralItem("EMT", "QuantumWing", 1L);
+
+ // DraconicEvolution Hazmat
+ addFullHazmatToGeneralItem("DraconicEvolution", "draconicBoots", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "draconicHelm", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "draconicLeggs", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "draconicChest", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "wyvernBoots", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "wyvernHelm", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "wyvernLeggs", 1L, 0);
+ addFullHazmatToGeneralItem("DraconicEvolution", "wyvernChest", 1L, 0);
+
+ //AdvancedSolarPanel
+ addFullHazmatToGeneralItem("AdvancedSolarPanel", "advanced_solar_helmet", 1L);
+ addFullHazmatToGeneralItem("AdvancedSolarPanel", "hybrid_solar_helmet", 1L);
+ addFullHazmatToGeneralItem("AdvancedSolarPanel", "ultimate_solar_helmet", 1L);
+
+ //TaintedMagic Hazmat
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemVoidwalkerBoots", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemShadowFortressHelmet", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemShadowFortressChestplate", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemShadowFortressLeggings", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemVoidFortressHelmet", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemVoidFortressChestplate", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemVoidFortressLeggings", 1L);
+ addFullHazmatToGeneralItem("TaintedMagic", "ItemVoidmetalGoggles", 1L);
+
+ //WitchingGadgets Hazmat
+ addFullHazmatToGeneralItem("WitchingGadgets", "item.WG_PrimordialHelm", 1L);
+ addFullHazmatToGeneralItem("WitchingGadgets", "item.WG_PrimordialChest", 1L);
+ addFullHazmatToGeneralItem("WitchingGadgets", "item.WG_PrimordialLegs", 1L);
+ addFullHazmatToGeneralItem("WitchingGadgets", "item.WG_PrimordialBoots", 1L);
+
+ //ThaumicTinkerer Hazmat
+ addFullHazmatToGeneralItem("ThaumicTinkerer", "ichorclothChestGem", 1L);
+ addFullHazmatToGeneralItem("ThaumicTinkerer", "ichorclothBootsGem", 1L);
+ addFullHazmatToGeneralItem("ThaumicTinkerer", "ichorclothHelmGem", 1L);
+ addFullHazmatToGeneralItem("ThaumicTinkerer", "ichorclothLegsGem", 1L);
+
+ //GalaxySpace Hazmat
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_helmet", 1L);
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_helmetglasses", 1L);
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_plate", 1L);
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_jetplate", 1L);
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_leg", 1L);
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_boots", 1L);
+ addFullHazmatToGeneralItem("GalaxySpace", "item.spacesuit_gravityboots", 1L);
+
+ //Extra Hazmat
+ GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_helmet, 1, W));
+ GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_chestplate, 1, W));
+ GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_leggings, 1, W));
+ GregTech_API.sElectroHazmatList.add(new ItemStack(Items.chainmail_boots, 1, W));
GregTech_API.sLoadStarted = true;
for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
@@ -1458,7 +1497,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
float tHeat = GT_Utility.getHeatDamageFromItem(tStack);
if (tHeat != 0.0F) {
if (tHeat > 0.0F) {
- GT_Utility.applyHeatDamage(aEvent.player, tHeat);
+ GT_Utility.applyHeatDamageFromItem(aEvent.player, tHeat, tStack);
} else {
GT_Utility.applyFrostDamage(aEvent.player, -tHeat);
}
@@ -1578,7 +1617,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
float tHeat = GT_Utility.getHeatDamageFromItem(tStack);
if (tHeat != 0.0F) {
if (tHeat > 0.0F) {
- GT_Utility.applyHeatDamage(aEvent.player, tHeat);
+ GT_Utility.applyHeatDamageFromItem(aEvent.player, tHeat, tStack);
} else {
GT_Utility.applyFrostDamage(aEvent.player, -tHeat);
}
@@ -1712,61 +1751,66 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cellMolten, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 144);
}
- public Fluid addAutogeneratedWetFluid(Materials aMaterial) {
- return addFluid("wet." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "wet.autogenerated", "Wet " + aMaterial.mDefaultLocalName, aMaterial,
- aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 144);
- }
-
public Fluid addAutogeneratedPlasmaFluid(Materials aMaterial) {
return addFluid("plasma." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "plasma.autogenerated", aMaterial.mDefaultLocalName + " Plasma", aMaterial,
aMaterial.mMoltenRGBa, 3, 10000, GT_OreDictUnificator.get(OrePrefixes.cellPlasma, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000);
}
public void addAutoGeneratedHydroCrackedFluids(Materials aMaterial){
- Fluid[] crackedFluids = new Fluid[3];
- String[] prefixes = {"lightlyhydrocracked.", "moderatelyhydrocracked.", "severelyhydrocracked."};
- String[] localPrefixes = {"Lightly Hydro-Cracked ", "Moderately Hydro-Cracked ", "Severely Hydro-Cracked "};
- GT_Fluid uncrackedFluid = null;
- if (aMaterial.mFluid != null) {
- uncrackedFluid = (GT_Fluid) aMaterial.mFluid;
- } else if (aMaterial.mGas != null) {
- uncrackedFluid = (GT_Fluid) aMaterial.mGas;
- }
- for (int i = 0; i < 3; i++) {
- crackedFluids[i] = addFluid(prefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
- localPrefixes[i] + aMaterial.mDefaultLocalName, null, aMaterial.mRGBa, 2, 775, null, null, 0);
- int hydrogenAmount = 2 * i + 2;
- GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), Materials.Hydrogen.getGas(hydrogenAmount * 1000),
- new FluidStack(crackedFluids[i], 1000), 40 + 20 * i, 120 + 60 * i);
- GT_Values.RA.addChemicalRecipe(Materials.Hydrogen.getCells(hydrogenAmount), GT_Utility.getIntegratedCircuit(i + 1), new FluidStack(uncrackedFluid, 1000),
- new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(hydrogenAmount), 160 + 80 * i, 30);
- GT_Values.RA.addChemicalRecipe(aMaterial.getCells(1), GT_Utility.getIntegratedCircuit(i + 1), Materials.Hydrogen.getGas(hydrogenAmount * 1000),
- new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
- }
- aMaterial.setHydroCrackedFluids(crackedFluids);
+ Fluid[] crackedFluids = new Fluid[3];
+ String[] namePrefixes = { "lightlyhydrocracked.", "moderatelyhydrocracked.", "severelyhydrocracked." };
+ OrePrefixes[] orePrefixes = { OrePrefixes.cellHydroCracked1, OrePrefixes.cellHydroCracked2, OrePrefixes.cellHydroCracked3 };
+ GT_Fluid uncrackedFluid = null;
+ if (aMaterial.mFluid != null) {
+ uncrackedFluid = (GT_Fluid) aMaterial.mFluid;
+ } else if (aMaterial.mGas != null) {
+ uncrackedFluid = (GT_Fluid) aMaterial.mGas;
+ }
+ for (int i = 0; i < 3; i++) {
+ crackedFluids[i] = addFluid(
+ namePrefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
+ orePrefixes[i].mLocalizedMaterialPre + aMaterial.mDefaultLocalName,
+ null, aMaterial.mRGBa, 2, 775,
+ GT_OreDictUnificator.get(orePrefixes[i], aMaterial, 1L),
+ ItemList.Cell_Empty.get(1L), 1000);
+
+ int hydrogenAmount = 2 * i + 2;
+ GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), Materials.Hydrogen.getGas(hydrogenAmount * 1000),
+ new FluidStack(crackedFluids[i], 1000), 40 + 20 * i, 120 + 60 * i);
+ GT_Values.RA.addChemicalRecipe(Materials.Hydrogen.getCells(hydrogenAmount), GT_Utility.getIntegratedCircuit(i + 1), new FluidStack(uncrackedFluid, 1000),
+ new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(hydrogenAmount), 160 + 80 * i, 30);
+ GT_Values.RA.addChemicalRecipe(aMaterial.getCells(1), GT_Utility.getIntegratedCircuit(i + 1), Materials.Hydrogen.getGas(hydrogenAmount * 1000),
+ new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
+ }
+ aMaterial.setHydroCrackedFluids(crackedFluids);
}
public void addAutoGeneratedSteamCrackedFluids(Materials aMaterial){
- Fluid[] crackedFluids = new Fluid[3];
- String[] prefixes = {"lightlysteamcracked.", "moderatelysteamcracked.", "severelysteamcracked."};
- String[] localPrefixes = {"Lightly Steam-Cracked ", "Moderately Steam-Cracked ", "Severely Steam-Cracked "};
- GT_Fluid uncrackedFluid = null;
- if (aMaterial.mFluid != null) {
- uncrackedFluid = (GT_Fluid) aMaterial.mFluid;
- } else if (aMaterial.mGas != null) {
- uncrackedFluid = (GT_Fluid) aMaterial.mGas;
- }
- for (int i = 0; i < 3; i++) {
- crackedFluids[i] = addFluid(prefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
- localPrefixes[i] + aMaterial.mDefaultLocalName, null, aMaterial.mRGBa, 2, 775, null, null, 0);
- GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), GT_ModHandler.getSteam(1000),
- new FluidStack(crackedFluids[i], 1000), 40 + 20 * i, 240 + 120 * i);
- GT_Values.RA.addChemicalRecipe(GT_ModHandler.getIC2Item("steamCell", 1L), GT_Utility.getIntegratedCircuit(i + 1), new FluidStack(uncrackedFluid, 1000),
- new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
- GT_Values.RA.addChemicalRecipe(aMaterial.getCells(1), GT_Utility.getIntegratedCircuit(i + 1), GT_ModHandler.getSteam(1000),
- new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
- }
- aMaterial.setSteamCrackedFluids(crackedFluids);
+ Fluid[] crackedFluids = new Fluid[3];
+ String[] namePrefixes = { "lightlysteamcracked.", "moderatelysteamcracked.", "severelysteamcracked." };
+ OrePrefixes[] orePrefixes = { OrePrefixes.cellSteamCracked1, OrePrefixes.cellSteamCracked2, OrePrefixes.cellSteamCracked3 };
+ GT_Fluid uncrackedFluid = null;
+ if (aMaterial.mFluid != null) {
+ uncrackedFluid = (GT_Fluid) aMaterial.mFluid;
+ } else if (aMaterial.mGas != null) {
+ uncrackedFluid = (GT_Fluid) aMaterial.mGas;
+ }
+ for (int i = 0; i < 3; i++) {
+ crackedFluids[i] = addFluid(
+ namePrefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
+ orePrefixes[i].mLocalizedMaterialPre + aMaterial.mDefaultLocalName,
+ null, aMaterial.mRGBa, 2, 775,
+ GT_OreDictUnificator.get(orePrefixes[i], aMaterial, 1L),
+ ItemList.Cell_Empty.get(1L), 1000);
+
+ GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), GT_ModHandler.getSteam(1000),
+ new FluidStack(crackedFluids[i], 1000), 40 + 20 * i, 240 + 120 * i);
+ GT_Values.RA.addChemicalRecipe(GT_ModHandler.getIC2Item("steamCell", 1L), GT_Utility.getIntegratedCircuit(i + 1), new FluidStack(uncrackedFluid, 1000),
+ new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
+ GT_Values.RA.addChemicalRecipe(aMaterial.getCells(1), GT_Utility.getIntegratedCircuit(i + 1), GT_ModHandler.getSteam(1000),
+ new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
+ }
+ aMaterial.setSteamCrackedFluids(crackedFluids);
}
public Fluid addFluid(String aName, String aLocalized, Materials aMaterial, int aState, int aTemperatureK) {
@@ -2043,4 +2087,52 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
if (event.block.getUnlocalizedName().equals("blockAlloyGlass"))
GregTech_API.causeMachineUpdate(event.world, event.x, event.y, event.z);
}
+
+ public static void addFullHazmatToGeneralItem(String aModID, String aItem, long aAmount, int aMeta){
+ ItemStack item = GT_ModHandler.getModItem(aModID, aItem, aAmount, aMeta);
+ addItemToHazmatLists(item);
+ }
+
+ public static void addFullHazmatToGeneralItem(String aModID, String aItem, long aAmount){
+ ItemStack item = GT_ModHandler.getModItem(aModID, aItem, aAmount, W);
+ addItemToHazmatLists(item);
+ }
+
+ public static void addFullHazmatToIC2Item(String aItem){
+ ItemStack item = GT_ModHandler.getIC2Item(aItem, 1L, W);
+ addItemToHazmatLists(item);
+ }
+
+ private static void addItemToHazmatLists(ItemStack item){
+ GregTech_API.sGasHazmatList.add(item);
+ GregTech_API.sBioHazmatList.add(item);
+ GregTech_API.sFrostHazmatList.add(item);
+ GregTech_API.sHeatHazmatList.add(item);
+ GregTech_API.sRadioHazmatList.add(item);
+ GregTech_API.sElectroHazmatList.add(item);
+ }
+
+ public static boolean providesProtection(ItemStack aStack){
+ boolean isGas = GT_Utility.isStackInList(aStack, GregTech_API.sGasHazmatList);
+ boolean isBio = GT_Utility.isStackInList(aStack, GregTech_API.sBioHazmatList);
+ boolean isFrost = GT_Utility.isStackInList(aStack, GregTech_API.sFrostHazmatList);
+ boolean isHeat = GT_Utility.isStackInList(aStack, GregTech_API.sHeatHazmatList);
+ boolean isRadio = GT_Utility.isStackInList(aStack, GregTech_API.sRadioHazmatList);
+ boolean isElectro = GT_Utility.isStackInList(aStack, GregTech_API.sElectroHazmatList);
+ return isGas && isBio && isFrost && isHeat && isRadio && isElectro;
+ }
+
+ @SubscribeEvent
+ public void onItemTooltip(ItemTooltipEvent event) {
+ if (event.itemStack == null) {
+ return;
+ }
+ else {
+ ItemStack aStackTemp = event.itemStack;
+ GT_ItemStack aStack = new GT_ItemStack(aStackTemp);
+ if (providesProtection(aStackTemp)) {
+ event.toolTip.add(EnumChatFormatting.LIGHT_PURPLE + "Provides full hazmat protection.");
+ }
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/GT_ThaumcraftCompat.java b/src/main/java/gregtech/common/GT_ThaumcraftCompat.java
index bc6372e41c..e4472824e7 100644
--- a/src/main/java/gregtech/common/GT_ThaumcraftCompat.java
+++ b/src/main/java/gregtech/common/GT_ThaumcraftCompat.java
@@ -182,7 +182,7 @@ public class GT_ThaumcraftCompat implements IThaumcraftCompat {
if ((GT_Utility.isStringInvalid(aResearch)) || (aInput == null) || (aOutput == null) || (aAspects == null) || (aAspects.isEmpty())) {
return null;
}
- return ThaumcraftApi.addCrucibleRecipe(aResearch, GT_Utility.copy(new Object[]{aOutput}), ((aInput instanceof ItemStack)) || ((aInput instanceof ArrayList)) ? aInput : aInput.toString(), getAspectList(aAspects));
+ return ThaumcraftApi.addCrucibleRecipe(aResearch, GT_Utility.copyOrNull(aOutput), ((aInput instanceof ItemStack)) || ((aInput instanceof ArrayList)) ? aInput : aInput.toString(), getAspectList(aAspects));
}
@Override
@@ -190,7 +190,7 @@ public class GT_ThaumcraftCompat implements IThaumcraftCompat {
if ((GT_Utility.isStringInvalid(aResearch)) || (aMainInput == null) || (aSideInputs == null) || (aOutput == null) || (aAspects == null) || (aAspects.isEmpty())) {
return null;
}
- return ThaumcraftApi.addInfusionCraftingRecipe(aResearch, GT_Utility.copy(new Object[]{aOutput}), aInstability, getAspectList(aAspects), aMainInput, aSideInputs);
+ return ThaumcraftApi.addInfusionCraftingRecipe(aResearch, GT_Utility.copyOrNull(aOutput), aInstability, getAspectList(aAspects), aMainInput, aSideInputs);
}
@Override
diff --git a/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java b/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java
index b088f724f5..a4a162ddae 100644
--- a/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java
+++ b/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java
@@ -1,6 +1,7 @@
package gregtech.common.bees;
import forestry.api.apiculture.*;
+import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
@@ -37,7 +38,7 @@ public class GT_Bee_Mutation extends BeeMutation {
int y = housingCoordinates != null ? housingCoordinates.posY : 0;
int z = housingCoordinates != null ? housingCoordinates.posZ : 0;
- float processedChance = getBasicChance(world, x, y, z, allele0, allele1, genome0, genome1);
+ float processedChance = getBasicChance(world, x, y, z, allele0, allele1, genome0, genome1, housing);
if (processedChance <= 0f) {
return 0f;
@@ -53,7 +54,7 @@ public class GT_Bee_Mutation extends BeeMutation {
}
@SuppressWarnings("unchecked")
- private float getBasicChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
+ private float getBasicChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
float mutationChance = this.getBaseChance();
List<IMutationCondition> mutationConditions = null;
Field f = FieldUtils.getDeclaredField(Mutation.class, "mutationConditions", true);
@@ -69,7 +70,7 @@ public class GT_Bee_Mutation extends BeeMutation {
if (mutationConditions != null)
for (IMutationCondition mutationCondition : mutationConditions) {
- mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
+ mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
if (mutationChance == 0) {
return 0;
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java
index 6fb40784c1..d217064d30 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java
@@ -4,7 +4,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_LanguageManager;
@@ -15,12 +14,27 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
+ /**
+ * This mapping is used to look up which texture should be used to render the connected texture for fusion casings.
+ *
+ * This mapping is computed from that giant if ladder from #getIcon in commit da3421547afadc49938b5b6a7f9a9679afa1d570
+ * The exact meaning of these numbers are like black magic. Read the original getIcon implementation to understand why
+ * it is 0, 1, etc, if that if ladder is even intelligible.
+ */
+ private static final int[][] mapping = new int[][]{
+ {7, 7, 7, 7, 0, 7, 0, 7, 1, 7, 1, 7, 8, 7, 8, 7, 0, 7, 0, 7, 0, 7, 0, 7, 9, 7, 9, 7, 3, 7, 3, 7, 1, 7, 1, 7, 11, 7, 11, 7, 1, 7, 1, 7, 2, 7, 2, 7, 10, 7, 10, 7, 5, 7, 5, 7, 4, 7, 4, 7, 6, 7, 6, 7},
+ {7, 7, 7, 7, 0, 0, 7, 7, 1, 1, 7, 7, 8, 8, 7, 7, 0, 0, 7, 7, 0, 0, 7, 7, 9, 9, 7, 7, 3, 3, 7, 7, 1, 1, 7, 7, 11, 11, 7, 7, 1, 1, 7, 7, 2, 2, 7, 7, 10, 10, 7, 7, 5, 5, 7, 7, 4, 4, 7, 7, 6, 6, 7, 7},
+ {7, 1, 1, 1, 0, 9, 10, 4, 7, 1, 1, 1, 0, 9, 10, 4, 0, 8, 11, 2, 0, 3, 5, 6, 0, 8, 11, 2, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7},
+ {7, 1, 1, 1, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7},
+ {7, 1, 1, 1, 7, 1, 1, 1, 0, 8, 11, 2, 0, 8, 11, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 9, 10, 4, 0, 9, 10, 4, 0, 3, 5, 6, 0, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7},
+ {7, 1, 1, 1, 7, 7, 7, 7, 0, 9, 10, 4, 7, 7, 7, 7, 7, 1, 1, 1, 7, 7, 7, 7, 0, 9, 10, 4, 7, 7, 7, 7, 0, 8, 11, 2, 7, 7, 7, 7, 0, 3, 5, 6, 7, 7, 7, 7, 0, 8, 11, 2, 7, 7, 7, 7, 0, 3, 5, 6, 7, 7, 7, 7},
+ };
public static boolean mConnectedMachineTextures = true;
public GT_Block_Casings4() {
super(GT_Item_Casings4.class, "gt.blockcasings4", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- Textures.BlockIcons.casingTexturePages[0][(i + 48)] = TextureFactory.of(this, i);
+ Textures.BlockIcons.casingTexturePages[0][i + 48] = TextureFactory.of(this, i);
}
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Robust Tungstensteel Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Clean Stainless Steel Machine Casing");
@@ -59,18 +73,21 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
public IIcon getIcon(int aSide, int aMeta) {
switch (aMeta) {
case 0:
+ case 12:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
case 1:
+ case 10:
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
case 2:
+ case 11:
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
case 3:
return aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
case 4:
- //Do not overwrite!
+ //Do not overwrite!
return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW.getIcon();
case 5:
- //Do not overwrite!
+ //Do not overwrite!
return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS.getIcon();
case 6:
return Textures.BlockIcons.MACHINE_CASING_FUSION.getIcon();
@@ -80,12 +97,6 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon();
case 9:
return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon();
- case 10:
- return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
- case 11:
- return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
- case 12:
- return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
case 13:
return Textures.BlockIcons.MACHINE_CASING_ENGINE_INTAKE.getIcon();
case 14:
@@ -98,8 +109,6 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
public IIcon getTurbineCasing(int meta, int iconIndex, boolean active) {
switch (meta) {
- case 9:
- return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon();
case 10:
return active ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() : Textures.BlockIcons.TURBINE1[iconIndex].getIcon();
case 11:
@@ -111,121 +120,63 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
}
}
+ private static int isTurbineControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (!(tTileEntity instanceof IGregTechTileEntity)) return 0;
+ IGregTechTileEntity tTile = (IGregTechTileEntity) tTileEntity;
+ if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine && tTile.getFrontFacing() == aSide)
+ return tTile.isActive() ? 1 : 2;
+ return 0;
+ }
+
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) {
int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
- if ((tMeta != 6) && (tMeta != 8) && (tMeta != 9) && (tMeta != 10) && (tMeta != 11) && (tMeta != 12) || (!mConnectedMachineTextures)) {
+ if (tMeta != 6 && tMeta != 8 && tMeta != 9 && tMeta != 10 && tMeta != 11 && tMeta != 12 || !mConnectedMachineTextures) {
return getIcon(aSide, tMeta);
}
- int tStartIndex = tMeta == 6 ? 1 : 13;
- if ((tMeta == 9) || (tMeta == 10) || (tMeta == 11) || (tMeta == 12)) {
- if ((aSide == 2) || (aSide == 3)) {
- TileEntity tTileEntity;
- IMetaTileEntity tMetaTileEntity;
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 0, true);
- }
- return getTurbineCasing(tMeta, 0, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 3, true);
- }
- return getTurbineCasing(tMeta, 3, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 6, true);
- }
- return getTurbineCasing(tMeta, 6, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 1, true);
- }
- return getTurbineCasing(tMeta, 1, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 7, true);
- }
- return getTurbineCasing(tMeta, 7, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 8, true);
- }
- return getTurbineCasing(tMeta, 8, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 5, true);
- }
- return getTurbineCasing(tMeta, 5, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 2, true);
- }
- return getTurbineCasing(tMeta, 2, false);
- }
- } else if ((aSide == 4) || (aSide == 5)) {
- TileEntity tTileEntity;
- Object tMetaTileEntity;
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 0, true);
- }
- return getTurbineCasing(tMeta, 0, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 3, true);
- }
- return getTurbineCasing(tMeta, 3, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 6, true);
- }
- return getTurbineCasing(tMeta, 6, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 1, true);
- }
- return getTurbineCasing(tMeta, 1, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 7, true);
- }
- return getTurbineCasing(tMeta, 7, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 8, true);
- }
- return getTurbineCasing(tMeta, 8, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 5, true);
- }
- return getTurbineCasing(tMeta, 5, false);
- }
- if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
- if (((IGregTechTileEntity) tTileEntity).isActive()) {
- return getTurbineCasing(tMeta, 2, true);
- }
- return getTurbineCasing(tMeta, 2, false);
- }
+ if (tMeta > 8 && tMeta < 13) {
+ int tInvertLeftRightMod = aSide % 2 * 2 - 1;
+ switch (aSide / 2) {
+ case 0:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ int tState;
+ if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) != 0) {
+ return getTurbineCasing(tMeta, 4 - i * 3 - j, tState == 1);
+ }
+ }
+ }
+ break;
+ case 1:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ int tState;
+ if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) != 0) {
+ return getTurbineCasing(tMeta, 4 + i * 3 - j * tInvertLeftRightMod, tState == 1);
+ }
+ }
+ }
+ break;
+ case 2:
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (i == 0 && j == 0)
+ continue;
+ int tState;
+ if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) != 0) {
+ return getTurbineCasing(tMeta, 4 + i * 3 + j * tInvertLeftRightMod, tState == 1);
+ }
+ }
+ }
+ break;
}
switch (tMeta) {
- case 9:
- return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
case 10:
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
case 11:
@@ -236,250 +187,18 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
}
}
- boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == this) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == this) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == this) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == this) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == this) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == this) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)};
- switch (aSide) {
- case 0:
- if (tConnectedSides[0]) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
- }
- if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
- }
- if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
- }
- if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
- }
- if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
- }
- if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
- }
- if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((!tConnectedSides[4]) && (!tConnectedSides[2])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
- }
- if ((!tConnectedSides[5]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
- }
- case 1:
- if (tConnectedSides[1]) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
- }
- if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
- }
- if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
- }
- if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
- }
- if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
- }
- if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
- }
- if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
- }
- if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
- }
- if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
- }
- case 2:
- if (tConnectedSides[5]) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
- }
- if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
- }
- if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
- }
- if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
- }
- if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
- }
- case 3:
- if (tConnectedSides[3]) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
- }
- if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
- }
- if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
- }
- if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
- }
- if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
- }
- if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
- }
- case 4:
- if (tConnectedSides[4]) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
- }
- if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
- }
- if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
- }
- if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
- }
- if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
- }
- if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
- }
- case 5:
- if (tConnectedSides[2]) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
- }
- if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
- }
- if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
- }
- if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
- }
- if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
- }
- if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
- }
- if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon();
- }
- if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
- }
- break;
- }
- return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
+ int tStartIndex = tMeta == 6 ? 1 : 13;
+ int tIndexIntoMapping = 0;
+ if (isSameBlock(aWorld, xCoord, yCoord - 1, zCoord, tMeta)) tIndexIntoMapping |= 1;
+ if (isSameBlock(aWorld, xCoord, yCoord + 1, zCoord, tMeta)) tIndexIntoMapping |= 1 << 1;
+ if (isSameBlock(aWorld, xCoord + 1, yCoord, zCoord, tMeta)) tIndexIntoMapping |= 1 << 2;
+ if (isSameBlock(aWorld, xCoord, yCoord, zCoord + 1, tMeta)) tIndexIntoMapping |= 1 << 3;
+ if (isSameBlock(aWorld, xCoord - 1, yCoord, zCoord, tMeta)) tIndexIntoMapping |= 1 << 4;
+ if (isSameBlock(aWorld, xCoord, yCoord, zCoord - 1, tMeta)) tIndexIntoMapping |= 1 << 5;
+ return Textures.BlockIcons.CONNECTED_HULLS[tStartIndex + mapping[aSide][tIndexIntoMapping]].getIcon();
+ }
+
+ private boolean isSameBlock(IBlockAccess aWorld, int aX, int aY, int aZ, int aMeta) {
+ return aWorld.getBlock(aX, aY, aZ) == this && aWorld.getBlockMetadata(aX, aY, aZ) == aMeta;
}
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
index 296bf765b0..63645f3c3f 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
@@ -108,6 +108,35 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHea
}
}
+ public static int getMetaFromCoilHeat(HeatingCoilLevel level) {
+ switch (level) {
+ case LV:
+ return 0;
+ case MV:
+ return 1;
+ case HV:
+ return 2;
+ case EV:
+ return 3;
+ case IV:
+ return 4;
+ case ZPM:
+ return 5;
+ case UV:
+ return 6;
+ case UEV:
+ return 7;
+ case UIV:
+ return 8;
+ case LuV:
+ return 9;
+ case UHV:
+ return 10;
+ default:
+ return 0;
+ }
+ }
+
@Override
public HeatingCoilLevel getCoilHeat(int meta) {
getOnCoilCheck().accept(this);
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index 39eecdd5e4..74e3e3653d 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -55,12 +55,12 @@ public class GT_Item_Machines extends ItemBlock {
if(tDescription.contains("%%%")){
String[] tString = tDescription.split("%%%");
if(tString.length>=2){
- StringBuffer tBuffer = new StringBuffer();
- Object tRep[] = new String[tString.length / 2];
+ StringBuilder tBuffer = new StringBuilder();
+ String[] tRep = new String[tString.length / 2];
for (int j = 0; j < tString.length; j++)
if (j % 2 == 0) tBuffer.append(tString[j]);
else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];}
- aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_" + suffix + "DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished ), tRep));
+ aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_" + suffix + "DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished ), (Object[]) tRep));
}
}else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_" + suffix + "DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished );
aList.add(tTranslated.equals("") ? tDescription : tTranslated);}
@@ -70,16 +70,16 @@ public class GT_Item_Machines extends ItemBlock {
if (tTileEntity.getEUCapacity() > 0L) {
if (tTileEntity.getInputVoltage() > 0L) {
int inputTier = GT_Utility.getTier(tTileEntity.getInputVoltage());
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + EnumChatFormatting.GREEN +")" + EnumChatFormatting.GRAY);
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getInputVoltage()) + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + EnumChatFormatting.GREEN +")" + EnumChatFormatting.GRAY);
}
if (tTileEntity.getOutputVoltage() > 0L) {
int outputTier = GT_Utility.getTier(tTileEntity.getOutputVoltage());
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY);
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getOutputVoltage()) + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY);
}
if (tTileEntity.getOutputAmperage() > 1L) {
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY);
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(tTileEntity.getOutputAmperage()) + EnumChatFormatting.GRAY);
}
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY);
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + EnumChatFormatting.GRAY);
}
}
NBTTagCompound aNBT = aStack.getTagCompound();
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java
index c686f99c0b..ed60929719 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java
@@ -31,6 +31,11 @@ public class GT_Cover_Arm extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((((aTileEntity instanceof IMachineProgress)) && (!((IMachineProgress) aTileEntity).isAllowedToWork()))) {
return aCoverVariable;
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java
index b86f950e23..de3dd5c4d7 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java
@@ -31,6 +31,11 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aCoverVariable % 6 > 1) && ((aTileEntity instanceof IMachineProgress))) {
if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java b/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java
index 3cf0742d52..0bed5423dd 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java
@@ -9,6 +9,11 @@ import net.minecraft.network.play.server.S2DPacketOpenWindow;
public class GT_Cover_Crafting extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if ((aPlayer instanceof EntityPlayerMP)) {
((EntityPlayerMP) aPlayer).getNextWindowId();
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java
index fbbaa32472..49741d4091 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java
@@ -16,6 +16,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_DoesWork extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aTileEntity instanceof IMachineProgress)) {
if (aCoverVariable < 2) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Drain.java b/src/main/java/gregtech/common/covers/GT_Cover_Drain.java
index 5fa2244761..8dd2dbddaa 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Drain.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Drain.java
@@ -16,6 +16,10 @@ import net.minecraftforge.fluids.IFluidHandler;
public class GT_Cover_Drain extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aCoverVariable % 3 > 1) && ((aTileEntity instanceof IMachineProgress))) {
if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 3 < 2) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java
index 3af57ad081..1da5f2a6e2 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java
@@ -21,6 +21,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_EUMeter extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
long tScale = 0L;
if (aCoverVariable < 2) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_EnergyOnly.java b/src/main/java/gregtech/common/covers/GT_Cover_EnergyOnly.java
index 6326cbbe41..fa60fcb374 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_EnergyOnly.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_EnergyOnly.java
@@ -9,6 +9,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_EnergyOnly extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
aCoverVariable = (aCoverVariable + 1) % 3;
switch(aCoverVariable) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
index d68b29e61b..a53545802a 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
@@ -64,6 +64,11 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
long aTimer) {
int tSpeed = getSpeed(aCoverVariable);
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java
index 0c0cb27d1f..7aab35ddaa 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java
@@ -39,6 +39,10 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehavior {
return(String.format("Filtering Fluid: %s Mode: %s", sFluid.getLocalizedName(), getFilterMode(aFilterMode)));
}
+ @Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
@Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java
index 90c09f8168..99003e18e0 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java
@@ -29,6 +29,11 @@ public class GT_Cover_ItemFilter extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(aSide);
Object fromEntity = mExport ? aTileEntity : tTileEntity,
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java
index 5d26f2079e..f1c1bc7df7 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java
@@ -6,10 +6,13 @@ import gregtech.api.gui.widgets.GT_GuiFakeItemButton;
import gregtech.api.gui.widgets.GT_GuiIcon;
import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.gui.widgets.GT_GuiIntegerTextBox;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME;
import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalChestBase;
import net.minecraft.client.gui.GuiButton;
@@ -26,6 +29,11 @@ public class GT_Cover_ItemMeter extends GT_CoverBehavior {
private static final int INVERT_BIT = 0x40000000;
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
//Convert from ver. 5.09.33.50
if ((CONVERTED_BIT & aCoverVariable) == 0)
@@ -38,13 +46,22 @@ public class GT_Cover_ItemMeter extends GT_CoverBehavior {
long tMax = 0;
long tUsed = 0;
- if (aTileEntity instanceof GT_MetaTileEntity_DigitalChestBase) {
- GT_MetaTileEntity_DigitalChestBase dc = (GT_MetaTileEntity_DigitalChestBase)aTileEntity;
+ IMetaTileEntity mte = ((IGregTechTileEntity)aTileEntity).getMetaTileEntity();
+ if (mte instanceof GT_MetaTileEntity_DigitalChestBase) {
+ GT_MetaTileEntity_DigitalChestBase dc = (GT_MetaTileEntity_DigitalChestBase)mte;
tMax = dc.getMaxItemCount(); // currently it is limited by int, but there is not much reason for that
ItemStack[] inv = dc.getStoredItemData();
if (inv != null && inv.length > 1 && inv[1] != null)
tUsed = inv[1].stackSize;
- } else {
+ }
+ else if (mte instanceof GT_MetaTileEntity_Hatch_OutputBus_ME) {
+ if (((GT_MetaTileEntity_Hatch_OutputBus_ME)mte).isLastOutputFailed())
+ {
+ tMax = 64;
+ tUsed = 64;
+ }
+ }
+ else {
int[] tSlots = (aCoverVariable & SLOT_MASK) > 0 ?
new int[] {(aCoverVariable & SLOT_MASK) - 1} :
aTileEntity.getAccessibleSlotsFromSide(aSide);
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Lens.java b/src/main/java/gregtech/common/covers/GT_Cover_Lens.java
index 347a6acfcc..37405e6fa8 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Lens.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Lens.java
@@ -11,6 +11,11 @@ public class GT_Cover_Lens extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public byte getLensColor(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return this.mColor;
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java
index 9fa819cd33..ed75bca967 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java
@@ -18,6 +18,11 @@ import net.minecraftforge.fluids.IFluidHandler;
public class GT_Cover_LiquidMeter extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aTileEntity instanceof IFluidHandler)) {
FluidTankInfo[] tTanks = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN);
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java
index 5a5d02b71d..50b7c443d7 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java
@@ -24,6 +24,11 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
boolean needsRepair = false;
if (aTileEntity instanceof IGregTechTileEntity) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java
index 5857c92dab..b57299ed94 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java
@@ -20,6 +20,11 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior {
private int range = 8;
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
boolean playerDetected = false;
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
index a5b860c0a4..3d937d43fb 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
@@ -24,6 +24,11 @@ public class GT_Cover_Pump extends GT_CoverBehavior{
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aCoverVariable % 6 > 1) && ((aTileEntity instanceof IMachineProgress))) {
if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java
index 41d1861ca1..697d80a243 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java
@@ -8,6 +8,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_RedstoneConductor extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if (aCoverVariable == 0) {
aTileEntity.setOutputRedstoneSignal(aSide, aTileEntity.getStrongestRedstone());
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java
index 0bf008419b..a4649629d8 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java
@@ -5,6 +5,11 @@ import gregtech.api.interfaces.tileentity.ICoverable;
public class GT_Cover_RedstoneReceiverExternal extends GT_Cover_RedstoneWirelessBase {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
aTileEntity.setOutputRedstoneSignal(aSide, GregTech_API.sWirelessRedstone.get(Integer.valueOf(aCoverVariable)) == null ? 0 : ((Byte) GregTech_API.sWirelessRedstone.get(Integer.valueOf(aCoverVariable))).byteValue());
return aCoverVariable;
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java
index cf322e78f1..221f5ea5ce 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java
@@ -9,6 +9,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_RedstoneSignalizer extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
aCoverVariable = (aCoverVariable + 1) % 48;
switch(aCoverVariable / 16) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java
index 1c683966f9..94741f6b36 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java
@@ -5,6 +5,11 @@ import gregtech.api.interfaces.tileentity.ICoverable;
public class GT_Cover_RedstoneTransmitterInternal extends GT_Cover_RedstoneWirelessBase {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
GregTech_API.sWirelessRedstone.put(Integer.valueOf(aCoverVariable), Byte.valueOf(aTileEntity.getOutputRedstoneSignal(aSide)));
return aCoverVariable;
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Screen.java b/src/main/java/gregtech/common/covers/GT_Cover_Screen.java
index afa79b5993..c0de124a7a 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Screen.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Screen.java
@@ -7,6 +7,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_Screen extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public float getBlastProofLevel(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 20.0F;
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java
index fbf5ccca33..6fdc69e0fa 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java
@@ -15,6 +15,11 @@ import net.minecraftforge.fluids.Fluid;
public class GT_Cover_Shutter extends GT_CoverBehavior {
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
return aCoverVariable;
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java b/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java
index 001dc3c023..ae1b73b8cb 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java
@@ -17,6 +17,11 @@ public class GT_Cover_SolarPanel extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if(aSide != 1)return 0;
int coverState=aCoverVariable&0x3;
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java
index 8ac8a0dae9..8d4ac949b7 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java
@@ -1,5 +1,6 @@
package gregtech.common.covers;
+import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.util.GT_ModHandler;
import net.minecraftforge.fluids.FluidStack;
@@ -10,6 +11,11 @@ public class GT_Cover_SteamValve extends GT_Cover_Pump {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
protected boolean canTransferFluid(FluidStack fluid) {
return GT_ModHandler.isAnySteam(fluid);
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Vent.java b/src/main/java/gregtech/common/covers/GT_Cover_Vent.java
index 869235e011..64347d48e2 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Vent.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Vent.java
@@ -13,6 +13,11 @@ public class GT_Cover_Vent extends GT_CoverBehavior {
}
@Override
+ public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return false;
+ }
+
+ @Override
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if ((aTileEntity instanceof IMachineProgress)) {
if ((((IMachineProgress) aTileEntity).hasThingsToDo()) && (aCoverVariable != ((IMachineProgress) aTileEntity).getProgress()) &&
diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java
index b7c87b4860..7a44ade127 100644
--- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java
+++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java
@@ -345,7 +345,7 @@ public class GT_Entity_Arrow extends EntityArrow {
}
public ItemStack getArrowItem() {
- return GT_Utility.copy(this.mArrow);
+ return GT_Utility.copyOrNull(this.mArrow);
}
public void setArrowItem(ItemStack aStack) {
diff --git a/src/main/java/gregtech/common/gui/GT_Container_Boiler.java b/src/main/java/gregtech/common/gui/GT_Container_Boiler.java
index f8c784fb70..afceed249b 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_Boiler.java
+++ b/src/main/java/gregtech/common/gui/GT_Container_Boiler.java
@@ -10,14 +10,12 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
public class GT_Container_Boiler extends GT_ContainerMetaTile_Machine {
- private int mSteamCapacity = 0;//FB: UR - UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR
public int mWaterAmount = 0;
public int mSteamAmount = 0;
public int mProcessingEnergy = 0;
public int mTemperature = 2;
- public GT_Container_Boiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aSteamCapacity) {
+ public GT_Container_Boiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
- this.mSteamCapacity = aSteamCapacity;
}
@Override
@@ -44,14 +42,18 @@ public class GT_Container_Boiler extends GT_ContainerMetaTile_Machine {
if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) {
return;
}
+
+ // GT_MetaTileEntity_Boiler.getCapacity() is used for both water and steam capacity.
+ int capacity = ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).getCapacity();
+
this.mTemperature = ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mTemperature;
this.mProcessingEnergy = ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy;
this.mSteamAmount = (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mSteam == null ? 0 : ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mSteam.amount);
this.mWaterAmount = (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mFluid == null ? 0 : ((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).mFluid.amount);
this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GT_MetaTileEntity_Boiler) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10)));
- this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (this.mSteamCapacity - 100)));
- this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / 15900));
+ this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (capacity - 100)));
+ this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / (capacity - 100)));
this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000));
for (Object crafter : this.crafters) {
diff --git a/src/main/java/gregtech/common/gui/GT_Container_Regulator.java b/src/main/java/gregtech/common/gui/GT_Container_Regulator.java
index f432c9b5d5..f50ac2dae3 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_Regulator.java
+++ b/src/main/java/gregtech/common/gui/GT_Container_Regulator.java
@@ -81,7 +81,7 @@ public class GT_Container_Regulator extends GT_ContainerMetaTile_Machine {
if ((aSlotIndex < 19)) {
ItemStack tStack = aPlayer.inventory.getItemStack();
if (tStack != null) {
- tSlot.putStack(GT_Utility.copy(new Object[]{tStack}));
+ tSlot.putStack(GT_Utility.copyOrNull(tStack));
} else if (tSlot.getStack() != null) {
if (aMouseclick == 0) {
tSlot.getStack().stackSize -= (aShifthold == 1 ? 8 : 1);
diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java
index 45406faec7..4af4826f93 100644
--- a/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java
+++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java
@@ -5,8 +5,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
public class GT_GUIContainer_Boiler extends GT_GUIContainerMetaTile_Machine {
- public GT_GUIContainer_Boiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName, int aSteamCapacity) {
- super(new GT_Container_Boiler(aInventoryPlayer, aTileEntity, aSteamCapacity), "gregtech:textures/gui/" + aTextureName);
+ public GT_GUIContainer_Boiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName) {
+ super(new GT_Container_Boiler(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/" + aTextureName);
}
@Override
diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java
index f0904485d4..839e7db715 100644
--- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java
+++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java
@@ -849,17 +849,13 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 {
GregTech_API.registerCover(ItemList.Cover_NeedsMaintainance.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_ACTIVITYDETECTOR), TextureFactory.builder().addIcon(OVERLAY_ACTIVITYDETECTOR_GLOW).glow().build())), new GT_Cover_NeedMaintainance());
GT_Values.RA.addAssemblerRecipe(ItemList.Emitter_MV.get(1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Aluminium, 1L), ItemList.Cover_NeedsMaintainance.get(1L), 600, 24);
- GT_ModHandler.addCraftingRecipe(ItemList.ItemFilter_Export.get(1L),new Object[]{"SPS","dIC","SPS",'P',OrePrefixes.plateDouble.get(Materials.StainlessSteel),'S',OrePrefixes.screw.get(Materials.StainlessSteel),'I',ItemList.Component_Filter,'C',ItemList.Conveyor_Module_HV});
- GT_ModHandler.addCraftingRecipe(ItemList.ItemFilter_Import.get(1L),new Object[]{"SPS","CId","SPS",'P',OrePrefixes.plateDouble.get(Materials.StainlessSteel),'S',OrePrefixes.screw.get(Materials.StainlessSteel),'I',ItemList.Component_Filter,'C',ItemList.Conveyor_Module_HV});
- GT_ModHandler.addShapelessCraftingRecipe(ItemList.ItemFilter_Export.get(1L),new Object[]{ItemList.ItemFilter_Import.get(1L)});
- GT_ModHandler.addShapelessCraftingRecipe(ItemList.ItemFilter_Import.get(1L),new Object[]{ItemList.ItemFilter_Export.get(1L)});
-
- GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plateDouble,Materials.StainlessSteel,2L),ItemList.Component_Filter.get(1L),ItemList.Conveyor_Module_HV.get(1L),GT_Utility.getIntegratedCircuit(1)},Materials.SolderingAlloy.getMolten(72L),ItemList.ItemFilter_Export.get(1L),100,30);
- GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plateDouble,Materials.StainlessSteel,2L),ItemList.Component_Filter.get(1L),ItemList.Conveyor_Module_HV.get(1L),GT_Utility.getIntegratedCircuit(1)},Materials.Tin.getMolten(144L),ItemList.ItemFilter_Export.get(1L),100,30);
- GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plateDouble,Materials.StainlessSteel,2L),ItemList.Component_Filter.get(1L),ItemList.Conveyor_Module_HV.get(1L),GT_Utility.getIntegratedCircuit(1)},Materials.Lead.getMolten(288L),ItemList.ItemFilter_Export.get(1L),100,30);
- GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plateDouble,Materials.StainlessSteel,2L),ItemList.Component_Filter.get(1L),ItemList.Conveyor_Module_HV.get(1L),GT_Utility.getIntegratedCircuit(2)},Materials.SolderingAlloy.getMolten(72L),ItemList.ItemFilter_Import.get(1L),100,30);
- GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plateDouble,Materials.StainlessSteel,2L),ItemList.Component_Filter.get(1L),ItemList.Conveyor_Module_HV.get(1L),GT_Utility.getIntegratedCircuit(2)},Materials.Tin.getMolten(144L),ItemList.ItemFilter_Import.get(1L),100,30);
- GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plateDouble,Materials.StainlessSteel,2L),ItemList.Component_Filter.get(1L),ItemList.Conveyor_Module_HV.get(1L),GT_Utility.getIntegratedCircuit(2)},Materials.Lead.getMolten(288L),ItemList.ItemFilter_Import.get(1L),100,30);
+ GT_ModHandler.addCraftingRecipe(ItemList.ItemFilter_Export.get(1L), new Object[]{"SPS", "dIC", "SPS", 'P', OrePrefixes.plate.get(Materials.Tin), 'S', OrePrefixes.screw.get(Materials.Iron), 'I', ItemList.Component_Filter, 'C', ItemList.Conveyor_Module_LV});
+ GT_ModHandler.addCraftingRecipe(ItemList.ItemFilter_Import.get(1L), new Object[]{"SPS", "CId", "SPS", 'P', OrePrefixes.plate.get(Materials.Tin), 'S', OrePrefixes.screw.get(Materials.Iron), 'I', ItemList.Component_Filter, 'C', ItemList.Conveyor_Module_LV});
+ GT_ModHandler.addShapelessCraftingRecipe(ItemList.ItemFilter_Export.get(1L), new Object[]{ItemList.ItemFilter_Import.get(1L)});
+ GT_ModHandler.addShapelessCraftingRecipe(ItemList.ItemFilter_Import.get(1L), new Object[]{ItemList.ItemFilter_Export.get(1L)});
+
+ GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate,Materials.Tin,2L), ItemList.Component_Filter.get(1L), ItemList.Conveyor_Module_LV.get(1L), GT_Utility.getIntegratedCircuit(1)}, null, ItemList.ItemFilter_Export.get(1L), 100, 30);
+ GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate,Materials.Tin,2L), ItemList.Component_Filter.get(1L), ItemList.Conveyor_Module_LV.get(1L), GT_Utility.getIntegratedCircuit(2)}, null, ItemList.ItemFilter_Import.get(1L), 100, 30);
}
private static final Map<Materials,Materials> cauldronRemap =new HashMap<>();
diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_99.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_99.java
index 2b94d96cb0..1c27310d99 100644
--- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_99.java
+++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_99.java
@@ -1,5 +1,6 @@
package gregtech.common.items;
+import com.google.common.collect.ImmutableList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
@@ -24,145 +25,174 @@ import static gregtech.api.enums.OrePrefixes.cellMolten;
public class GT_MetaGenerated_Item_99 extends GT_MetaGenerated_Item {
public static GT_MetaGenerated_Item_99 INSTANCE;
- private BitSet enabled=new BitSet();
+ /**
+ * Ore prefixes appear in this list in the order in which they will be assigned ID blocks.
+ *
+ * <p>In order to avoid breaking existing worlds, the entries in this list must not be re-ordered! The only safe
+ * modification that can be made to this list is adding new entries to the end.
+ */
+ private static final ImmutableList<OrePrefixes> CRACKED_CELL_TYPES =
+ ImmutableList.of(
+ OrePrefixes.cellHydroCracked1, OrePrefixes.cellHydroCracked2, OrePrefixes.cellHydroCracked3,
+ OrePrefixes.cellSteamCracked1, OrePrefixes.cellSteamCracked2, OrePrefixes.cellSteamCracked3);
+ private static final int NUM_CRACKED_CELL_TYPES = CRACKED_CELL_TYPES.size();
- private void register(Materials tMaterial,int i){
- ItemStack tStack = new ItemStack(this, 1, i);
- enabled.set(i);
- GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalizationFormat(cellMolten, tMaterial, i));
- GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(cellMolten.mMaterialAmount / M));
- if (cellMolten.mIsUnificatable) {
- GT_OreDictUnificator.set(cellMolten, tMaterial, tStack);
- } else {
- GT_OreDictUnificator.registerOre(cellMolten.get(tMaterial), tStack);
- }
- }
- //x32
+ /**
+ * Assignment of metadata IDs:
+ * 0 - 999: Molten cells
+ * 10_000 - 15_999: Cracked fluid cells (# IDs used is NUM_CRACKED_CELL_TYPES * 1_000; update this if you add any)
+ */
+ private BitSet enabled = new BitSet();
public GT_MetaGenerated_Item_99() {
- super("metaitem.99", (short) 1000, (short) 0);
+ super("metaitem.99", (short) (10_000 + NUM_CRACKED_CELL_TYPES * 1_000), (short) 0);
INSTANCE = this;
- for (Materials tMaterial:GregTech_API.sGeneratedMaterials) {
- if (tMaterial == null || tMaterial.mMetaItemSubID<0 || tMaterial.mMetaItemSubID>=1000) continue;
- //if (tMaterial.getcells(1)==null) {
+ for (Materials tMaterial : GregTech_API.sGeneratedMaterials) {
+ if (tMaterial == null || tMaterial.mMetaItemSubID < 0 || tMaterial.mMetaItemSubID >= 1_000) {
+ continue;
+ }
+
if ((tMaterial.contains(SubTag.SMELTING_TO_FLUID)) && (!tMaterial.contains(SubTag.NO_SMELTING)) && !tMaterial.contains(SubTag.SMELTING_TO_GEM)) {
- register(tMaterial,tMaterial.mMetaItemSubID);
- if (tMaterial.mSmeltInto != tMaterial) {
- register(tMaterial.mSmeltInto,tMaterial.mSmeltInto.mMetaItemSubID);
+ registerMolten(tMaterial, tMaterial.mMetaItemSubID);
+ if (tMaterial.mSmeltInto != tMaterial
+ && tMaterial.mSmeltInto.mMetaItemSubID >= 0 && tMaterial.mSmeltInto.mMetaItemSubID < 1_000) {
+ registerMolten(tMaterial.mSmeltInto, tMaterial.mSmeltInto.mMetaItemSubID);
}
}
- //}
+
+ if (tMaterial.canBeCracked()) {
+ registerCracked(tMaterial, tMaterial.mMetaItemSubID);
+ }
}
+
+ // We're not going to use these BitSets, so clear them to save memory.
mEnabledItems.clear();
mVisibleItems.clear();
}
- /* ---------- OVERRIDEABLE FUNCTIONS ---------- */
+ private void registerMolten(Materials tMaterial,int i){
+ ItemStack tStack = new ItemStack(this, 1, i);
+ enabled.set(i);
- /**
- * @return the Color Modulation the Material is going to be rendered with.
- */
- @Override
- public short[] getRGBa(ItemStack aStack) {
- Materials tMaterial = GregTech_API.sGeneratedMaterials[getDamage(aStack)];
- return tMaterial == null ? Materials._NULL.mMoltenRGBa : tMaterial.mMoltenRGBa;
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", cellMolten.getDefaultLocalNameFormatForItem(tMaterial));
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(cellMolten.mMaterialAmount / M));
+
+ if (cellMolten.mIsUnificatable) {
+ GT_OreDictUnificator.set(cellMolten, tMaterial, tStack);
+ } else {
+ GT_OreDictUnificator.registerOre(cellMolten.get(tMaterial), tStack);
+ }
}
- /* ---------- OVERRIDEABLE FUNCTIONS ---------- */
+ private void registerCracked(Materials tMaterial, int i) {
+ int offset = 10_000;
+ for (OrePrefixes prefix : CRACKED_CELL_TYPES) {
+ ItemStack tStack = new ItemStack(this, 1, offset + i);
+ enabled.set(offset + i);
- /**
- * @param aPrefix the OreDict Prefix
- * @param aMaterial the Material
- * @param aMetaData a Index from [0 - 31999]
- * @return the Localized Name when default LangFiles are used.
- */
- @Deprecated
- public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) {
- return aPrefix.getDefaultLocalNameForItem(aMaterial);
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", prefix.getDefaultLocalNameFormatForItem(tMaterial));
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(prefix.mMaterialAmount / M));
+
+ if (prefix.mIsUnificatable) {
+ GT_OreDictUnificator.set(prefix, tMaterial, tStack);
+ } else {
+ GT_OreDictUnificator.registerOre(prefix.get(tMaterial), tStack);
+ }
+
+ offset += 1_000;
+ }
}
- /**
- * @param aPrefix the OreDict Prefix
- * @param aMaterial the Material
- * @param aMetaData a Index from [0 - 31999]
- * @return the Localized Name Format when default LangFiles are used.
- */
- public String getDefaultLocalizationFormat(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) {
- return aPrefix.getDefaultLocalNameFormatForItem(aMaterial);
+ /** Returns null for item damage out of bounds. */
+ private Materials getMaterial(int damage) {
+ if (damage < 0) {
+ return null;
+ }
+ return GregTech_API.sGeneratedMaterials[damage % 1_000];
}
- /**
- * @param aPrefix always != null
- * @param aMaterial always != null
- * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well.
- * @return if this Item should be visible in NEI or Creative
- */
- public boolean doesShowInCreative(OrePrefixes aPrefix, Materials aMaterial, boolean aDoShowAllItems) {
- return true;
+ /** Returns null for item damage out of bounds. */
+ private OrePrefixes getOrePrefix(int damage) {
+ if (damage < 0) {
+ return null;
+ } else if (damage < 1_000) {
+ return cellMolten;
+ } else if (damage >= 10_000 && damage < 10_000 + (NUM_CRACKED_CELL_TYPES * 1_000)) {
+ return CRACKED_CELL_TYPES.get((damage / 1_000) - 10);
+ }
+ return null;
}
- /* ---------- INTERNAL OVERRIDES ---------- */
+ @Override
+ public short[] getRGBa(ItemStack aStack) {
+ OrePrefixes prefix = getOrePrefix(aStack.getItemDamage());
+ Materials material = getMaterial(aStack.getItemDamage());
+ if (material == null) {
+ material = Materials._NULL;
+ }
+
+ if (prefix == cellMolten) {
+ return material.mMoltenRGBa;
+ } else {
+ return material.mRGBa;
+ }
+ }
@Override
public String getItemStackDisplayName(ItemStack aStack) {
String aName = super.getItemStackDisplayName(aStack);
- int aDamage = aStack.getItemDamage();
- if (aDamage < 1000 && aDamage >= 0)
- return Materials.getLocalizedNameForItem(aName, aDamage);
+ Materials material = getMaterial(aStack.getItemDamage());
+ if (material != null) {
+ return material.getLocalizedNameForItem(aName);
+ }
return aName;
}
@Override
public ItemStack getContainerItem(ItemStack aStack) {
- int aDamage = aStack.getItemDamage();
- if (aDamage < 1000 && aDamage >= 0) {
- return cellMolten.mContainerItem;
+ OrePrefixes prefix = getOrePrefix(aStack.getItemDamage());
+ if (prefix != null) {
+ return prefix.mContainerItem;
}
return null;
}
@Override
@SideOnly(Side.CLIENT)
- public final void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
- for (int i = 0; i < 1000; i++) {
- Materials aMaterial = GregTech_API.sGeneratedMaterials[i];
- if (aMaterial != null && enabled.get(i)) {
- ItemStack tStack = new ItemStack(this, 1, i);
- isItemStackUsable(tStack);
- aList.add(tStack);
- }
- }
- super.getSubItems(var1, aCreativeTab, aList);
+ public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
+ enabled.stream()
+ .mapToObj(i -> new ItemStack(this, 1, i))
+ .forEach(aList::add);
}
@Override
public final IIcon getIconFromDamage(int aMetaData) {
- if (aMetaData < 0) return null;
- if (aMetaData < 1000) {
- Materials tMaterial = GregTech_API.sGeneratedMaterials[aMetaData];
- if (tMaterial == null) return null;
- IIconContainer tIcon = getIconContainer(aMetaData);
- if (tIcon != null) return tIcon.getIcon();
- return null;
+ IIconContainer iconContainer = getIconContainer(aMetaData);
+ if (iconContainer != null) {
+ return iconContainer.getIcon();
}
return null;
}
@Override
public IIconContainer getIconContainer(int aMetaData) {
- if (aMetaData < 0) return null;
- if (aMetaData < 1000) {
- Materials tMaterial = GregTech_API.sGeneratedMaterials[aMetaData];
- if (tMaterial == null) return null;
- return tMaterial.mIconSet.mTextures[cellMolten.mTextureIndex];
+ Materials material = getMaterial(aMetaData);
+ OrePrefixes prefix = getOrePrefix(aMetaData);
+ if (material != null && prefix != null) {
+ return material.mIconSet.mTextures[prefix.mTextureIndex];
}
return null;
}
@Override
public int getItemStackLimit(ItemStack aStack) {
- return cellMolten.mDefaultStackSize;
+ OrePrefixes prefix = getOrePrefix(aStack.getItemDamage());
+ if (prefix != null) {
+ return prefix.mDefaultStackSize;
+ } else {
+ return 64;
+ }
}
}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java
index b909593694..a5393cdec5 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java
@@ -14,7 +14,7 @@ public class Behaviour_DataOrb extends Behaviour_None {
if (aNewContent[i] == null) {
aInventory[i] = null;
} else {
- aInventory[i] = GT_Utility.copy(new Object[]{aNewContent[i]});
+ aInventory[i] = GT_Utility.copyOrNull(aNewContent[i]);
}
}
}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java
index 43a95fd2c7..ddb88b80c8 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java
@@ -14,8 +14,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
+import java.util.HashMap;
import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
public class Behaviour_Plunger_Item extends Behaviour_None {
private final int mCosts;
@@ -34,7 +34,7 @@ public class Behaviour_Plunger_Item extends Behaviour_None {
if ((aTileEntity instanceof IGregTechTileEntity)) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aTileEntity).getMetaTileEntity();
if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) {
- for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, new ConcurrentHashMap<IMetaTileEntityItemPipe, Long>(), 0L, false, true)).keySet())
+ for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, new HashMap<>(), 0L, false, true)).keySet())
{
int i = 0;
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java
index a0dea777f7..bcaa8242f3 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java
@@ -90,7 +90,7 @@ public class Behaviour_Sonictron extends Behaviour_None {
if (aNewContent[i] == null) {
aInventory[i] = null;
} else {
- aInventory[i] = GT_Utility.copy(aNewContent[i]);
+ aInventory[i] = GT_Utility.copyOrNull(aNewContent[i]);
}
}
}
diff --git a/src/main/java/gregtech/common/misc/GT_Command.java b/src/main/java/gregtech/common/misc/GT_Command.java
index a4b46b8cee..13e26353d8 100644
--- a/src/main/java/gregtech/common/misc/GT_Command.java
+++ b/src/main/java/gregtech/common/misc/GT_Command.java
@@ -1,5 +1,6 @@
package gregtech.common.misc;
+import com.gtnewhorizon.structurelib.StructureLib;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
import gregtech.api.objects.GT_ChunkManager;
@@ -40,6 +41,7 @@ public final class GT_Command extends CommandBase {
sender.addChatMessage(new ChatComponentText("\"toggle debugSmallOres\" - toggles worldgen small vein debug"));
sender.addChatMessage(new ChatComponentText("\"toggle debugStones\" - toggles worldgen stones debug"));
sender.addChatMessage(new ChatComponentText("\"toggle debugChunkloaders\" - toggles chunkloaders debug"));
+ sender.addChatMessage(new ChatComponentText("\"toggle debugMulti\" - toggles structurelib debug"));
sender.addChatMessage(new ChatComponentText("\"chunks\" - print a list of the force loaded chunks"));
sender.addChatMessage(new ChatComponentText(
"\"pollution <amount>\" - adds the <amount> of the pollution to the current chunk, " +
@@ -59,7 +61,7 @@ public final class GT_Command extends CommandBase {
} else if (test.equals("toggle")) {
String test1 = ss[1].trim();
Stream.of("D1", "D2", "debugCleanroom", "debugDriller", "debugBlockPump", "debugBlockMiner", "debugWorldGen", "debugEntityCramming",
- "debugOrevein", "debugSmallOres", "debugStones", "debugChunkloaders")
+ "debugOrevein", "debugSmallOres", "debugStones", "debugChunkloaders", "debugMulti")
.filter(s -> test1.isEmpty() || s.startsWith(test1))
.forEach(l::add);
@@ -79,6 +81,11 @@ public final class GT_Command extends CommandBase {
printHelp(sender);
return;
}
+ if ("debugMulti".equals(strings[1])) {
+ StructureLib.DEBUG_MODE = !StructureLib.DEBUG_MODE;
+ sender.addChatMessage(new ChatComponentText(strings[1] + " = " + (StructureLib.DEBUG_MODE ? "true" : "false")));
+ return;
+ }
try {
Field field = GT_Values.class.getDeclaredField(strings[1]);
if (field.getType() != boolean.class) {
diff --git a/src/main/java/gregtech/common/render/GT_FlaskRenderer.java b/src/main/java/gregtech/common/render/GT_FlaskRenderer.java
index 7ba4d8e037..48d9b0bf90 100644
--- a/src/main/java/gregtech/common/render/GT_FlaskRenderer.java
+++ b/src/main/java/gregtech/common/render/GT_FlaskRenderer.java
@@ -1,5 +1,6 @@
package gregtech.common.render;
+import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.ItemList;
import gregtech.common.items.GT_VolumetricFlask;
@@ -15,8 +16,8 @@ import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
-@SideOnly(cpw.mods.fml.relauncher.Side.CLIENT)
-public final class GT_FlaskRenderer implements net.minecraftforge.client.IItemRenderer {
+@SideOnly(Side.CLIENT)
+public final class GT_FlaskRenderer implements IItemRenderer {
public GT_FlaskRenderer() {
MinecraftForgeClient.registerItemRenderer(ItemList.VOLUMETRIC_FLASK.getItem(), this);
}
@@ -36,8 +37,8 @@ public final class GT_FlaskRenderer implements net.minecraftforge.client.IItemRe
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GT_VolumetricFlask cell = (GT_VolumetricFlask) item.getItem();
IIcon icon = item.getIconIndex();
- GL11.glEnable(3042);
- GL11.glEnable(3008);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_ALPHA_TEST);
if (type.equals(ItemRenderType.ENTITY)) {
GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
@@ -56,7 +57,7 @@ public final class GT_FlaskRenderer implements net.minecraftforge.client.IItemRe
IIcon fluidicon = fs.getFluid().getIcon(fs);
int fluidColor = fs.getFluid().getColor(fs);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
- GL11.glBlendFunc(0, 1);
+ GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE);
if (type.equals(ItemRenderType.INVENTORY)) {
DrawUtil.renderIcon(iconWindow, 16.0D, 0.0D, 0.0F, 0.0F, -1.0F);
} else {
@@ -65,8 +66,8 @@ public final class GT_FlaskRenderer implements net.minecraftforge.client.IItemRe
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
- GL11.glBlendFunc(770, 771);
- GL11.glDepthFunc(514);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glColor3ub((byte) (fluidColor >> 16), (byte) (fluidColor >> 8), (byte) fluidColor);
if (type.equals(ItemRenderType.INVENTORY)) {
DrawUtil.renderIcon(fluidicon, 16.0D, 0.0D, 0.0F, 0.0F, -1.0F);
@@ -76,17 +77,17 @@ public final class GT_FlaskRenderer implements net.minecraftforge.client.IItemRe
}
GL11.glColor3ub((byte) -1, (byte) -1, (byte) -1);
- GL11.glDepthFunc(515);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
- GL11.glBlendFunc(770, 771);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (type.equals(ItemRenderType.INVENTORY)) {
DrawUtil.renderIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
} else {
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
}
- GL11.glDisable(3008);
- GL11.glDisable(3042);
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
+ GL11.glDisable(GL11.GL_BLEND);
}
}
diff --git a/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java b/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java
index ef5d8287ba..c4e23eab6e 100644
--- a/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java
+++ b/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java
@@ -67,7 +67,7 @@ public class GT_FluidDisplayStackRenderer implements IItemRenderer {
// Render Fluid amount text
long fluidAmount = item.getTagCompound().getLong("mFluidDisplayAmount");
- if (fluidAmount > 0L) {
+ if (fluidAmount > 0L && !item.getTagCompound().getBoolean("mHideStackSize")) {
String amountString;
if (fluidAmount < 10000) {
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_MetaGenerated_Item_Renderer.java b/src/main/java/gregtech/common/render/GT_MetaGenerated_Item_Renderer.java
index 6e4aadc938..54eafccc3a 100644
--- a/src/main/java/gregtech/common/render/GT_MetaGenerated_Item_Renderer.java
+++ b/src/main/java/gregtech/common/render/GT_MetaGenerated_Item_Renderer.java
@@ -1,8 +1,10 @@
package gregtech.common.render;
+import gregtech.api.enums.ItemList;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.items.GT_MetaGenerated_Item;
import gregtech.api.util.GT_Utility;
+import gregtech.loaders.ExtraIcons;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
@@ -15,13 +17,14 @@ import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
-import java.util.Iterator;
+import javax.annotation.Nullable;
+
+import static gregtech.api.enums.ItemList.*;
public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
public GT_MetaGenerated_Item_Renderer() {
- GT_MetaGenerated_Item tItem;
- for (Iterator i$ = GT_MetaGenerated_Item.sInstances.values().iterator(); i$.hasNext(); MinecraftForgeClient.registerItemRenderer(tItem, this)) {
- tItem = (GT_MetaGenerated_Item) i$.next();
+ for (GT_MetaGenerated_Item item : GT_MetaGenerated_Item.sInstances.values()) {
+ MinecraftForgeClient.registerItemRenderer(item, this);
}
}
@@ -53,7 +56,7 @@ public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
GT_MetaGenerated_Item aItem = (GT_MetaGenerated_Item) aStack.getItem();
- GL11.glEnable(3042);
+ GL11.glEnable(GL11.GL_BLEND);
if (type == IItemRenderer.ItemRenderType.ENTITY) {
if (RenderItem.renderInFrame) {
GL11.glScalef(0.85F, 0.85F, 0.85F);
@@ -67,7 +70,7 @@ public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
if (aMetaData < aItem.mOffset) {
IIconContainer aIcon = aItem.getIconContainer(aMetaData);
IIcon tOverlay = null;
- IIcon tFluidIcon = null;
+ IIcon fluidIcon = null;
IIcon tIcon;
if (aIcon == null) {
tIcon = aStack.getIconIndex();
@@ -79,12 +82,12 @@ public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
return;
}
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aStack, true);
- if ((tOverlay != null) && (tFluid != null) && (tFluid.getFluid() != null)) {
- tFluidIcon = tFluid.getFluid().getIcon(tFluid);
+ if (tOverlay != null && tFluid != null && tFluid.getFluid() != null) {
+ fluidIcon = tFluid.getFluid().getIcon(tFluid);
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
- GL11.glBlendFunc(770, 771);
- if (tFluidIcon == null) {
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ if (fluidIcon == null) {
short[] tModulation = aItem.getRGBa(aStack);
GL11.glColor3f(tModulation[0] / 255.0F, tModulation[1] / 255.0F, tModulation[2] / 255.0F);
}
@@ -93,24 +96,23 @@ public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
} else {
ItemRenderer.renderItemIn2D(Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F);
}
- if (tFluidIcon != null) {
- assert (tFluid != null);
+ if (fluidIcon != null) {
int tColor = tFluid.getFluid().getColor(tFluid);
GL11.glColor3f((tColor >> 16 & 0xFF) / 255.0F, (tColor >> 8 & 0xFF) / 255.0F, (tColor & 0xFF) / 255.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
- GL11.glBlendFunc(770, 771);
- GL11.glDepthFunc(514);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glDepthFunc(GL11.GL_EQUAL);
if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
- GT_RenderUtil.renderItemIcon(tFluidIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
+ GT_RenderUtil.renderItemIcon(fluidIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
} else {
- ItemRenderer.renderItemIn2D(Tessellator.instance, tFluidIcon.getMaxU(), tFluidIcon.getMinV(), tFluidIcon.getMinU(), tFluidIcon.getMaxV(), tFluidIcon.getIconWidth(), tFluidIcon.getIconHeight(), 0.0625F);
+ ItemRenderer.renderItemIn2D(Tessellator.instance, fluidIcon.getMaxU(), fluidIcon.getMinV(), fluidIcon.getMinU(), fluidIcon.getMaxV(), fluidIcon.getIconWidth(), fluidIcon.getIconHeight(), 0.0625F);
}
- GL11.glDepthFunc(515);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glColor3f(1.0F, 1.0F, 1.0F);
if (tOverlay != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
- GL11.glBlendFunc(770, 771);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
} else {
@@ -120,19 +122,19 @@ public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
} else {
IIcon tIcon;
if (aItem.mIconList[(aMetaData - aItem.mOffset)].length > 1) {
- Long[] tStats = (Long[]) aItem.mElectricStats.get(Short.valueOf(aMetaData));
+ Long[] tStats = aItem.mElectricStats.get(aMetaData);
- if ((tStats != null) && (tStats[3].longValue() < 0L)) {
+ if ((tStats != null) && (tStats[3] < 0L)) {
long tCharge = aItem.getRealCharge(aStack);
if (tCharge <= 0L) {
tIcon = aItem.mIconList[(aMetaData - aItem.mOffset)][1];
} else {
- if (tCharge >= tStats[0].longValue()) {
+ if (tCharge >= tStats[0]) {
tIcon = aItem.mIconList[(aMetaData - aItem.mOffset)][8];
} else {
- tIcon = aItem.mIconList[(aMetaData - aItem.mOffset)][(7 - (int) java.lang.Math.max(0L, java.lang.Math.min(5L, (tStats[0].longValue() - tCharge) * 6L / tStats[0].longValue())))];
+ tIcon = aItem.mIconList[(aMetaData - aItem.mOffset)][(7 - (int) Math.max(0L, Math.min(5L, (tStats[0] - tCharge) * 6L / tStats[0])))];
}
}
} else {
@@ -141,14 +143,84 @@ public class GT_MetaGenerated_Item_Renderer implements IItemRenderer {
} else {
tIcon = aItem.mIconList[(aMetaData - aItem.mOffset)][0];
}
+
+ ItemList largeFluidCell = getLargeFluidCell(aStack);
+ if (largeFluidCell != null) {
+ renderLargeFluidCellExtraParts(type, largeFluidCell, aStack);
+ }
+
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
- GL11.glBlendFunc(770, 771);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
} else {
ItemRenderer.renderItemIn2D(Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F);
}
}
- GL11.glDisable(3042);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ @Nullable
+ private static ItemList getLargeFluidCell(ItemStack stack) {
+ if (isSame(Large_Fluid_Cell_Steel, stack)) return Large_Fluid_Cell_Steel;
+ if (isSame(Large_Fluid_Cell_Aluminium, stack)) return Large_Fluid_Cell_Aluminium;
+ if (isSame(Large_Fluid_Cell_TungstenSteel, stack)) return Large_Fluid_Cell_TungstenSteel;
+ if (isSame(Large_Fluid_Cell_StainlessSteel, stack)) return Large_Fluid_Cell_StainlessSteel;
+ if (isSame(Large_Fluid_Cell_Titanium, stack)) return Large_Fluid_Cell_Titanium;
+ if (isSame(Large_Fluid_Cell_Chrome, stack)) return Large_Fluid_Cell_Chrome;
+ if (isSame(Large_Fluid_Cell_Iridium, stack)) return Large_Fluid_Cell_Iridium;
+ if (isSame(Large_Fluid_Cell_Osmium, stack)) return Large_Fluid_Cell_Osmium;
+ if (isSame(Large_Fluid_Cell_Neutronium, stack)) return Large_Fluid_Cell_Neutronium;
+
+ return null;
+ }
+
+ private static void renderLargeFluidCellExtraParts(IItemRenderer.ItemRenderType type, ItemList item, ItemStack stack) {
+
+ IIcon inner;
+ if (item == Large_Fluid_Cell_Steel) inner = ExtraIcons.steelLargeCellInner;
+ else if (item == Large_Fluid_Cell_Aluminium) inner = ExtraIcons.aluminiumLargeCellInner;
+ else if (item == Large_Fluid_Cell_StainlessSteel) inner = ExtraIcons.stainlesssteelLargeCellInner;
+ else if (item == Large_Fluid_Cell_Titanium) inner = ExtraIcons.titaniumLargeCellInner;
+ else if (item == Large_Fluid_Cell_TungstenSteel) inner = ExtraIcons.tungstensteelLargeCellInner;
+ else if (item == Large_Fluid_Cell_Iridium) inner = ExtraIcons.iridiumLargeCellInner;
+ else if (item == Large_Fluid_Cell_Osmium) inner = ExtraIcons.osmiumLargeCellInner;
+ else if (item == Large_Fluid_Cell_Chrome) inner = ExtraIcons.chromiumLargeCellInner;
+ else inner = ExtraIcons.neutroniumLargeCellInner;
+
+ // Empty inner side
+ Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
+ if (type.equals(ItemRenderType.INVENTORY)) {
+ GT_RenderUtil.renderItemIcon(inner, 16.0D, -0.001D, 0.0F, 0.0F, -1.0F);
+ } else {
+ ItemRenderer.renderItemIn2D(Tessellator.instance, inner.getMaxU(), inner.getMinV(), inner.getMinU(), inner.getMaxV(), inner.getIconWidth(), inner.getIconHeight(), 0.0625F);
+ }
+
+ FluidStack fluidStack = GT_Utility.getFluidForFilledItem(stack, true);
+
+ if (fluidStack != null && fluidStack.getFluid() != null) {
+ IIcon fluidIcon = fluidStack.getFluid().getIcon(fluidStack);
+ int fluidColor = fluidStack.getFluid().getColor(fluidStack);
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glDepthFunc(GL11.GL_EQUAL);
+ GL11.glColor3ub((byte) (fluidColor >> 16), (byte) (fluidColor >> 8), (byte) fluidColor);
+ if (type.equals(ItemRenderType.INVENTORY)) {
+ GT_RenderUtil.renderItemIcon(fluidIcon, 16.0D, -0.001D, 0.0F, 0.0F, -1.0F);
+ } else {
+ ItemRenderer.renderItemIn2D(Tessellator.instance, fluidIcon.getMaxU(), fluidIcon.getMinV(), fluidIcon.getMinU(), fluidIcon.getMaxV(), fluidIcon.getIconWidth(), fluidIcon.getIconHeight(), 0.0625F);
+ }
+
+ GL11.glColor3ub((byte) -1, (byte) -1, (byte) -1);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ }
+ }
+
+ private static boolean isSame(ItemList item, ItemStack stack) {
+ ItemStack internal = item.getInternalStack_unsafe();
+ if (GT_Utility.isStackInvalid(internal)) return false;
+
+ return internal.getItem() == stack.getItem() && internal.getItemDamage() == stack.getItemDamage();
}
}
diff --git a/src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java b/src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java
deleted file mode 100644
index 899e4d7c5d..0000000000
--- a/src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package gregtech.common.render;
-
-import gregtech.GT_Mod;
-import gregtech.api.enums.Textures.BlockIcons;
-import gregtech.api.interfaces.IColorModulationContainer;
-import gregtech.api.interfaces.IIconContainer;
-import gregtech.api.interfaces.ITexture;
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.util.IIcon;
-
-import static gregtech.api.util.LightingHelper.MAX_BRIGHTNESS;
-
-/**
- * This {@link ITexture} implementation renders texture with max brightness to glow in the dark.
- */
-
-class GT_RenderedGlowTexture implements ITexture, IColorModulationContainer {
- protected final IIconContainer mIconContainer;
- private final short[] mRGBa;
-
- GT_RenderedGlowTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) {
- if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture");
- mIconContainer = GT_Mod.gregtechproxy.mRenderGlowTextures ? aIcon : BlockIcons.VOID;
- mRGBa = aRGBa;
- }
-
- @Override
- public short[] getRGBA() {
- return mRGBa;
- }
-
- @Override
- public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API
- if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
- final boolean enableAO = aRenderer.enableAO;
- aRenderer.enableAO = false;
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f);
- Tessellator.instance.setBrightness(MAX_BRIGHTNESS);
- Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]);
- aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon());
- if (mIconContainer.getOverlayIcon() != null) {
- Tessellator.instance.setColorOpaque(255, 255, 255);
- aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- aRenderer.enableAO = enableAO;
- }
-
- @Override
- public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API
- if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
- aRenderer.field_152631_f = true;
- final boolean enableAO = aRenderer.enableAO;
- aRenderer.enableAO = false;
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f);
- Tessellator.instance.setBrightness(MAX_BRIGHTNESS);
- Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]);
- aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon());
- if (mIconContainer.getOverlayIcon() != null) {
- Tessellator.instance.setColorOpaque(255, 255, 255);
- aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- aRenderer.field_152631_f = false;
- aRenderer.enableAO = enableAO;
- }
-
- @Override
- public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API
- if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
- final boolean enableAO = aRenderer.enableAO;
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f);
- final Tessellator tessellator = Tessellator.instance;
- IIcon aIcon = mIconContainer.getIcon();
-
- float minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D);
- float maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D);
- float minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
- float maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
-
- if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
- minU = 16.0F - aIcon.getMaxU();
- maxU = 16.0F - aIcon.getMinU();
- }
-
- if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) {
- minV = aIcon.getMinV();
- maxV = aIcon.getMaxV();
- }
-
- double minX = aX + aRenderer.renderMinX;
- double maxX = aX + aRenderer.renderMaxX;
- double minY = aY + aRenderer.renderMinY;
- double minZ = aZ + aRenderer.renderMinZ;
- double maxZ = aZ + aRenderer.renderMaxZ;
-
- Tessellator.instance.setBrightness(MAX_BRIGHTNESS);
- Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]);
-
- tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
- tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV);
- tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV);
- tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV);
-
- if (mIconContainer.getOverlayIcon() != null) {
- minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D);
- maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D);
- minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
- maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
-
- if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
- minU = 16.0F - aIcon.getMaxU();
- maxU = 16.0F - aIcon.getMinU();
- }
-
- if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) {
- minV = aIcon.getMinV();
- maxV = aIcon.getMaxV();
- }
-
- minX = aX + (float) aRenderer.renderMinX;
- maxX = aX + (float) aRenderer.renderMaxX;
- minY = aY + (float) aRenderer.renderMinY;
- minZ = aZ + (float) aRenderer.renderMinZ;
- maxZ = aZ + (float) aRenderer.renderMaxZ;
-
- Tessellator.instance.setColorOpaque(255, 255, 255);
- tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
- tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV);
- tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV);
- tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV);
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- aRenderer.enableAO = enableAO;
- }
-
- @Override
- public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API
- if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
- final boolean enableAO = aRenderer.enableAO;
- aRenderer.enableAO = false;
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f);
- Tessellator.instance.setBrightness(MAX_BRIGHTNESS);
- Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]);
- aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon());
- if (mIconContainer.getOverlayIcon() != null) {
- Tessellator.instance.setColorOpaque(255, 255, 255);
- aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- aRenderer.enableAO = enableAO;
- }
-
- @Override
- public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API
- if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
- final boolean enableAO = aRenderer.enableAO;
- aRenderer.enableAO = false;
- aRenderer.field_152631_f = true;
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f);
- Tessellator.instance.setBrightness(MAX_BRIGHTNESS);
- Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]);
- aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon());
- if (mIconContainer.getOverlayIcon() != null) {
- Tessellator.instance.setColorOpaque(255, 255, 255);
- aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- aRenderer.field_152631_f = false;
- aRenderer.enableAO = enableAO;
- }
-
- @Override
- public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API
- if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
- final boolean enableAO = aRenderer.enableAO;
- aRenderer.enableAO = false;
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f);
- Tessellator.instance.setBrightness(MAX_BRIGHTNESS);
- Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]);
- aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon());
- if (mIconContainer.getOverlayIcon() != null) {
- aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- aRenderer.enableAO = enableAO;
- }
-
- @Override
- public boolean isValidTexture() {
- return mIconContainer != null;
- }
-}
diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java
index 9e76634385..08ce2125f2 100644
--- a/src/main/java/gregtech/common/render/GT_RenderedTexture.java
+++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java
@@ -1,55 +1,93 @@
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;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.LightingHelper;
import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import static gregtech.api.util.LightingHelper.MAX_BRIGHTNESS;
+
class GT_RenderedTexture implements ITexture, IColorModulationContainer {
protected final IIconContainer mIconContainer;
private final short[] mRGBa;
+ private final boolean glow;
+ private final boolean stdOrient;
+ private final boolean useExtFacing;
- GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) {
+ GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha, boolean glow, boolean stdOrient, boolean extFacing) {
if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture");
mIconContainer = aIcon;
mRGBa = aRGBa;
+ this.glow = glow;
+ this.stdOrient = stdOrient;
+ this.useExtFacing = extFacing;
}
@Override
public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- aRenderer.field_152631_f = true;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f);
+ final boolean enableAO = aRenderer.enableAO;
LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingXPos(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.EAST.ordinal(), mRGBa);
- aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon());
+ if (glow) {
+ if (aRenderer.useInventoryTint)
+ return; // TODO: Remove this once all addons have migrated to the new Texture API
+ if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
+ aRenderer.enableAO = false;
+ lighting.setLightnessOverride(1.0F);
+ if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS);
+ }
+ lighting.setupLightingXPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.EAST.ordinal(), mRGBa);
+ ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ);
+ renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation);
if (mIconContainer.getOverlayIcon() != null) {
lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff);
- aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
+ renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation);
}
+ aRenderer.enableAO = enableAO;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//draw(aRenderer);
- aRenderer.field_152631_f = false;
}
@Override
public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
// TODO: Uncomment this once all addons have migrated to the new Texture API
//startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f);
+ final boolean enableAO = aRenderer.enableAO;
LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingXNeg(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.WEST.ordinal(), mRGBa);
- aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon());
+ if (glow) {
+ if (aRenderer.useInventoryTint)
+ return; // TODO: Remove this once all addons have migrated to the new Texture API
+ if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
+ aRenderer.enableAO = false;
+ lighting.setLightnessOverride(1.0F);
+ if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS);
+ }
+ lighting.setupLightingXNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.WEST.ordinal(), mRGBa);
+ ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ);
+ renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation);
if (mIconContainer.getOverlayIcon() != null) {
lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff);
- aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
+ renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation);
}
+ aRenderer.enableAO = enableAO;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//draw(aRenderer);
}
@@ -58,14 +96,24 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
// TODO: Uncomment this once all addons have migrated to the new Texture API
//startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f);
+ final boolean enableAO = aRenderer.enableAO;
LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingYPos(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.UP.ordinal(), mRGBa);
- aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon());
+ if (glow) {
+ if (aRenderer.useInventoryTint)
+ return; // TODO: Remove this once all addons have migrated to the new Texture API
+ if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
+ aRenderer.enableAO = false;
+ lighting.setLightnessOverride(1.0F);
+ if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS);
+ }
+ lighting.setupLightingYPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.UP.ordinal(), mRGBa);
+ ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ);
+ renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation);
if (mIconContainer.getOverlayIcon() != null) {
lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff);
- aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
+ renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation);
}
+ aRenderer.enableAO = enableAO;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//draw(aRenderer);
}
@@ -74,96 +122,24 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
// TODO: Uncomment this once all addons have migrated to the new Texture API
//startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f);
- final Tessellator tessellator = Tessellator.instance;
- IIcon aIcon = mIconContainer.getIcon();
-
- float minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D);
- float maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D);
- float minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
- float maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
-
- if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
- minU = 16.0F - aIcon.getMaxU();
- maxU = 16.0F - aIcon.getMinU();
- }
-
- if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) {
- minV = aIcon.getMinV();
- maxV = aIcon.getMaxV();
- }
-
- double minX = aX + aRenderer.renderMinX;
- double maxX = aX + aRenderer.renderMaxX;
- double minY = aY + aRenderer.renderMinY;
- double minZ = aZ + aRenderer.renderMinZ;
- double maxZ = aZ + aRenderer.renderMaxZ;
-
+ final boolean enableAO = aRenderer.enableAO;
LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingYNeg(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa);
-
- if (aRenderer.enableAO) {
- tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft);
- tessellator.setBrightness(aRenderer.brightnessTopLeft);
- tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
- tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft);
- tessellator.setBrightness(aRenderer.brightnessBottomLeft);
- tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV);
- tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight);
- tessellator.setBrightness(aRenderer.brightnessBottomRight);
- tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV);
- tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight);
- tessellator.setBrightness(aRenderer.brightnessTopRight);
- } else {
- tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
- tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV);
- tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV);
- }
- tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV);
-
+ if (glow) {
+ if (aRenderer.useInventoryTint)
+ return; // TODO: Remove this once all addons have migrated to the new Texture API
+ if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
+ aRenderer.enableAO = false;
+ lighting.setLightnessOverride(1.0F);
+ if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS);
+ }
+ lighting.setupLightingYNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.DOWN.ordinal(), mRGBa);
+ ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ);
+ renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation);
if (mIconContainer.getOverlayIcon() != null) {
- minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D);
- maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D);
- minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
- maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
-
- if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
- minU = 16.0F - aIcon.getMaxU();
- maxU = 16.0F - aIcon.getMinU();
- }
-
- if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) {
- minV = aIcon.getMinV();
- maxV = aIcon.getMaxV();
- }
-
- minX = aX + (float)aRenderer.renderMinX;
- maxX = aX + (float)aRenderer.renderMaxX;
- minY = aY + (float)aRenderer.renderMinY;
- minZ = aZ + (float)aRenderer.renderMinZ;
- maxZ = aZ + (float)aRenderer.renderMaxZ;
-
- lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff);
-
- if (aRenderer.enableAO) {
- tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft);
- tessellator.setBrightness(aRenderer.brightnessTopLeft);
- tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
- tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft);
- tessellator.setBrightness(aRenderer.brightnessBottomLeft);
- tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV);
- tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight);
- tessellator.setBrightness(aRenderer.brightnessBottomRight);
- tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV);
- tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight);
- tessellator.setBrightness(aRenderer.brightnessTopRight);
- } else {
- tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
- tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV);
- tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV);
- }
- tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV);
+ Tessellator.instance.setColorRGBA(255, 255, 255, 255);
+ renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation);
}
+ aRenderer.enableAO = enableAO;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//draw(aRenderer);
}
@@ -172,14 +148,24 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
// TODO: Uncomment this once all addons have migrated to the new Texture API
//startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f);
+ final boolean enableAO = aRenderer.enableAO;
LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingZPos(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa);
- aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon());
+ if (glow) {
+ if (aRenderer.useInventoryTint)
+ return; // TODO: Remove this once all addons have migrated to the new Texture API
+ if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
+ aRenderer.enableAO = false;
+ lighting.setLightnessOverride(1.0F);
+ if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS);
+ }
+ lighting.setupLightingZPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa);
+ ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ);
+ renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation);
if (mIconContainer.getOverlayIcon() != null) {
lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff);
- aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
+ renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation);
}
+ aRenderer.enableAO = enableAO;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//draw(aRenderer);
}
@@ -188,18 +174,26 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
// TODO: Uncomment this once all addons have migrated to the new Texture API
//startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f);
- aRenderer.field_152631_f = true;
+ final boolean enableAO = aRenderer.enableAO;
LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingZNeg(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.NORTH.ordinal(), mRGBa);
- aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon());
+ if (glow) {
+ if (aRenderer.useInventoryTint)
+ return; // TODO: Remove this once all addons have migrated to the new Texture API
+ if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return;
+ aRenderer.enableAO = false;
+ lighting.setLightnessOverride(1.0F);
+ if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS);
+ }
+ lighting.setupLightingZNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.NORTH.ordinal(), mRGBa);
+ ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ);
+ renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation);
if (mIconContainer.getOverlayIcon() != null) {
lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff);
- aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
+ renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation);
}
+ aRenderer.enableAO = enableAO;
// TODO: Uncomment this once all addons have migrated to the new Texture API
//draw(aRenderer);
- aRenderer.field_152631_f = false;
}
@Override
@@ -211,4 +205,178 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer {
public boolean isValidTexture() {
return mIconContainer != null;
}
+
+ /**
+ * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture
+ */
+ protected void renderFaceYNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing extendedFacing) {
+
+ switch (useExtFacing ? extendedFacing.getRotation() : Rotation.NORMAL) {
+ case COUNTER_CLOCKWISE:
+ aRenderer.uvRotateBottom = 2;
+ break;
+ case CLOCKWISE:
+ aRenderer.uvRotateBottom = 1;
+ break;
+ case UPSIDE_DOWN:
+ aRenderer.uvRotateBottom = 3;
+ break;
+ default:
+ aRenderer.uvRotateBottom = 0;
+ break;
+ }
+
+ Flip aFlip = extendedFacing.getFlip();
+ 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;
+ }
+
+ /**
+ * Renders the given texture to the top face of the block. Args: block, x, y, z, texture
+ */
+ protected void renderFaceYPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing extendedFacing) {
+
+ switch (useExtFacing ? extendedFacing.getRotation() : Rotation.NORMAL) {
+ case COUNTER_CLOCKWISE:
+ aRenderer.uvRotateTop = 2;
+ break;
+ case CLOCKWISE:
+ aRenderer.uvRotateTop = 1;
+ break;
+ case UPSIDE_DOWN:
+ aRenderer.uvRotateTop = 3;
+ break;
+ default:
+ aRenderer.uvRotateTop = 0;
+ break;
+ }
+
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceYPos(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.uvRotateTop = 0;
+ }
+
+ /**
+ * Renders the given texture to the north (z-negative) face of the block. Args: block, x, y, z, texture
+ */
+ protected void renderFaceZNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing extendedFacing) {
+ aRenderer.field_152631_f = true;
+ // **NOT A BUG**: aRenderer.uvRotateEast REALLY CONTROLS THE ROTATION OF THE NORTH SIDE
+ switch (useExtFacing ? extendedFacing.getRotation() : Rotation.NORMAL) {
+ case COUNTER_CLOCKWISE:
+ aRenderer.uvRotateEast = 2;
+ break;
+ case CLOCKWISE:
+ aRenderer.uvRotateEast = 1;
+ break;
+ case UPSIDE_DOWN:
+ aRenderer.uvRotateEast = 3;
+ break;
+ default:
+ aRenderer.uvRotateEast = 0;
+ break;
+ }
+
+ Flip aFlip = extendedFacing.getFlip();
+ 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;
+ }
+
+ /**
+ * Renders the given texture to the south (z-positive) face of the block. Args: block, x, y, z, texture
+ */
+ protected void renderFaceZPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing extendedFacing) {
+ // **NOT A BUG**: aRenderer.uvRotateWest REALLY CONTROLS THE ROTATION OF THE SOUTH SIDE
+ switch (useExtFacing ? extendedFacing.getRotation() : Rotation.NORMAL) {
+ case COUNTER_CLOCKWISE:
+ aRenderer.uvRotateWest = 2;
+ break;
+ case CLOCKWISE:
+ aRenderer.uvRotateWest = 1;
+ break;
+ case UPSIDE_DOWN:
+ aRenderer.uvRotateWest = 3;
+ break;
+ default:
+ aRenderer.uvRotateWest = 0;
+ break;
+ }
+
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceZPos(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.uvRotateWest = 0;
+ }
+
+ /**
+ * Renders the given texture to the west (x-negative) face of the block. Args: block, x, y, z, texture
+ */
+ protected void renderFaceXNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing extendedFacing) {
+ // **NOT A BUG**: aRenderer.uvRotateNorth REALLY CONTROLS THE ROTATION OF THE WEST SIDE
+ switch (useExtFacing ? extendedFacing.getRotation() : Rotation.NORMAL) {
+ case COUNTER_CLOCKWISE:
+ aRenderer.uvRotateNorth = 2;
+ break;
+ case CLOCKWISE:
+ aRenderer.uvRotateNorth = 1;
+ break;
+ case UPSIDE_DOWN:
+ aRenderer.uvRotateNorth = 3;
+ break;
+ default:
+ aRenderer.uvRotateNorth = 0;
+ break;
+ }
+
+ Flip aFlip = extendedFacing.getFlip();
+ aRenderer.renderFaceXNeg(Blocks.air, x, y, z, useExtFacing && GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped ? new GT_IconFlipped(icon, aFlip.isHorizontallyFlipped(), aFlip.isVerticallyFliped()) : icon);
+ aRenderer.uvRotateNorth = 0;
+ }
+
+ /**
+ * Renders the given texture to the east (x-positive) face of the block. Args: block, x, y, z, texture
+ */
+ protected void renderFaceXPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing extendedFacing) {
+ aRenderer.field_152631_f = true;
+ // **NOT A BUG**: aRenderer.uvRotateSouth REALLY CONTROLS THE ROTATION OF THE EAST SIDE
+ switch (useExtFacing ? extendedFacing.getRotation() : Rotation.NORMAL) {
+ case COUNTER_CLOCKWISE:
+ aRenderer.uvRotateSouth = 2;
+ break;
+ case CLOCKWISE:
+ aRenderer.uvRotateSouth = 1;
+ break;
+ case UPSIDE_DOWN:
+ aRenderer.uvRotateSouth = 3;
+ break;
+ default:
+ aRenderer.uvRotateSouth = 0;
+ break;
+ }
+
+ Flip aFlip = extendedFacing.getFlip();
+ 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;
+ }
+
+ private ExtendedFacing getExtendedFacing(int x, int y, int z) {
+ if (stdOrient) return ExtendedFacing.DEFAULT;
+ EntityPlayer player = GT_Mod.gregtechproxy.getThePlayer();
+ if (player == null) return ExtendedFacing.DEFAULT;
+ World w = player.getEntityWorld();
+ if (w == null) return ExtendedFacing.DEFAULT;
+ TileEntity te = w.getTileEntity(x, y, z);
+ if (te instanceof IGregTechTileEntity) {
+ IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity();
+ if (meta instanceof IAlignmentProvider) {
+ return ((IAlignmentProvider) meta).getAlignment().getExtendedFacing();
+ } else if (meta != null) {
+ return ExtendedFacing.of(ForgeDirection.getOrientation(meta.getBaseMetaTileEntity().getFrontFacing()));
+ }
+ } else if (te instanceof IAlignmentProvider) {
+ return ((IAlignmentProvider) te).getAlignment().getExtendedFacing();
+ }
+ return ExtendedFacing.DEFAULT;
+ }
}
diff --git a/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java b/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java
deleted file mode 100644
index ba0f9d3a91..0000000000
--- a/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package gregtech.common.render;
-
-import gregtech.api.interfaces.IIconContainer;
-import gregtech.api.util.LightingHelper;
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraftforge.common.util.ForgeDirection;
-
-/**
- * This ITexture implementation extends the GT_RenderedTexture class
- * to render with bottom side flipped as with dumb blocks rendering.
- * It is used in Ore blocks rendering so they better blends with dumb block ores
- * from vanilla or other mods, when seen from bottom.
- */
-class GT_StdRenderedTexture extends GT_RenderedTexture{
-
- GT_StdRenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) {
- super(aIcon, aRGBa, allowAlpha);
- }
-
- @Override
- public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f);
- LightingHelper lighting = new LightingHelper(aRenderer);
- lighting.setupLightingYNeg(aBlock, aX, aY, aZ)
- .setupColor(ForgeDirection.DOWN.ordinal(), getRGBA());
- aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon());
- if (mIconContainer.getOverlayIcon() != null) {
- lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff);
- aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon());
- }
- // TODO: Uncomment this once all addons have migrated to the new Texture API
- //draw(aRenderer);
- }
-}
diff --git a/src/main/java/gregtech/common/render/GT_TextureBuilder.java b/src/main/java/gregtech/common/render/GT_TextureBuilder.java
index 22446f99a5..82bce4c8c4 100644
--- a/src/main/java/gregtech/common/render/GT_TextureBuilder.java
+++ b/src/main/java/gregtech/common/render/GT_TextureBuilder.java
@@ -21,6 +21,7 @@ public class GT_TextureBuilder implements ITextureBuilder {
private short[] rgba;
private boolean allowAlpha;
private boolean stdOrient;
+ private boolean extFacing;
private boolean glow;
public GT_TextureBuilder() {
@@ -77,6 +78,12 @@ public class GT_TextureBuilder implements ITextureBuilder {
}
@Override
+ public ITextureBuilder extFacing() {
+ this.extFacing = true;
+ return this;
+ }
+
+ @Override
public ITextureBuilder glow() {
glow = true;
return this;
@@ -88,9 +95,7 @@ public class GT_TextureBuilder implements ITextureBuilder {
if (!textureLayers.isEmpty()) return new GT_MultiTexture(textureLayers.toArray(new ITexture[0]));
switch (iconContainerList.size()) {
case 1:
- if (stdOrient) return new GT_StdRenderedTexture(iconContainerList.get(0), rgba, allowAlpha);
- if (glow) return new GT_RenderedGlowTexture(iconContainerList.get(0), rgba, allowAlpha);
- return new GT_RenderedTexture(iconContainerList.get(0), rgba, allowAlpha);
+ return new GT_RenderedTexture(iconContainerList.get(0), rgba, allowAlpha, glow, stdOrient, extFacing);
case 6:
return new GT_SidedTexture(
iconContainerList.get(ForgeDirection.DOWN.ordinal()),
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
index 3830cd3497..774639401a 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
@@ -124,20 +124,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer {
@Override
protected void fillStacksIntoFirstSlots() {
sortStacks();
- // Merge small stacks together
- for (int i = 0; i < this.mInventory.length-1;) {
- //GT_FML_LOGGER.info( (this.mInventory[i] == null) ? "Slot empty " + i : "Slot " + i + " holds " + this.mInventory[i].getDisplayName());
- for (int j = i + 1; j < this.mInventory.length; j++) {
- if ((this.mInventory[j] != null) && ((GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) {
- GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
- //GT_FML_LOGGER.info( "Moving slot " + j + " into slot " + i );
- }
- else {
- i=j;
- break; // No more matching items for this i, do next i
- }
- }
- }
+ super.fillStacksIntoFirstSlots();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
index d3b124b79f..a796ce9661 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
@@ -50,19 +50,6 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer
}
@Override
- protected void fillStacksIntoFirstSlots() {
- for (int i = 0; i < this.mInventory.length - 1; i++) {
- for (int j = i + 1; j < this.mInventory.length - 1; j++) {
- if ((this.mInventory[j] != null)
- && ((this.mInventory[i] == null) || (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) {
- GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1,
- (byte) 64, (byte) 1);
- }
- }
- }
- }
-
- @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java
index 7cef8278be..4fb9deb5b4 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java
@@ -8,7 +8,10 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.*;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.WorldSpawnedEventBuilder;
import gregtech.common.GT_Pollution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -28,6 +31,8 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
public boolean mHadNoWater = false;
private int mExcessWater = 0;
+ public static final byte SOUND_EVENT_LET_OFF_EXCESS_STEAM = 1;
+
public GT_MetaTileEntity_Boiler(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures);
}
@@ -106,7 +111,10 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
if (aPlayer != null) {
if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) {
fill(Materials.Water.getFluid(1000L * (long) aPlayer.getCurrentEquippedItem().stackSize), true);
- aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket);
+
+ if (!aPlayer.capabilities.isCreativeMode) {
+ aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket);
+ }
} else {
aBaseMetaTileEntity.openGUI(aPlayer);
}
@@ -243,7 +251,7 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
}
private void calculateHeatUp(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if ((this.mTemperature < getMaxTemperature()) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) {
+ if ((this.mTemperature < getMaxTemperature()) && (this.mProcessingEnergy > 0) && (aTick % getHeatUpRate() == 0L)) {
this.mProcessingEnergy -= getEnergyConsumption();
this.mTemperature += getHeatUpAmount();
}
@@ -257,7 +265,7 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
private void ventSteamIfTankIsFull() {
if ((this.mSteam != null) && (this.mSteam.amount > getCapacity())) {
- sendSound((byte) 1);
+ sendSound(SOUND_EVENT_LET_OFF_EXCESS_STEAM);
this.mSteam.amount = getCapacity() * 3 / 4;
}
}
@@ -272,8 +280,8 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
this.mHadNoWater = true;
} else {
if (this.mHadNoWater) {
- GT_Log.exp.println("Boiler "+this.mName+" had no Water!");
- aBaseMetaTileEntity.doExplosion(2048L);
+ GT_Log.exp.println("Boiler " + this.mName + " had no Water!");
+ onDangerousWaterLack(aBaseMetaTileEntity, aTick);
return true;
}
produceSteam(getProductionPerSecond() / 2);
@@ -284,6 +292,10 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
return false;
}
+ protected void onDangerousWaterLack(IGregTechTileEntity tile, long ticks) {
+ tile.doExplosion(2048L);
+ }
+
protected final void pushSteamToSide(IGregTechTileEntity aBaseMetaTileEntity, int aSide) {
IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide((byte) aSide);
if (tTileEntity == null)
@@ -329,13 +341,13 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
@Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
- if (aIndex == 1) {
+ if (aIndex == GT_MetaTileEntity_Boiler.SOUND_EVENT_LET_OFF_EXCESS_STEAM) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 2, 1.0F, aX, aY, aZ);
new WorldSpawnedEventBuilder.ParticleEventBuilder()
.setIdentifier("largesmoke")
.setWorld(getBaseMetaTileEntity().getWorld())
- .setMotion(0D,0D,0D)
+ .setMotion(0D, 0D, 0D)
.<WorldSpawnedEventBuilder.ParticleEventBuilder>times(8, x -> x
.setPosition(
aX - 0.5D + XSTR_INSTANCE.nextFloat(),
@@ -370,6 +382,10 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
protected abstract int getCooldownInterval();
+ protected int getHeatUpRate() {
+ return 12;
+ }
+
protected int getHeatUpAmount() {
return 1;
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
index 5a89f50476..41620dd711 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
@@ -76,12 +76,12 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler {
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 16000);
+ return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "BronzeBoiler.png", 16000);
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "BronzeBoiler.png");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java
index c71126b146..aeb0a66173 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java
@@ -78,12 +78,17 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler {
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 32000);
+ return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000);
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png");
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
}
@Override
@@ -122,6 +127,10 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler {
this.mProcessingEnergy += 1000 * ENERGY_PER_LAVA;
aBaseMetaTileEntity.decrStackSize(2, 1);
aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L));
+ } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucketClay.get(Materials.Lava))) {
+ this.mProcessingEnergy += 1000 * ENERGY_PER_LAVA;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ // Clay lava buckets break, so you don't get it back.
}
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java
index 59f84ebd91..5723865baf 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java
@@ -114,12 +114,12 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler {
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, getCapacity());
+ return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", getCapacity());
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java
index ff77b049c4..e044b6fb9b 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java
@@ -56,7 +56,7 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarHPBoiler.png", getCapacity());
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarHPBoiler.png");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java
index 50f68425d7..ab51156868 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java
@@ -66,12 +66,12 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bro
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 32000);
+ return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000);
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
index 12d839d221..6b1ee8c941 100644
--- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
+++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
@@ -2,7 +2,6 @@ package gregtech.common.tileentities.machines;
import appeng.api.AEApi;
import appeng.api.networking.GridFlags;
-import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.MachineSource;
@@ -21,8 +20,11 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH;
@@ -30,6 +32,10 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH;
public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatch_OutputBus {
private BaseActionSource requestSource = null;
private AENetworkProxy gridProxy = null;
+ ItemStack cachedStack = null;
+ long lastOutputTick = 0;
+ long tickCounter = 0;
+ boolean lastOutputFailed = false;
public GT_MetaTileEntity_Hatch_OutputBus_ME(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 1, new String[]{
@@ -37,7 +43,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc
}
public GT_MetaTileEntity_Hatch_OutputBus_ME(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aDescription, 0, aTextures);
+ super(aName, aTier, 0, aDescription, aTextures);
}
@Override
@@ -65,12 +71,16 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc
public boolean storeAll(ItemStack aStack) {
if (!GregTech_API.mAE2)
return false;
- int tTotal = aStack.stackSize;
- int tStored = store(aStack);
- aStack.stackSize -= tStored;
- return tTotal == tStored;
+ aStack.stackSize = store(aStack);
+ return aStack.stackSize == 0;
}
+ /**
+ * Attempt to store items in connected ME network. Returns how many items did not fit (if the network was down e.g.)
+ *
+ * @param stack input stack
+ * @return amount of items left over
+ */
@Optional.Method(modid = "appliedenergistics2")
public int store(final ItemStack stack) {
if (stack == null)
@@ -78,17 +88,66 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc
try {
AENetworkProxy proxy = getProxy();
if (proxy == null)
- return stack.stackSize;
- IMEMonitor<IAEItemStack> sg = proxy.getStorage().getItemInventory();
- final IEnergySource src = proxy.getEnergy();
- IAEItemStack toStore = AEApi.instance().storage().createItemStack(stack);
- IAEItemStack rest = Platform.poweredInsert( src, sg, toStore, getRequest());
- if (rest != null)
- return (int)rest.getStackSize();
+ {
+ lastOutputFailed = true;
+ int cacheSize = cachedStack == null ? 0 : cachedStack.stackSize;
+ cachedStack = null;
+ return stack.stackSize + cacheSize;
+ }
+ if (lastOutputFailed) // if last output failed, don't buffer
+ {
+ IMEMonitor<IAEItemStack> sg = proxy.getStorage().getItemInventory();
+ IAEItemStack toStore = AEApi.instance().storage().createItemStack(stack);
+ IAEItemStack rest = Platform.poweredInsert(proxy.getEnergy(), sg, toStore, getRequest());
+ if (rest != null && rest.getStackSize() > 0)
+ return (int) rest.getStackSize();
+ else
+ lastOutputFailed = false;
+ }
+ else if (cachedStack != null && ((tickCounter > (lastOutputTick+20)) || !cachedStack.isItemEqual(stack)))
+ {
+ lastOutputTick = tickCounter;
+ boolean sameStack = cachedStack.isItemEqual(stack);
+ if (sameStack)
+ cachedStack.stackSize += stack.stackSize;
+ IMEMonitor<IAEItemStack> sg = proxy.getStorage().getItemInventory();
+ IAEItemStack toStore = AEApi.instance().storage().createItemStack(cachedStack);
+ IAEItemStack rest = Platform.poweredInsert(proxy.getEnergy(), sg, toStore, getRequest());
+ if (rest != null && rest.getStackSize() > 0)
+ {
+ lastOutputFailed = true;
+ if (sameStack) // return all that was cached to sender
+ {
+ cachedStack = null;
+ return (int) rest.getStackSize();
+ }
+ else // leave the cache, and return input to sender
+ {
+ cachedStack.stackSize = (int)rest.getStackSize();
+ return stack.stackSize;
+ }
+ }
+ else
+ {
+ if (!sameStack)
+ cachedStack = stack.copy();
+ else
+ cachedStack = null;
+ return 0;
+ }
+ }
+ else
+ {
+ if (cachedStack == null)
+ cachedStack = stack.copy();
+ else
+ cachedStack.stackSize += stack.stackSize;
+ }
return 0;
}
catch( final GridAccessException ignored )
{
+ lastOutputFailed = true;
}
return stack.stackSize;
}
@@ -128,4 +187,63 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc
@Optional.Method(modid = "appliedenergistics2")
public void gridChanged() {
}
+
+ @Optional.Method(modid = "appliedenergistics2")
+ private void flushCachedStack()
+ {
+ if (cachedStack == null)
+ return;
+ AENetworkProxy proxy = getProxy();
+ if (proxy == null) {
+ lastOutputFailed = true;
+ return;
+ }
+ try {
+ IMEMonitor<IAEItemStack> sg = proxy.getStorage().getItemInventory();
+ IAEItemStack toStore = AEApi.instance().storage().createItemStack(cachedStack);
+ IAEItemStack rest = Platform.poweredInsert(proxy.getEnergy(), sg, toStore, getRequest());
+ if (rest != null && rest.getStackSize() > 0) {
+ lastOutputFailed = true;
+ cachedStack.stackSize = (int) rest.getStackSize();
+ }
+ else
+ cachedStack = null;
+ }
+ catch( final GridAccessException ignored )
+ {
+ lastOutputFailed = true;
+ }
+ lastOutputTick = tickCounter;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ tickCounter = aTick;
+ if (tickCounter > (lastOutputTick + 40))
+ flushCachedStack();
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT)
+ {
+ super.saveNBTData(aNBT);
+ if (cachedStack != null) {
+ NBTTagCompound tTag = new NBTTagCompound();
+ cachedStack.writeToNBT(tTag);
+ aNBT.setTag("cachedStack", tTag);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ NBTBase t = aNBT.getTag("cachedStack");
+ if (t instanceof NBTTagCompound)
+ cachedStack = GT_Utility.loadItem((NBTTagCompound)t);
+ }
+
+ public boolean isLastOutputFailed() {
+ return lastOutputFailed;
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index b820dd44fd..b79869497a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -19,18 +19,13 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import gregtech.api.util.extensions.ArrayExt;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@@ -172,9 +167,6 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi
)
return DID_NOT_FIND_RECIPE;
- if (checkTier(is))
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
-
Integer handleHardOverride = handleHardOverride(is);
if (handleHardOverride != null)
return handleHardOverride;
@@ -234,24 +226,38 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi
if (GT_Utility.isStackInvalid(recipe.inputs[i]) || recipe.inputs[i].stackSize < 1)
recipe.inputs[i] = null;
- recipe.inputs = GT_Utility.getArrayListWithoutNulls(recipe.inputs).toArray(new ItemStack[0]);
+ recipe.inputs = ArrayExt.withoutNulls(recipe.inputs, ItemStack[]::new);
}
private int checkRecipeMap() {
GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs());
if (gt_recipe == null)
return DID_NOT_FIND_RECIPE;
- if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs()))
- return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize)
- ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
- : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs())) {
+ if (gt_recipe.mSpecialValue == -100) {
+ // Bypass standard disassembler restrictions.
+ this.getInputAt(0).stackSize -= gt_recipe.mInputs[0].stackSize;
+ System.arraycopy(gt_recipe.mOutputs, 0, this.mOutputItems, 0, gt_recipe.mOutputs.length);
+
+ this.calculateOverclockedNess(gt_recipe);
+ return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
+ } else {
+ return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize)
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+ }
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
}
private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize){
- if (this.getInputAt(0).stackSize >= stackSize)
- this.getInputAt(0).stackSize -= stackSize;
+ ItemStack machineInput = this.getInputAt(0);
+ if (checkTier(machineInput))
+ return false;
+
+ if (machineInput.stackSize >= stackSize)
+ machineInput.stackSize -= stackSize;
else
return false;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
index 01f136747c..803bc7e163 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
@@ -87,9 +87,9 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
public String[] getInfoData() {
return new String[]{
"Coordinates:",
- "X: "+EnumChatFormatting.GREEN+ this.mTargetX+EnumChatFormatting.RESET,
- "Y: "+EnumChatFormatting.GREEN+ this.mTargetY+EnumChatFormatting.RESET,
- "Z: "+EnumChatFormatting.GREEN+ this.mTargetZ+EnumChatFormatting.RESET,
+ "X: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetX) + EnumChatFormatting.RESET,
+ "Y: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetY) + EnumChatFormatting.RESET,
+ "Z: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetZ) + EnumChatFormatting.RESET,
"Dimension: " + EnumChatFormatting.GREEN+this.mTargetD+EnumChatFormatting.RESET,
"Dimension Valid: " + (GT_Utility.isRealDimension(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET),
"Dimension Registered: " + (DimensionManager.isDimensionRegistered(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET)
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index e1dfc32aba..431241eb84 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -366,7 +366,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
private boolean hasValidFluid() {
- return (!GT_Utility.isBlockInvalid(this.mPrimaryPumpedBlock) && !GT_Utility.isBlockInvalid(this.mSecondaryPumpedBlock));
+ return mPrimaryPumpedBlock != null && mSecondaryPumpedBlock != null;
}
private boolean moveOneDown() {
@@ -522,7 +522,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
return;
Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
- if (GT_Utility.isBlockValid(aBlock)) {
+ if (aBlock != null) {
if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) {
this.mPrimaryPumpedBlock = Blocks.water;
this.mSecondaryPumpedBlock = Blocks.flowing_water;
@@ -549,7 +549,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
- return GT_Utility.isBlockValid(aBlock) &&
+ return aBlock != null &&
(aBlock == Blocks.water ||
aBlock == Blocks.flowing_water ||
aBlock == Blocks.lava ||
@@ -565,7 +565,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
- if ((GT_Utility.isBlockValid(aBlock)) && ((this.mPrimaryPumpedBlock == aBlock) || (this.mSecondaryPumpedBlock == aBlock))) {
+ if (aBlock != null && ((this.mPrimaryPumpedBlock == aBlock) || (this.mSecondaryPumpedBlock == aBlock))) {
boolean isWaterOrLava = ((this.mPrimaryPumpedBlock == Blocks.water || this.mPrimaryPumpedBlock == Blocks.lava));
if (isWaterOrLava && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) != 0) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
index 11430c6862..eba61ad1b1 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
@@ -86,7 +86,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine {
if (tIndividual != null) {
if (tIndividual.analyze()) {
getFillableStack().amount -= 100;
- this.mOutputItems[0] = GT_Utility.copy(aStack);
+ this.mOutputItems[0] = GT_Utility.copyOrNull(aStack);
aStack.stackSize = 0;
NBTTagCompound tNBT = new NBTTagCompound();
tIndividual.writeToNBT(tNBT);
@@ -97,7 +97,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine {
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
return 2;
}
- this.mOutputItems[0] = GT_Utility.copy(aStack);
+ this.mOutputItems[0] = GT_Utility.copyOrNull(aStack);
aStack.stackSize = 0;
this.mMaxProgresstime = 1;
this.mEUt = 1;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java
index 7d6c0a29ed..eb59f1f7e5 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java
@@ -188,9 +188,9 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
public String[] getInfoData() {
return new String[]{
"Coordinates:",
- "X: "+ EnumChatFormatting.GREEN+ this.mTargetX+EnumChatFormatting.RESET,
- "Y: "+EnumChatFormatting.GREEN+ this.mTargetY+EnumChatFormatting.RESET,
- "Z: "+EnumChatFormatting.GREEN+ this.mTargetZ+EnumChatFormatting.RESET,
+ "X: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetX) + EnumChatFormatting.RESET,
+ "Y: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetY) + EnumChatFormatting.RESET,
+ "Z: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetZ) + EnumChatFormatting.RESET,
"Dimension: " + EnumChatFormatting.GREEN+this.mTargetD+EnumChatFormatting.RESET,
"Dimension Valid: " + (GT_Utility.isRealDimension(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET),
"Dimension Registered: " + (DimensionManager.isDimensionRegistered(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET)
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 1ac4df6d73..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,16 +1,13 @@
package gregtech.common.tileentities.machines.multi;
-import gregtech.api.GregTech_API;
import gregtech.api.enums.HeatingCoilLevel;
-import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import net.minecraft.block.Block;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase;
import net.minecraft.item.ItemStack;
-public abstract class GT_MetaTileEntity_AbstractMultiFurnace extends GT_MetaTileEntity_MultiBlockBase {
+public abstract class GT_MetaTileEntity_AbstractMultiFurnace<T extends GT_MetaTileEntity_AbstractMultiFurnace<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> {
- private static final int CASING_INDEX = 11;
+ private HeatingCoilLevel mCoilLevel;
protected GT_MetaTileEntity_AbstractMultiFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -25,55 +22,11 @@ public abstract class GT_MetaTileEntity_AbstractMultiFurnace extends GT_MetaTile
return true;
}
- @Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- protected HeatingCoilLevel getInitialHeatLevel(IGregTechTileEntity aBaseMetaTileEntity, int xDir, int zDir) {
- Block coil = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 1, zDir);
- if (!(coil instanceof IHeatingCoil))
- return null;
- IHeatingCoil heatingCoil = (IHeatingCoil) coil;
- byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir);
- return heatingCoil.getCoilHeat(tUsedMeta);
- }
-
- protected boolean checkStructure(HeatingCoilLevel heatingCap, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity){
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if (!checkTopLayer(i, j, xDir, zDir, aBaseMetaTileEntity))
- return false;
-
- if (!checkBottomLayer(i, j, xDir, zDir, aBaseMetaTileEntity))
- return false;
-
- if (!checkCoils(heatingCap, i, j, xDir, zDir, aBaseMetaTileEntity))
- return false;
- }
- }
- return true;
- }
-
- protected abstract boolean checkTopLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity);
- protected abstract boolean checkCoils(HeatingCoilLevel heatingCap, int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity);
-
- protected boolean checkBottomLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity){
- if ((xDir + i == 0) && (zDir + j == 0))
- return true;
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
- return true;
- if (addInputToMachineList(tTileEntity, CASING_INDEX))
- return true;
- if (addOutputToMachineList(tTileEntity, CASING_INDEX))
- return true;
- if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
- return true;
-
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1)
- return false;
- return aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) == CASING_INDEX;
+ protected boolean addBottomHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex) ||
+ addInputToMachineList(aTileEntity, aBaseCasingIndex) ||
+ addOutputToMachineList(aTileEntity, aBaseCasingIndex) ||
+ addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex);
}
@Override
@@ -95,4 +48,12 @@ public abstract class GT_MetaTileEntity_AbstractMultiFurnace extends GT_MetaTile
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
+
+ public HeatingCoilLevel getCoilLevel() {
+ return mCoilLevel;
+ }
+
+ public void setCoilLevel(HeatingCoilLevel aCoilLevel) {
+ mCoilLevel = aCoilLevel;
+ }
}
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..e9608fce29 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<GT_MetaTileEntity_AssemblyLine> {
public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> 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<GT_MetaTileEntity_AssemblyLine> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_AssemblyLine>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, 2, GregTech_API.sBlockCasings3, 10))
+ .addElement('b', ofChain(
+ 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, 4),
+ ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16,4)
+ ))
+ .addElement('i', ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addInputToMachineList, 16, 5))
+ .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")
@@ -64,21 +111,16 @@ public class GT_MetaTileEntity_AssemblyLine
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -87,12 +129,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]};
}
@@ -113,11 +155,6 @@ public class GT_MetaTileEntity_AssemblyLine
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- @Override
public boolean checkRecipe(ItemStack aStack) {
if (GT_Values.D1)
GT_FML_LOGGER.info("Start ALine recipe check");
@@ -204,13 +241,19 @@ public class GT_MetaTileEntity_AssemblyLine
if (!tTag.hasKey("time"))
continue;
- mMaxProgresstime = tTag.getInteger("time");
- if (mMaxProgresstime <= 0)
+ int tMaxProgressTime = tTag.getInteger("time");
+ if (tMaxProgressTime <= 0)
continue;
if (!tTag.hasKey("eu"))
continue;
- mEUt = tTag.getInteger("eu");
+
+ calculateOverclockedNessMulti(tTag.getInteger("eu"), tMaxProgressTime, 1, getMaxInputVoltage());
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) {
+ if (GT_Values.D1) GT_FML_LOGGER.info("Recipe too OP");
+ continue;
+ }
if (GT_Values.D1) GT_FML_LOGGER.info("Find avaiable recipe");
findRecipe = true;
@@ -236,22 +279,8 @@ public class GT_MetaTileEntity_AssemblyLine
}
if (GT_Values.D1) GT_FML_LOGGER.info("Check overclock");
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
- if (mEUt <= 16) {
- this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
- } else {
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
- }
- if (this.mEUt > 0) {
- this.mEUt = -this.mEUt;
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
updateSlots();
if (GT_Values.D1)
GT_FML_LOGGER.info("Recipe sucessfull");
@@ -275,130 +304,24 @@ public class GT_MetaTileEntity_AssemblyLine
}
@Override
+ public IStructureDefinition<GT_MetaTileEntity_AssemblyLine> 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 (!checkPiece(STRUCTURE_PIECE_FIRST, 0, 1, 0))
+ return false;
+ return checkMachine(true) || checkMachine(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();
- }
- }
+ private boolean checkMachine(boolean leftToRight) {
+ for (int i = 1; i < 16; i++) {
+ 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;
}
return false;
}
@@ -443,6 +366,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 +397,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);
+ int tLength = Math.min(stackSize.stackSize + 1, 16);
+ for (int i = 1; i < tLength; i++) {
+ buildPiece(i == 1 ? STRUCTURE_PIECE_SECOND : STRUCTURE_PIECE_LATER, stackSize, hintsOnly, -i, 1, 0);
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
index 6cf19d6867..e486596fe6 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
@@ -190,7 +190,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
++mGlassCount;
} else {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ);
- if ((!this.addMaintenanceToMachineList(tTileEntity, 82)) && (!this.addEnergyInputToMachineList(tTileEntity, 82))) {
+ if ((!this.addMaintenanceToMachineList(tTileEntity, 210)) && (!this.addEnergyInputToMachineList(tTileEntity, 210))) {
if (tBlock instanceof ic2.core.block.BlockIC2Door) {
if ((tMeta & 8) == 0) {
// let's not fiddle with bits anymore.
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java
index a509d35ad3..af1468396b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_ConcreteBackfiller1 extends GT_MetaTileEntity_ConcreteBackfillerBase {
public GT_MetaTileEntity_ConcreteBackfiller1(int aID, String aName, String aNameRegional) {
@@ -15,8 +16,8 @@ public class GT_MetaTileEntity_ConcreteBackfiller1 extends GT_MetaTileEntity_Con
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("Concrete Backfiller");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
index d1f44580c6..05646676e7 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
@@ -6,10 +6,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import static gregtech.api.enums.GT_Values.VN;
-
-import org.lwjgl.input.Keyboard;
-
public class GT_MetaTileEntity_ConcreteBackfiller2 extends GT_MetaTileEntity_ConcreteBackfillerBase {
public GT_MetaTileEntity_ConcreteBackfiller2(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -20,35 +16,8 @@ public class GT_MetaTileEntity_ConcreteBackfiller2 extends GT_MetaTileEntity_Con
}
@Override
- public String[] getDescription() {
- String casings = getCasingBlockItem().get(0).getDisplayName();
-
- final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
- tt.addMachineType("Concrete Backfiller")
- .addInfo("Controller Block for the Advanced Concrete Backfiller")
- .addInfo("Will fill in areas below it with light concrete. This goes through walls")
- .addInfo("Use it to remove any spawning locations beneath your base to reduce lag")
- .addInfo("Will pull back the pipes after it finishes that layer")
- .addInfo("Put Programmed Circuits into a Data Access Hatch to config radius. Buggy")
- .addInfo("Radius = (total config value)x2 blocks. Default 64, Maximum 128")//broken
- .addSeparator()
- .beginStructureBlock(3, 7, 3, false)
- .addController("Front bottom")
- .addStructureInfo(casings + " form the 3x1x3 Base")
- .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)")
- .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top")
- .addEnergyHatch(VN[getMinTier()] + "+, Any base casing")
- .addMaintenanceHatch("Any base casing")
- .addStructureInfo("Data Access Hatch: Any base casing")
- .addInputBus("Mining Pipes, optional, any base casing")
- .addInputHatch("GT Concrete, any base casing")
- .addOutputBus("Mining Pipes, optional, any base casing")
- .toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("Advanced Concrete Backfiller");
}
@Override
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 a64fea5ab0..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
@@ -11,8 +11,6 @@ import net.minecraft.item.ItemStack;
import static gregtech.api.enums.GT_Values.VN;
-import org.lwjgl.input.Keyboard;
-
public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTileEntity_DrillerBase {
private int mLastXOff = 0, mLastZOff = 0;
@@ -25,12 +23,12 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
super(aName);
}
- protected String[] getDescriptionInternal(String tierSuffix) {
+ protected GT_Multiblock_Tooltip_Builder createTooltip(String aStructureName) {
String casings = getCasingBlockItem().get(0).getDisplayName();
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Concrete Backfiller")
- .addInfo("Controller Block for the Concrete Backfiller " + (tierSuffix != null ? tierSuffix : ""))//Unused?
+ .addInfo("Controller Block for the " + aStructureName)
.addInfo("Will fill in areas below it with light concrete. This goes through walls")
.addInfo("Use it to remove any spawning locations beneath your base to reduce lag")
.addInfo("Will pull back the pipes after it finishes that layer")
@@ -41,17 +39,13 @@ 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");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ return tt;
}
@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..c6a30ad085 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,39 @@ 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.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;
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<GT_MetaTileEntity_DieselEngine> {
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_DieselEngine>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_DieselEngine>>() {
+ @Override
+ protected IStructureDefinition<GT_MetaTileEntity_DieselEngine> computeValue(Class<?> type) {
+ return StructureDefinition.<GT_MetaTileEntity_DieselEngine>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;
@@ -41,13 +63,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")
@@ -64,18 +86,14 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -83,12 +101,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]};
}
@@ -146,34 +164,30 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tFluids = getStoredFluids();
- Collection<GT_Recipe> 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;
@@ -181,68 +195,15 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
return false;
}
+
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- byte tSide = getBaseMetaTileEntity().getBackFacing();
- int tX = getBaseMetaTileEntity().getXCoord();
- int tY = getBaseMetaTileEntity().getYCoord();
- int tZ = getBaseMetaTileEntity().getZCoord();
+ public IStructureDefinition<GT_MetaTileEntity_DieselEngine> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
- 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
- }
-
- 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() {
@@ -332,19 +293,25 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
return new String[]{
- EnumChatFormatting.BLUE+"Diesel Engine"+EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.multiblock.energy")+": " +
- EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET +" EU / "+
- EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET +" EU",
+ EnumChatFormatting.BLUE + "Diesel Engine" + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
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.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",
- StatCollector.translateToLocal("GT5U.engine.efficiency")+": " +EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.YELLOW+" %",
- StatCollector.translateToLocal("GT5U.multiblock.pollution")+": " + EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
+ 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 + GT_Utility.formatNumbers((mEUt*mEfficiency/10000)) + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.engine.consumption") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelConsumption) + EnumChatFormatting.RESET + " L/t",
+ StatCollector.translateToLocal("GT5U.engine.value") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelValue) + EnumChatFormatting.RESET + " EU/L",
+ StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " +
+ EnumChatFormatting.GOLD + GT_Utility.formatNumbers(fuelRemaining) + EnumChatFormatting.RESET + " L",
+ StatCollector.translateToLocal("GT5U.engine.efficiency") + ": " +
+ EnumChatFormatting.YELLOW + (mEfficiency/100F) + EnumChatFormatting.YELLOW + " %",
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " +
+ EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
};
}
@@ -353,4 +320,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..e7634c6b62 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,73 @@ 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 {
- private static final int CASING_INDEX = 49;
- private short controllerY;
+public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DistillationTower> {
+ protected static final int CASING_INDEX = 49;
+ protected static final String STRUCTURE_PIECE_BASE = "base";
+ protected static final String STRUCTURE_PIECE_LAYER = "layer";
+ protected static final String STRUCTURE_PIECE_LAYER_HINT = "layerHint";
+ protected static final String STRUCTURE_PIECE_TOP_HINT = "topHint";
+ private static final IStructureDefinition<GT_MetaTileEntity_DistillationTower> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_DistillationTower>builder()
+ .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][]{
+ {"b~b", "bbb", "bbb"},
+ }))
+ .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][]{
+ {"lll", "lcl", "lll"}
+ }))
+ .addShape(STRUCTURE_PIECE_LAYER_HINT, transpose(new String[][]{
+ {"lll", "l-l", "lll"}
+ }))
+ .addShape(STRUCTURE_PIECE_TOP_HINT, transpose(new String[][]{
+ {"lll", "lll", "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, 2),
+ ofHatchAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch, CASING_INDEX, 2),
+ 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, 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()
+ ))
+ .build();
+ protected final List<List<GT_MetaTileEntity_Hatch_Output>> mOutputHatchesByLayer = new ArrayList<>();
+ protected int mHeight;
+ protected int mCasing;
+ protected boolean mTopLayerFound;
public GT_MetaTileEntity_DistillationTower(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -46,7 +92,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")
@@ -56,17 +102,13 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
.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 (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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -75,12 +117,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)};
}
@@ -101,13 +143,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- @Override
public boolean checkRecipe(ItemStack aStack) {
-
ArrayList<FluidStack> tFluidList = getStoredFluids();
for (int i = 0; i < tFluidList.size() - 1; i++) {
for (int j = i + 1; j < tFluidList.size(); j++) {
@@ -152,63 +188,59 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi
return false;
}
+ protected void onCasingFound() {
+ mCasing++;
+ }
+
+ protected void onTopLayerFound(boolean aIsCasing) {
+ mTopLayerFound = true;
+ if (aIsCasing)
+ onCasingFound();
+ }
+
+ 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)
+ mOutputHatchesByLayer.add(new ArrayList<>());
+ GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aTileEntity.getMetaTileEntity();
+ tHatch.updateTexture(aBaseCasingIndex);
+ return mOutputHatchesByLayer.get(mHeight - 1).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() && !f.isVerticallyFliped();
+ }
+
+ @Override
+ public IStructureDefinition<GT_MetaTileEntity_DistillationTower> 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++;
+ // check each layer
+ while (mHeight < 12 && checkPiece(STRUCTURE_PIECE_LAYER, 1, mHeight, 0) && !mTopLayerFound) {
+ if (mOutputHatchesByLayer.get(mHeight - 1).isEmpty())
+ // layer without output hatch
+ return false;
+ // not top
+ mHeight++;
}
- return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+
+ // validate final invariants...
+ return mCasing >= 7 * mHeight - 5 && mHeight >= 2 && mTopLayerFound && mMaintenanceHatches.size() == 1;
}
@Override
@@ -226,40 +258,27 @@ 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);
+ int tTotalHeight = Math.max(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height
+ for (int i = 1; i < tTotalHeight - 1; i++) {
+ buildPiece(STRUCTURE_PIECE_LAYER_HINT, stackSize, hintsOnly, 1, i, 0);
}
+ buildPiece(STRUCTURE_PIECE_TOP_HINT, stackSize, hintsOnly, 1, tTotalHeight - 1, 0);
+ }
}
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 d7b7e2aa4d..010d1558be 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
@@ -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.ItemList;
import gregtech.api.enums.Materials;
@@ -7,10 +10,10 @@ import gregtech.api.interfaces.IChunkLoader;
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_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_ChunkManager;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ModHandler;
@@ -27,18 +30,51 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
+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;
import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId;
+import static gregtech.api.util.GT_StructureUtility.ofFrame;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase implements IChunkLoader {
+public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DrillerBase> implements IChunkLoader {
private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0);
private static final ItemStack miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0);
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 ClassValue<IStructureDefinition<GT_MetaTileEntity_DrillerBase>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_DrillerBase>>() {
+ @Override
+ protected IStructureDefinition<GT_MetaTileEntity_DrillerBase> computeValue(Class<?> type) {
+ return StructureDefinition.<GT_MetaTileEntity_DrillerBase>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 -> ofFrame(t.getFrameMaterial())))
+ .addElement('c', lazy(t -> ofBlock(t.getCasingBlockItem().getBlock(), t.getCasingBlockItem().get(0).getItemDamage())))
+ .addElement('b', lazy(t -> ofChain(
+ ofBlock(t.getCasingBlockItem().getBlock(), t.getCasingBlockItem().get(0).getItemDamage()),
+ 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;
@@ -82,12 +118,12 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
getCasingTextureForId(casingTextureIndex),
- TextureFactory.of(OVERLAY_FRONT_ORE_DRILL_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
getCasingTextureForId(casingTextureIndex),
- TextureFactory.of(OVERLAY_FRONT_ORE_DRILL),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_GLOW).extFacing().glow().build()};
}
return new ITexture[]{getCasingTextureForId(casingTextureIndex)};
}
@@ -207,7 +243,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
if (!storedItem.isItemEqual(miningPipe)) continue;
if (pipes == null) {
- setInventorySlotContents(1, GT_Utility.copy(miningPipe));
+ setInventorySlotContents(1, GT_Utility.copyOrNull(miningPipe));
pipes = getStackInSlot(1);
}
@@ -319,36 +355,19 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
}
@Override
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
+ }
+
+ @Override
+ public final IStructureDefinition<GT_MetaTileEntity_DrillerBase> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
+
+ @Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
updateCoordinates();
- //check base layer
- for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) {
- for (int zOff = -1 + back.offsetZ; zOff <= 1 + back.offsetZ; zOff++) {
- if (xOff == 0 && zOff == 0) continue;
-
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0, zOff);
- if (!checkCasingBlock(xOff, 0, zOff)
- && !addMaintenanceToMachineList(tTileEntity, casingTextureIndex)
- && !addInputToMachineList(tTileEntity, casingTextureIndex)
- && !addOutputToMachineList(tTileEntity, casingTextureIndex)
- && !addEnergyInputToMachineList(tTileEntity, casingTextureIndex)
- && !addDataAccessToMachineList(tTileEntity, casingTextureIndex))
- return false;
- }
- }
- if(!checkHatches()) return false;
- if (GT_Utility.getTier(getMaxInputVoltage()) < getMinTier()) return false;
- //check tower
- for (int yOff = 1; yOff < 4; yOff++) {
- if (!checkCasingBlock(back.offsetX, yOff, back.offsetZ)
- || !checkFrameBlock(back.offsetX + 1, yOff, back.offsetZ)
- || !checkFrameBlock(back.offsetX - 1, yOff, back.offsetZ)
- || !checkFrameBlock(back.offsetX, yOff, back.offsetZ + 1)
- || !checkFrameBlock(back.offsetX, yOff, back.offsetZ - 1)
- || !checkFrameBlock(back.offsetX, yOff + 3, back.offsetZ))
- return false;
- }
- return true;
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 6, 0) && checkHatches() && GT_Utility.getTier(getMaxInputVoltage()) >= getMinTier() && mMaintenanceHatches.size() == 1;
}
private void updateCoordinates() {
@@ -370,14 +389,17 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
return true;
}
+ @Deprecated
protected boolean checkCasingBlock(int xOff, int yOff, int zOff) {
return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta);
}
//meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight operation)
+ @Deprecated
protected boolean checkFrameBlock(int xOff, int yOff, int zOff) {
return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta);
}
+ @Deprecated
protected boolean checkBlockAndMetaOffset(int xOff, int yOff, int zOff, Block block, int meta) {
return checkBlockAndMeta(xDrill + xOff, yDrill + yOff, zDrill + zOff, block, meta);
}
@@ -484,4 +506,9 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
}
@Override
public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 6, 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 5e99491c2e..b55ae939b6 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
@@ -1,30 +1,34 @@
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;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
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_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
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.block.Block;
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 net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
+import java.util.ArrayList;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.GT_Values.VN;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE;
@@ -32,14 +36,30 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAS
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
+import static gregtech.api.util.GT_StructureUtility.ofCoil;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
-public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_AbstractMultiFurnace {
+public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_ElectricBlastFurnace> implements IConstructable {
private int mHeatingCapacity = 0;
- private int controllerY;
- private final FluidStack[] pollutionFluidStacks = {Materials.CarbonDioxide.getGas(1000),
+ protected final ArrayList<GT_MetaTileEntity_Hatch_Output> mPollutionOutputHatches = new ArrayList<>();
+ protected final FluidStack[] pollutionFluidStacks = {Materials.CarbonDioxide.getGas(1000),
Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)};
- private static final int CASING_INDEX = 11;
+ protected static final int CASING_INDEX = 11;
+ protected static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition<GT_MetaTileEntity_ElectricBlastFurnace> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_ElectricBlastFurnace>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"ttt", "tmt", "ttt"},
+ {"CCC", "C-C", "CCC",},
+ {"CCC", "C-C", "CCC",},
+ {"b~b", "bbb", "bbb"}
+ }))
+ .addElement('t', ofHatchAdderOptional(GT_MetaTileEntity_ElectricBlastFurnace::addOutputHatchToTopList, CASING_INDEX, 1, GregTech_API.sBlockCasings1, CASING_INDEX))
+ .addElement('m', ofHatchAdder(GT_MetaTileEntity_ElectricBlastFurnace::addMufflerToMachineList, CASING_INDEX, 2))
+ .addElement('C', ofCoil(GT_MetaTileEntity_ElectricBlastFurnace::setCoilLevel, GT_MetaTileEntity_ElectricBlastFurnace::getCoilLevel))
+ .addElement('b', ofHatchAdderOptional(GT_MetaTileEntity_ElectricBlastFurnace::addBottomHatch, CASING_INDEX, 3, GregTech_API.sBlockCasings1, CASING_INDEX))
+ .build();
public GT_MetaTileEntity_ElectricBlastFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -55,8 +75,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")
@@ -70,21 +90,17 @@ 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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -93,12 +109,12 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
if (aActive)
return new ITexture[]{
casingTexturePages[0][CASING_INDEX],
- TextureFactory.of(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
casingTexturePages[0][CASING_INDEX],
- TextureFactory.of(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW).extFacing().glow().build()};
}
return new ITexture[]{casingTexturePages[0][CASING_INDEX]};
}
@@ -119,8 +135,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
+ public IStructureDefinition<GT_MetaTileEntity_ElectricBlastFurnace> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
}
@Override
@@ -225,68 +241,38 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
return timesOverclocked;
}
- private boolean checkMachineFunction(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- controllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ public boolean addOutputHatchToTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mPollutionOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
+ }
+ return false;
+ }
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
this.mHeatingCapacity = 0;
replaceDeprecatedCoils(aBaseMetaTileEntity);
- HeatingCoilLevel heatingCap = getInitialHeatLevel(aBaseMetaTileEntity, xDir, zDir);
- if (heatingCap == null)
- return false;
-
- if (!checkStructure(heatingCap, xDir, zDir, aBaseMetaTileEntity))
- return false;
- this.mHeatingCapacity = (int) heatingCap.getHeat();
- this.mHeatingCapacity += 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2);
- return true;
- }
+ setCoilLevel(HeatingCoilLevel.None);
- @Override
- protected boolean checkTopLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
- if ((i == 0) && (j == 0)) {
- return addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), CASING_INDEX);
- }
- if (addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), CASING_INDEX))
- return true;
+ mPollutionOutputHatches.clear();
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != GregTech_API.sBlockCasings1)
+ if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 3, 0))
return false;
- return aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) == CASING_INDEX;
- }
-
- @Override
- protected boolean checkCoils(HeatingCoilLevel heatingCap, int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
- if ((i == 0) && (j == 0)) {
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir))
- return false;
-
- return aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir);
- }
-
- Block blockLow = aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j);
- if (!(blockLow instanceof IHeatingCoil))
+ if (getCoilLevel() == HeatingCoilLevel.None)
return false;
- Block blockHi = aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j);
- if (!(blockHi instanceof IHeatingCoil))
+ if (mMaintenanceHatches.size() != 1)
return false;
- byte metaLow = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j);
- HeatingCoilLevel coilHeatLow = ((IHeatingCoil) blockLow).getCoilHeat(metaLow);
- byte metaHi = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j);
- HeatingCoilLevel coilHeatHi = ((IHeatingCoil) blockHi).getCoilHeat(metaHi);
-
- return heatingCap == coilHeatLow && heatingCap == coilHeatHi;
- }
-
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- return this.checkMachineFunction(aBaseMetaTileEntity, aStack);
+ this.mHeatingCapacity = (int) getCoilLevel().getHeat() + 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2);
+ return true;
}
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
@@ -326,7 +312,6 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
public boolean addOutput(FluidStack aLiquid) {
if (aLiquid == null)
return false;
- int targetHeight;
FluidStack tLiquid = aLiquid.copy();
boolean isOutputPollution = false;
for (FluidStack pollutionFluidStack : pollutionFluidStacks) {
@@ -336,8 +321,9 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
isOutputPollution = true;
break;
}
+ ArrayList<GT_MetaTileEntity_Hatch_Output> tOutputHatches;
if (isOutputPollution) {
- targetHeight = this.controllerY + 3;
+ tOutputHatches = this.mPollutionOutputHatches;
int pollutionReduction = 0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
if (!isValidMetaTileEntity(tHatch))
@@ -347,23 +333,10 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
}
tLiquid.amount = tLiquid.amount * (pollutionReduction + 5) / 100;
} else {
- targetHeight = this.controllerY;
+ tOutputHatches = this.mOutputHatches;
}
- for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? !tHatch.outputsSteam() : !tHatch.outputsLiquids())
- continue;
-
- if (tHatch.getBaseMetaTileEntity().getYCoord() != targetHeight)
- continue;
-
- 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;
+ return dumpFluid(tOutputHatches, tLiquid, true) ||
+ dumpFluid(tOutputHatches, tLiquid, false);
}
@Override
@@ -385,20 +358,31 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
}
return new String[]{
- StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " +
- EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s",
- StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " +
- EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU",
- StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t",
- StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
+ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " +
+ EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " +
+ StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET,
StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
- EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
- " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " +
+ StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %",
StatCollector.translateToLocal("GT5U.EBF.heat") + ": " +
- EnumChatFormatting.GREEN + mHeatingCapacity + EnumChatFormatting.RESET + " K",
- StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mHeatingCapacity) + EnumChatFormatting.RESET + " K",
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " +
+ EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
};
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1,3,0);
+ }
}
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..8c3d474b8b 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
@@ -11,12 +11,12 @@ 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;
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 +35,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")
@@ -52,18 +52,14 @@ 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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -76,12 +72,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]};
}
@@ -185,19 +181,25 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die
}
return new String[]{
- EnumChatFormatting.BLUE+"Extreme Diesel Engine"+EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.multiblock.energy")+": " +
- EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET +" EU / "+
- EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET +" EU",
+ EnumChatFormatting.BLUE + "Extreme Diesel Engine" + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
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.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",
- StatCollector.translateToLocal("GT5U.engine.efficiency")+": " +EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.YELLOW+" %",
- StatCollector.translateToLocal("GT5U.multiblock.pollution")+": " + EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
+ 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 + GT_Utility.formatNumbers(-mEUt*mEfficiency/10000) + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.engine.consumption") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelConsumption) + EnumChatFormatting.RESET + " L/t",
+ StatCollector.translateToLocal("GT5U.engine.value") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelValue) + EnumChatFormatting.RESET + " EU/L",
+ StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " +
+ EnumChatFormatting.GOLD + GT_Utility.formatNumbers(fuelRemaining) + EnumChatFormatting.RESET + " L",
+ StatCollector.translateToLocal("GT5U.engine.efficiency") + ": " +
+ EnumChatFormatting.YELLOW + (mEfficiency/100F) + EnumChatFormatting.YELLOW + " %",
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " +
+ EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
};
}
}
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..ca6495ea65 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,19 +1,22 @@
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_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_GUIContainer_FusionReactor;
@@ -23,25 +26,93 @@ 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.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;
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<GT_MetaTileEntity_FusionComputer> {
+ public static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_FusionComputer>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_FusionComputer>>() {
+ @Override
+ protected IStructureDefinition<GT_MetaTileEntity_FusionComputer> computeValue(Class<?> type) {
+ return StructureDefinition.<GT_MetaTileEntity_FusionComputer>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;
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()
));
}
@@ -88,55 +159,26 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
}
@Override
+ public IStructureDefinition<GT_MetaTileEntity_FusionComputer> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addController("Fusion Reactor")
+ .addInfo("Some kind of fusion reactor, maybe")
+ .addSeparator()
+ .addInfo("Some kind of fusion reactor, maybe")
+ .addStructureInfo("Should probably be built similar to other fusions")
+ .addStructureInfo("See controller tooltip for details")
+ .toolTipFinisher("Gregtech");
+ return tt;
+ }
+
+ @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 +190,51 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
return false;
}
- private boolean checkTier(byte tier, ArrayList<GT_MetaTileEntity_Hatch> 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()};
}
/**
@@ -467,14 +463,23 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
}
return new String[]{
- EnumChatFormatting.BLUE+"Fusion Reactor MK "+EnumChatFormatting.RESET+tier,
- StatCollector.translateToLocal("GT5U.fusion.req")+": " +EnumChatFormatting.RED+powerRequired+EnumChatFormatting.RESET+"EU/t",
- StatCollector.translateToLocal("GT5U.multiblock.energy")+": " +EnumChatFormatting.GREEN+mEUStore+EnumChatFormatting.RESET+" EU / "+EnumChatFormatting.YELLOW+maxEUStore()+EnumChatFormatting.RESET+" EU",
- StatCollector.translateToLocal("GT5U.fusion.plasma")+": " +EnumChatFormatting.YELLOW+plasmaOut+EnumChatFormatting.RESET+"L/t"};
+ EnumChatFormatting.BLUE + "Fusion Reactor MK " + EnumChatFormatting.RESET + tier,
+ StatCollector.translateToLocal("GT5U.fusion.req") + ": " +
+ EnumChatFormatting.RED + GT_Utility.formatNumbers(powerRequired) + EnumChatFormatting.RESET + "EU/t",
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mEUStore) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEUStore()) + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.fusion.plasma") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(plasmaOut) + EnumChatFormatting.RESET + "L/t"};
}
@Override
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..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
@@ -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_FUSION1;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW;
@@ -15,8 +14,8 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW;
public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionComputer {
private static final ITexture textureOverlay = TextureFactory.of(
- TextureFactory.of(OVERLAY_FUSION1),
- TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).glow().build());
+ TextureFactory.builder().addIcon(OVERLAY_FUSION1).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).extFacing().glow().build());
public GT_MetaTileEntity_FusionComputer1(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 6);
@@ -62,7 +61,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!!!")
@@ -76,16 +75,12 @@ 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");
- 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..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
@@ -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;
@@ -15,8 +14,8 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2_GLOW;
public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionComputer {
private static final ITexture textureOverlay = TextureFactory.of(
- TextureFactory.of(OVERLAY_FUSION2),
- TextureFactory.builder().addIcon(OVERLAY_FUSION2_GLOW).glow().build());
+ TextureFactory.builder().addIcon(OVERLAY_FUSION2).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FUSION2_GLOW).extFacing().glow().build());
public GT_MetaTileEntity_FusionComputer2(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 6);
@@ -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!!!")
@@ -76,16 +75,12 @@ 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");
- 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..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
@@ -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_FUSION3;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3_GLOW;
@@ -15,8 +14,8 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3_GLOW;
public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionComputer {
private static final ITexture textureOverlay = TextureFactory.of(
- TextureFactory.of(OVERLAY_FUSION3),
- TextureFactory.builder().addIcon(OVERLAY_FUSION3_GLOW).glow().build());
+ TextureFactory.builder().addIcon(OVERLAY_FUSION3).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FUSION3_GLOW).extFacing().glow().build());
public GT_MetaTileEntity_FusionComputer3(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 6);
@@ -62,7 +61,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")
@@ -76,16 +75,12 @@ 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");
- 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_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
index 9ce1de3fec..fa96971a07 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
@@ -1,44 +1,69 @@
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.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_Input;
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_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import net.minecraft.block.Block;
+import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
+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_HEAT_EXCHANGER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
-
-public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBlockBase {
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_HeatExchanger> {
+ private static final int CASING_INDEX = 50;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition<GT_MetaTileEntity_HeatExchanger> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_HeatExchanger>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"ccc", "cCc", "ccc"},
+ {"ccc", "cPc", "ccc"},
+ {"ccc", "cPc", "ccc"},
+ {"c~c", "cHc", "ccc"},
+ }))
+ .addElement('P', ofBlock(GregTech_API.sBlockCasings2, 14))
+ .addElement('C', ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addColdFluidOutputToMachineList, CASING_INDEX, 2))
+ .addElement('H', ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addHotFluidInputToMachineList, CASING_INDEX, 3))
+ .addElement('c', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addOutputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_HeatExchanger::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_HeatExchanger::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, (byte) 2))
+ ))
+ .build();
public static float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25)
- private static boolean controller;
private GT_MetaTileEntity_Hatch_Input mInputHotFluidHatch;
private GT_MetaTileEntity_Hatch_Output mOutputColdFluidHatch;
private boolean superheated = false;
private int superheated_threshold=0;
private float water;
+ private int mCasingAmount;
public GT_MetaTileEntity_HeatExchanger(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -48,7 +73,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Heat Exchanger")
.addInfo("Controller Block for the Large Heat Exchanger")
@@ -62,17 +87,13 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -92,15 +113,15 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
if (aSide == aFacing) {
if (aActive)
return new ITexture[]{
- casingTexturePages[0][50],
- TextureFactory.of(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).glow().build()};
+ casingTexturePages[0][CASING_INDEX],
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
- casingTexturePages[0][50],
- TextureFactory.of(OVERLAY_FRONT_HEAT_EXCHANGER),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).glow().build()};
+ casingTexturePages[0][CASING_INDEX],
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build()};
}
- return new ITexture[]{casingTexturePages[0][50]};
+ return new ITexture[]{casingTexturePages[0][CASING_INDEX]};
}
@Override
@@ -114,8 +135,8 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
+ protected IAlignmentLimits getInitialAlignmentLimits() {
+ return (d, r, f) -> !r.isUpsideDown() && !f.isVerticallyFliped();
}
@Override
@@ -208,57 +229,20 @@ public class GT_MetaTileEntity_HeatExchanger 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;
-
- int tCasingAmount = 0;
- controller = false;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((i != 0) || (j != 0)) {
- for (int k = 0; k <= 3; k++) {
- if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), 50) &&
- !addInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), 50) &&
- !addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), 50) &&
- !ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j) != getCasingBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, k, zDir + j) != getCasingMeta()) {
- return false;
- }
- tCasingAmount++;
- }
- }
- } else {
- if (!addHotFluidInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j), 50)) {
- return false;
- }
- if (!addColdFluidOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 50)) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != getPipeBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != getPipeMeta()) {
- return false;
- }
+ public IStructureDefinition<GT_MetaTileEntity_HeatExchanger> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != getPipeBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != getPipeMeta()) {
- return false;
- }
- }
- }
- }
- return tCasingAmount >= 20;
+ private void onCasingAdded() {
+ mCasingAmount++;
}
- public boolean ignoreController(Block tTileEntity) {
- return !controller && tTileEntity == GregTech_API.sBlockMachines;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mOutputColdFluidHatch = null;
+ mInputHotFluidHatch = null;
+ mCasingAmount = 0;
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 3, 0) && mCasingAmount >= 20 && mMaintenanceHatches.size() == 1;
}
public boolean addColdFluidOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
@@ -286,26 +270,6 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
return false;
}
- public Block getCasingBlock() {
- return GregTech_API.sBlockCasings4;
- }
-
- public byte getCasingMeta() {
- return 2;
- }
-
- public byte getCasingTextureIndex() {
- return 50;
- }
-
- public Block getPipeBlock() {
- return GregTech_API.sBlockCasings2;
- }
-
- public byte getPipeMeta() {
- return 14;
- }
-
@Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
@@ -339,16 +303,23 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
public String[] getInfoData() {
return new String[]{
StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " +
- EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " +
- EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
StatCollector.translateToLocal("GT5U.multiblock.usage") + " " + StatCollector.translateToLocal("GT5U.LHE.steam") + ": " +
- (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) + (superheated ? -2 * mEUt : -mEUt) + EnumChatFormatting.RESET + " EU/t",
+ (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) + GT_Utility.formatNumbers(superheated ? -2 * mEUt : -mEUt) + EnumChatFormatting.RESET + " EU/t",
StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
- EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
- " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " +
+ StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %",
- StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) + superheated + EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.LHE.superheated") + " " + StatCollector.translateToLocal("GT5U.LHE.threshold") + ": " + EnumChatFormatting.GREEN + superheated_threshold + EnumChatFormatting.RESET
+ StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " +
+ (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) + superheated + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.LHE.superheated") + " " + StatCollector.translateToLocal("GT5U.LHE.threshold") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(superheated_threshold) + EnumChatFormatting.RESET
};
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 3, 0);
+ }
}
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 3d979bb862..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
@@ -1,5 +1,6 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.enums.Textures.BlockIcons;
@@ -7,25 +8,24 @@ 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.block.Block;
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;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW;
-public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_ImplosionCompressor> {
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")
@@ -51,17 +51,18 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
+ }
+
+ @Override
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return super.addToMachineList(aTileEntity, aBaseCasingIndex) || addMufflerToMachineList(aTileEntity, aBaseCasingIndex);
}
@Override
@@ -69,12 +70,12 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
BlockIcons.casingTexturePages[0][16],
- TextureFactory.of(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
BlockIcons.casingTexturePages[0][16],
- TextureFactory.of(OVERLAY_FRONT_IMPLOSION_COMPRESSOR),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW).extFacing().glow().build()};
}
return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16]};
}
@@ -95,11 +96,6 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- @Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs();
int tInputList_sS=tInputList.size();
@@ -147,31 +143,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<GT_MetaTileEntity_CubicMultiBlockBase<?>> getCasingElement() {
+ return ofChain(ofBlock(GregTech_API.sBlockCasings2, 0), ofBlock(GregTech_API.sBlockCasings3, 4));
+ }
+
+ @Override
+ protected int getHatchTextureIndex() {
+ return 16;
+ }
+
+ @Override
+ protected int getRequiredCasingCount() {
+ return 16;
}
@Override
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 841a4fb57c..2599d238a9 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
@@ -1,5 +1,7 @@
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.Materials;
import gregtech.api.enums.OrePrefixes;
@@ -8,7 +10,7 @@ import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
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_Log;
import gregtech.api.util.GT_ModHandler;
@@ -20,25 +22,57 @@ import net.minecraft.block.Block;
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.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GT_Values.STEAM_PER_WATER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_GLOW;
-
-public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_MultiBlockBase {
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeBoiler> {
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeBoiler>> STRUCTURE_DEFINITION =new ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeBoiler>>() {
+ @Override
+ protected IStructureDefinition<GT_MetaTileEntity_LargeBoiler> computeValue(Class<?> type) {
+ return StructureDefinition.<GT_MetaTileEntity_LargeBoiler>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.getFireboxTextureIndex(), 1),
+ ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addInputToMachineList, t.getFireboxTextureIndex(), 1),
+ ofHatchAdder(GT_MetaTileEntity_LargeBoiler::addMufflerToMachineList, t.getFireboxTextureIndex(), 1),
+ onElementPass(GT_MetaTileEntity_LargeBoiler::onFireboxAdded, ofBlock(t.getFireboxBlock(), t.getFireboxMeta()))
+ )))
+ .build();
+ }
+ };
private boolean firstRun = true;
private int mSuperEfficencyIncrease = 0;
private int integratedCircuitConfig = 0; //Steam output is reduced by 1000L per config
private int excessWater = 0; //Eliminate rounding errors for water
private int excessFuel = 0; //Eliminate rounding errors for fuels that burn half items
private int excessProjectedEU = 0; //Eliminate rounding errors from throttling the boiler
+ private int mCasingAmount;
+ private int mFireboxAmount;
public GT_MetaTileEntity_LargeBoiler(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -49,7 +83,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Boiler")
.addInfo("Controller block for the Large " + getCasingMaterial() + " Boiler")
@@ -63,19 +97,15 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
public abstract String getCasingMaterial();
@@ -107,12 +137,12 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
BlockIcons.getCasingTextureForId(getCasingTextureIndex()),
- TextureFactory.of(OVERLAY_FRONT_LARGE_BOILER_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
BlockIcons.getCasingTextureForId(getCasingTextureIndex()),
- TextureFactory.of(OVERLAY_FRONT_LARGE_BOILER),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_GLOW).extFacing().glow().build()};
}
return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())};
}
@@ -128,11 +158,6 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- @Override
public boolean checkRecipe(ItemStack aStack) {
//Do we have an integrated circuit with a valid configuration?
if (mInventory[1] != null && mInventory[1].getUnlocalizedName().startsWith("gt.integrated_circuit")) {
@@ -250,64 +275,24 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
}
@Override
+ public IStructureDefinition<GT_MetaTileEntity_LargeBoiler> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
+
+ private void onCasingAdded() {
+ mCasingAmount++;
+ }
+
+ private void onFireboxAdded() {
+ mFireboxAmount++;
+ }
+
+ @Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
-
- int tCasingAmount = 0;
- int tFireboxAmount = 0;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if (i != 0 || j != 0) {
- for (int k = 1; k <= 4; k++) {
- if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), getCasingTextureIndex())) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j) != getCasingBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, k, zDir + j) != getCasingMeta()) {
- return false;
- }
- tCasingAmount++;
- }
- }
- } else {
- for (int k = 1; k <= 3; k++) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j) != getPipeBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, k, zDir + j) != getPipeMeta()) {
- return false;
- }
- }
- if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 4, zDir + j), getCasingTextureIndex())) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 4, zDir + j) != getCasingBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 4, zDir + j) != getCasingMeta()) {
- return false;
- }
- tCasingAmount++;
- }
- }
- }
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if (xDir + i != 0 || zDir + j != 0) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if (!addMaintenanceToMachineList(tTileEntity, getFireboxTextureIndex()) && !addInputToMachineList(tTileEntity, getFireboxTextureIndex()) && !addMufflerToMachineList(tTileEntity, getFireboxTextureIndex())) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != getFireboxBlock()) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != getFireboxMeta()) {
- return false;
- }
- tFireboxAmount++;
- }
- }
- }
- }
- return tCasingAmount >= 24 && tFireboxAmount >= 3;
+ mCasingAmount = 0;
+ mFireboxAmount = 0;
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 4, 0) && mCasingAmount >= 24 && mFireboxAmount >= 3 &&
+ mMaintenanceHatches.size() == 1 && !mMufflerHatches.isEmpty();
}
@Override
@@ -347,4 +332,9 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
this.excessProjectedEU %= adjustedEUt;
return adjustedBurnTime;
}
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 4, 0);
+ }
}
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 c9de809b58..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
@@ -1,33 +1,63 @@
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.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_EnhancedMultiBlockBase;
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;
-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.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_LARGE_CHEMICAL_REACTOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
-
-public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase {
-
- private final int CASING_INDEX = 176;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeChemicalReactor> {
+ private static final int CASING_INDEX = 176;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition<GT_MetaTileEntity_LargeChemicalReactor> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_LargeChemicalReactor>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"ccc", "cxc", "ccc"},
+ {"c~c", "xPx", "cxc"},
+ {"ccc", "cxc", "ccc"},
+ }))
+ .addElement('P', ofBlock(GregTech_API.sBlockCasings8, 1))
+ .addElement('c', 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),
+ onElementPass(GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, ofBlock(GregTech_API.sBlockCasings8, 0))
+ ))
+ .addElement('x', ofChain(
+ 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))
+ ))
+ .build();
+
+ private int mCasingAmount;
+ private int mCoilAmount;
public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -43,7 +73,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
}
@Override
- public String[] getDescription() {
+ public GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Chemical Reactor")
.addInfo("Controller block for the Large Chemical Reactor")
@@ -54,20 +84,16 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -76,12 +102,12 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
casingTexturePages[1][48],
- TextureFactory.of(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
casingTexturePages[1][48],
- TextureFactory.of(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW).extFacing().glow().build()};
}
return new ITexture[]{casingTexturePages[1][48]};
}
@@ -162,56 +188,25 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
}
@Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int casingAmount = 0;
- boolean hasHeatingCoil = false;
- // x=width, z=depth, y=height
- for (int x = -1 + xDir; x <= xDir + 1; x++) {
- for (int z = -1 + zDir; z <= zDir + 1; z++) {
- for (int y = -1; y <= 1; y++) {
- if (x == 0 && y == 0 && z == 0) {
- continue;
- }
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- int centerCoords = 0;
- if (x == xDir) {
- centerCoords++;
- }
- if (y == 0) {
- centerCoords++;
- }
- if (z == zDir) {
- centerCoords++;
- }
- if (centerCoords == 3) {
- if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- continue;
- } else {
- return false;
- }
- }
- if (centerCoords == 2 && block == GregTech_API.sBlockCasings5 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) {
- hasHeatingCoil = true;
- continue;
- }
- if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) {
- casingAmount++;
- } else {
- return false;
- }
- }
+ public IStructureDefinition<GT_MetaTileEntity_LargeChemicalReactor> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
- }
- }
+ private void onCasingAdded() {
+ mCasingAmount++;
+ }
- }
- return casingAmount >= 8 && hasHeatingCoil && !mEnergyHatches.isEmpty() && !mMaintenanceHatches.isEmpty();
+ private void onCoilAdded() {
+ mCoilAmount++;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasingAmount = 0;
+ mCoilAmount = 0;
+ return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) &&
+ mCasingAmount >= 8 && mCoilAmount == 1 &&
+ !mEnergyHatches.isEmpty() && mMaintenanceHatches.size() == 1;
}
@Override
@@ -234,4 +229,8 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
return false;
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 1, 0);
+ }
}
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..8966838f3f 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,68 @@
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.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;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
+
+public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeTurbine> {
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeTurbine>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeTurbine>>() {
+ @Override
+ protected IStructureDefinition<GT_MetaTileEntity_LargeTurbine> computeValue(Class<?> type) {
+ return StructureDefinition.<GT_MetaTileEntity_LargeTurbine>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<GT_MetaTileEntity_LargeTurbine>) (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);
}
@@ -46,66 +78,13 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
}
@Override
+ public IStructureDefinition<GT_MetaTileEntity_LargeTurbine> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
+
+ @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) && mMaintenanceHatches.size() == 1 && mMufflerHatches.isEmpty() == (getPollutionPerTick(null) == 0);
}
public abstract Block getCasingBlock();
@@ -114,11 +93,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 +110,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<FluidStack> 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 +176,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
}
return 0;
}
+
@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return true;
@@ -234,22 +214,28 @@ 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 + GT_Utility.formatNumbers(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 + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + /* 3 */
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.turbine.flow") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(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 + GT_Utility.formatNumbers(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 +243,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..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
@@ -12,10 +12,8 @@ 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;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5;
@@ -34,11 +32,11 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_SS_ACTIVE5) : TextureFactory.of(LARGETURBINE_SS5) : casingTexturePages[0][58]};
+ return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.builder().addIcon(LARGETURBINE_SS_ACTIVE5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_SS5).extFacing().build() : casingTexturePages[0][58]};
}
@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")
@@ -48,25 +46,18 @@ 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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
public int getFuelValue(FluidStack aLiquid) {
- if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0;
- FluidStack tLiquid;
- Collection<GT_Recipe> 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_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
index fb510f1352..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
@@ -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;
@@ -39,11 +38,11 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_TI_ACTIVE5) : TextureFactory.of(LARGETURBINE_TI5) : casingTexturePages[0][59]};
+ return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.builder().addIcon(LARGETURBINE_TI_ACTIVE5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_TI5).extFacing().build() : casingTexturePages[0][59]};
}
@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")
@@ -55,16 +54,12 @@ 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");
- 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..76c5533c09 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,10 +20,8 @@ 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;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
@@ -41,11 +39,11 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_TU_ACTIVE5) : TextureFactory.of(Textures.BlockIcons.LARGETURBINE_TU5) : casingTexturePages[0][60]};
+ return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.builder().addIcon(LARGETURBINE_TU_ACTIVE5).extFacing().build() : TextureFactory.builder().addIcon(Textures.BlockIcons.LARGETURBINE_TU5).extFacing().build() : casingTexturePages[0][60]};
}
@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")
@@ -55,25 +53,18 @@ 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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
public int getFuelValue(FluidStack aLiquid) {
- if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0;
- FluidStack tLiquid;
- Collection<GT_Recipe> 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;
}
@@ -247,16 +238,22 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
}
String[] ret = new String[]{
// 8 Lines available for information panels
- tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", /* 1 */
+ tRunning + ": " + EnumChatFormatting.RED + GT_Utility.formatNumbers(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/s" + /* 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 + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + /* 3 */
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.turbine.flow") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_Utility.safeInt((long)realOptFlow)) + EnumChatFormatting.RESET + " L/s" + /* 4 */
+ EnumChatFormatting.YELLOW + " (" + (looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight")) + ")", /* 5 */
+ StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " +
+ EnumChatFormatting.GOLD + GT_Utility.formatNumbers(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 */
};
if (!this.getClass().getName().contains("Steam"))
ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/s";
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..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
@@ -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;
@@ -42,11 +41,11 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_ST_ACTIVE5) : TextureFactory.of(LARGETURBINE_ST5) : casingTexturePages[0][57]};
+ return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.builder().addIcon(LARGETURBINE_ST_ACTIVE5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_ST5).extFacing().build() : casingTexturePages[0][57]};
}
@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")
@@ -58,16 +57,12 @@ 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");
- 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_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index 3bf7dc4cfb..37f56deef5 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,9 +1,11 @@
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;
import gregtech.api.enums.HeatingCoilLevel;
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;
@@ -13,29 +15,44 @@ 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.block.Block;
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.transpose;
import static gregtech.api.enums.GT_Values.VN;
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;
-public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMultiFurnace {
+public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_MultiFurnace> implements IConstructable {
private int mLevel = 0;
private int mCostDiscount = 1;
private static final int CASING_INDEX = 11;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition<GT_MetaTileEntity_MultiFurnace> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_MultiFurnace>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"ccc", "cmc", "ccc"},
+ {"CCC", "C-C", "CCC",},
+ {"b~b", "bbb", "bbb"}
+ }))
+ .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, 1, GregTech_API.sBlockCasings1, CASING_INDEX))
+ .build();
public GT_MetaTileEntity_MultiFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -51,8 +68,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")
@@ -63,15 +80,13 @@ 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");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
- return tt.getInformation();
- return tt.getStructureInformation();
+ return tt;
}
@Override
@@ -79,12 +94,12 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
if (aSide != aFacing) return new ITexture[]{casingTexturePages[0][CASING_INDEX]};
if (aActive) return new ITexture[]{
casingTexturePages[0][CASING_INDEX],
- TextureFactory.of(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
casingTexturePages[0][CASING_INDEX],
- TextureFactory.of(OVERLAY_FRONT_MULTI_SMELTER),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_GLOW).extFacing().glow().build()};
}
@Override
@@ -149,55 +164,32 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
return true;
}
- private boolean checkMachineFunction(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ @Override
+ public IStructureDefinition<GT_MetaTileEntity_MultiFurnace> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
this.mLevel = 0;
this.mCostDiscount = 1;
replaceDeprecatedCoils(aBaseMetaTileEntity);
- HeatingCoilLevel heatingCap = getInitialHeatLevel(aBaseMetaTileEntity, xDir, zDir);
- if (heatingCap == null)
- return false;
-
- if (!checkStructure(heatingCap, xDir, zDir, aBaseMetaTileEntity))
- return false;
-
- this.mLevel = heatingCap.getLevel();
- this.mCostDiscount = heatingCap.getCostDiscount();
- return true;
- }
- @Override
- protected boolean checkCoils(HeatingCoilLevel heatingCap, int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
- if ((i == 0) && (j == 0))
- return aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir);
+ setCoilLevel(HeatingCoilLevel.None);
- Block coilM = aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j);
- if (!(coilM instanceof IHeatingCoil))
+ if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 2, 0))
return false;
- byte usedMetaM = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j);
-
- IHeatingCoil heatingCoilM = (IHeatingCoil) coilM;
- HeatingCoilLevel heatingLevelM = heatingCoilM.getCoilHeat(usedMetaM);
- return heatingLevelM == heatingCap;
- }
+ if (getCoilLevel() == HeatingCoilLevel.None)
+ return false;
- @Override
- protected boolean checkTopLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
- if ((i == 0) && (j == 0)) {
- return addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), CASING_INDEX);
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1)
+ if (mMaintenanceHatches.size() != 1)
return false;
- return aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) == CASING_INDEX;
- }
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
- return this.checkMachineFunction(aBaseMetaTileEntity,aStack);
+ this.mLevel = getCoilLevel().getLevel();
+ this.mCostDiscount = getCoilLevel().getCostDiscount();
+ return true;
}
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
@@ -234,24 +226,31 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu
return new String[]{
StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " +
- EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " +
- EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " +
- EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " +
- EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " +
- EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t",
+ EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t",
StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " +
- EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " +
+ StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET,
StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
- EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
- " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " +
+ StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %",
StatCollector.translateToLocal("GT5U.MS.multismelting") + ": " +
- EnumChatFormatting.GREEN + mLevel * 8 + EnumChatFormatting.RESET + " Discount: (EU/t) / " + EnumChatFormatting.GREEN + mCostDiscount + EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
+ EnumChatFormatting.GREEN + mLevel * 8 + EnumChatFormatting.RESET +
+ " Discount: (EU/t) / " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mCostDiscount) + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " +
+ EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
};
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 2, 0);
+ }
}
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 0a0088246b..a90e1948d0 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
@@ -1,43 +1,77 @@
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.HeatingCoilLevel;
import gregtech.api.enums.Materials;
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_EnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
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.apache.commons.lang3.mutable.MutableInt;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
-import java.util.BitSet;
+import java.util.List;
+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_OIL_CRACKER;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
+import static gregtech.api.util.GT_StructureUtility.ofCoil;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBase {
- private ForgeDirection orientation;
- private int controllerX, controllerZ;
-
+public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_OilCracker> {
private static final byte CASING_INDEX = 49;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final IStructureDefinition<GT_MetaTileEntity_OilCracker> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_OilCracker>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"lcmcr", "lcmcr", "lcmcr"},
+ {"lc~cr", "l---r", "lcmcr"},
+ {"lcmcr", "lcmcr", "lcmcr"},
+ }))
+ .addElement('c', ofCoil(GT_MetaTileEntity_OilCracker::setCoilLevel, GT_MetaTileEntity_OilCracker::getCoilLevel))
+ .addElement('l', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addLeftHatchToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ .addElement('r', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addRightHatchToMachineList, CASING_INDEX, 3),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ .addElement('m', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addMiddleInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1),
+ ofHatchAdder(GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1),
+ onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1))
+ ))
+ .build();
private HeatingCoilLevel heatLevel;
+ protected final List<GT_MetaTileEntity_Hatch_Input> mMiddleInputHatches = new ArrayList<>();
+ // 0 -> left, 1 -> right, any other -> not found
+ protected int mInputOnSide;
+ protected int mOutputOnSide;
+ protected int mCasingAmount;
public GT_MetaTileEntity_OilCracker(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -48,7 +82,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
}
@Override
- public String[] getDescription() {
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Cracker")
.addInfo("Controller block for the Oil Cracking Unit")
@@ -60,27 +94,27 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
.addController("Front center")
.addCasingInfo("Clean Stainless Steel Machine Casing", 18)
.addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller")
- .addInfo("Gets 5% energy cost reduction per coil tier")
- .addEnergyHatch("Any casing")
- .addMaintenanceHatch("Any casing")
- .addInputHatch("Steam/Hydrogen, Any middle ring casing")
- .addInputHatch("Any left/right side casing")
- .addOutputHatch("Any left/right side casing")
+ .addInfo("Gets 5% EU/t reduction per coil tier")
+ .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");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return tt.getInformation();
- return tt.getStructureInformation();
+ return tt;
}
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
if (aActive) return new ITexture[]{casingTexturePages[0][CASING_INDEX],
- TextureFactory.of(OVERLAY_FRONT_OIL_CRACKER_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{casingTexturePages[0][CASING_INDEX],
- TextureFactory.of(OVERLAY_FRONT_OIL_CRACKER),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW).extFacing().glow().build()};
}
return new ITexture[]{casingTexturePages[0][CASING_INDEX]};
}
@@ -91,13 +125,18 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
}
@Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sCrakingRecipes;
+ }
+
+ @Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tInputList = getStoredFluids();
FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[0]);
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCrakingRecipes.findRecipe(
+ GT_Recipe tRecipe = getRecipeMap().findRecipe(
getBaseMetaTileEntity(),
false,
gregtech.api.enums.GT_Values.V[tTier],
@@ -111,12 +150,10 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
if (tRecipe.isRecipeInputEqual(true, tFluidInputs, mInventory[1])) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
- this.mEUt = tRecipe.mEUt;
- this.mMaxProgresstime = tRecipe.mDuration;
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
+ calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
this.mEUt *= Math.pow(0.95D, this.heatLevel.getTier());
@@ -129,141 +166,99 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
return false;
}
- private boolean coilsNotPresent(IGregTechTileEntity aBaseMetaTileEntity, int x , int y, int z) {
-
- Block coil = aBaseMetaTileEntity.getBlockOffset(x, y, z);
-
- if (!(coil instanceof IHeatingCoil))
- return true;
-
- IHeatingCoil heatingCoil = (IHeatingCoil) coil;
- byte meta = aBaseMetaTileEntity.getMetaIDOffset(x, y, z);
- HeatingCoilLevel heatLevel = heatingCoil.getCoilHeat(meta);
- if (heatLevel == HeatingCoilLevel.None)
- return true;
-
- if (this.heatLevel == HeatingCoilLevel.None)
- this.heatLevel = heatLevel;
-
- return this.heatLevel != heatLevel;
+ @Override
+ public IStructureDefinition<GT_MetaTileEntity_OilCracker> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
}
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- this.heatLevel = HeatingCoilLevel.None;
- this.orientation = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing());
- this.controllerX = aBaseMetaTileEntity.getXCoord();
- this.controllerZ = aBaseMetaTileEntity.getZCoord();
- int xDir = this.orientation.offsetX;
- int zDir = this.orientation.offsetZ;
- MutableInt amount = new MutableInt(0);
- replaceDeprecatedCoils(aBaseMetaTileEntity);
- BitSet flags = new BitSet(4);
-
- for (int depth = -1; depth < 2; depth++)
- for (int height = -1; height < 2; height++)
- for (int slice = -2; slice < 3; slice++)
- if (xDir == 0) {
- if (isStructureBroken(xDir, zDir, slice, height, depth, aBaseMetaTileEntity, amount, flags))
- return false;
- } else {
- if (isStructureBroken(xDir, zDir, depth, height, slice, aBaseMetaTileEntity, amount, flags))
- return false;
- }
-
- if(checkInputOutputBroken(flags))
- return false;
+ public HeatingCoilLevel getCoilLevel() {
+ return heatLevel;
+ }
- return amount.intValue() >= 18;
+ public void setCoilLevel(HeatingCoilLevel aCoilLevel) {
+ heatLevel = aCoilLevel;
}
- private boolean checkInputOutputBroken(BitSet flags){
- if (flags.get(0) && flags.get(2)) //input and output on side 1
- return true;
- if (flags.get(1) && flags.get(3)) //input and output on side 2
- return true;
- if (flags.get(1) && flags.get(2)) //input on both sides
- return true;
- return flags.get(2) && flags.get(3); //output on both sides
+ private boolean addMiddleInputToMachineList(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_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity;
+ tHatch.updateTexture(aBaseCasingIndex);
+ tHatch.mRecipeMap = getRecipeMap();
+ return mMiddleInputHatches.add(tHatch);
+ }
+ return false;
}
- private boolean isStructureBroken(
- int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- MutableInt amount,
- BitSet flags) {
- if (b == 0 && c == 0 && (a == -1 || a == 0 || a == 1))
- return false;
- if (a == 1 || a == -1) {
- return coilsNotPresent(aBaseMetaTileEntity, xDir + a, b, c + zDir);
+ private boolean addLeftHatchToMachineList(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 (mInputOnSide == 1)
+ return false;
+ mInputOnSide = 0;
+ mOutputOnSide = 1;
+ GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity;
+ tHatch.updateTexture(aBaseCasingIndex);
+ tHatch.mRecipeMap = getRecipeMap();
+ return mInputHatches.add(tHatch);
}
- else if (a == 2 || a == -2) {
- return checkEndsBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, amount, flags);
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ if (mOutputOnSide == 1)
+ return false;
+ mInputOnSide = 1;
+ mOutputOnSide = 0;
+ GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity;
+ tHatch.updateTexture(aBaseCasingIndex);
+ return mOutputHatches.add(tHatch);
}
- else if (a == 0)
- return checkMiddleBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, amount);
-
return false;
}
- private boolean checkEndsBroken(
- int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- MutableInt amount,
- BitSet flags
- ){
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + c, b, a + zDir);
- if (addInputToMachineList(tTileEntity, CASING_INDEX))
- if (a == -2)
- flags.set(0); //input on side 1
- else
- flags.set(1); //input on side 2
- else if (addOutputToMachineList(tTileEntity, CASING_INDEX))
- if (a == -2)
- flags.set(2); //output on side 1
- else
- flags.set(3); //output on side 2
- else if (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
- if (!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + c, b, a + zDir) != GregTech_API.sBlockCasings4)
- return true;
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + c, b, a + zDir) != 1)
- return true;
- amount.increment();
- }
+ private boolean addRightHatchToMachineList(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 (mInputOnSide == 0)
+ return false;
+ mInputOnSide = 1;
+ mOutputOnSide = 0;
+ GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity;
+ tHatch.updateTexture(aBaseCasingIndex);
+ tHatch.mRecipeMap = getRecipeMap();
+ return mInputHatches.add(tHatch);
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ if (mOutputOnSide == 0)
+ return false;
+ mInputOnSide = 0;
+ mOutputOnSide = 1;
+ GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity;
+ tHatch.updateTexture(aBaseCasingIndex);
+ return mOutputHatches.add(tHatch);
+ }
return false;
}
- private boolean checkMiddleBroken( int xDir,
- int zDir,
- int a,
- int b,
- int c,
- IGregTechTileEntity aBaseMetaTileEntity,
- MutableInt amount){
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + c, b, a + zDir);
- if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
- return false;
- if (addInputToMachineList(tTileEntity, CASING_INDEX))
- return false;
- if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
- return false;
- if ((xDir + c) == 0 && b == 0 && (a + zDir) == 0)
- return false;
- if (aBaseMetaTileEntity.getBlockOffset(xDir + c, b, a + zDir) != GregTech_API.sBlockCasings4)
- return true;
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + c, b, a + zDir) != 1)
- return true;
- amount.increment();
- return false;
+ private void onCasingAdded() {
+ mCasingAmount++;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ setCoilLevel(HeatingCoilLevel.None);
+ mCasingAmount = 0;
+ mMiddleInputHatches.clear();
+ mInputOnSide = -1;
+ mOutputOnSide = -1;
+ replaceDeprecatedCoils(aBaseMetaTileEntity);
+ return checkPiece(STRUCTURE_PIECE_MAIN, 2, 1, 0) &&
+ mInputOnSide != -1 && mOutputOnSide != -1 && mCasingAmount >= 18 &&
+ mMaintenanceHatches.size() == 1 && !mMiddleInputHatches.isEmpty();
}
@Override
@@ -332,20 +327,23 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
+ rList.add(tHatch.getFillableStack());
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_Input tHatch : mMiddleInputHatches) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
FluidStack tStack = tHatch.getFillableStack();
if (tStack.isFluidEqual(GT_ModHandler.getSteam(1000)) || tStack.isFluidEqual(Materials.Hydrogen.getGas(1000))) {
- if (isHatchInMiddleRing(tHatch))
- rList.add(tStack);
- } else if (!isHatchInMiddleRing(tHatch))
rList.add(tStack);
+ }
}
}
return rList;
}
- private boolean isHatchInMiddleRing(GT_MetaTileEntity_Hatch_Input inputHatch){
- if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
- return inputHatch.getBaseMetaTileEntity().getXCoord() == this.controllerX;
- return inputHatch.getBaseMetaTileEntity().getZCoord() == this.controllerZ;
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 2, 1, 0);
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java
index 73d8131fed..610c21e89b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OilDrill1 extends GT_MetaTileEntity_OilDrillBase {
public GT_MetaTileEntity_OilDrill1(int aID, String aName, String aNameRegional) {
@@ -15,8 +16,8 @@ public class GT_MetaTileEntity_OilDrill1 extends GT_MetaTileEntity_OilDrillBase
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("I");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("I");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java
index 9d36b340d3..eab1ebf614 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OilDrill2 extends GT_MetaTileEntity_OilDrillBase {
public GT_MetaTileEntity_OilDrill2(int aID, String aName, String aNameRegional) {
@@ -15,8 +16,8 @@ public class GT_MetaTileEntity_OilDrill2 extends GT_MetaTileEntity_OilDrillBase
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("II");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("II");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java
index 8ebc658406..738f60544b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OilDrill3 extends GT_MetaTileEntity_OilDrillBase {
public GT_MetaTileEntity_OilDrill3(int aID, String aName, String aNameRegional) {
@@ -15,8 +16,8 @@ public class GT_MetaTileEntity_OilDrill3 extends GT_MetaTileEntity_OilDrillBase
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("III");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("III");
}
@Override
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 44fb734534..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
@@ -19,7 +19,6 @@ import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
-import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -52,12 +51,12 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
getCasingTextureForId(casingTextureIndex),
- TextureFactory.of(OVERLAY_FRONT_OIL_DRILL_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
getCasingTextureForId(casingTextureIndex),
- TextureFactory.of(OVERLAY_FRONT_OIL_DRILL),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_GLOW).extFacing().glow().build()};
}
return new ITexture[]{getCasingTextureForId(casingTextureIndex)};
}
@@ -77,7 +76,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
chunkRangeConfig = aNBT.getInteger("chunkRangeConfig");
}
- protected String[] getDescriptionInternal(String tierSuffix) {
+ protected GT_Multiblock_Tooltip_Builder createTooltip(String tierSuffix) {
String casings = getCasingBlockItem().get(0).getDisplayName();
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
@@ -93,16 +92,12 @@ 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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java
index d23ce2edd0..ac3e40c5f5 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OreDrillingPlant1 extends GT_MetaTileEntity_OreDrillingPlantBase {
public GT_MetaTileEntity_OreDrillingPlant1(int aID, String aName, String aNameRegional) {
@@ -17,8 +18,8 @@ public class GT_MetaTileEntity_OreDrillingPlant1 extends GT_MetaTileEntity_OreDr
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("I");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("I");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java
index db7c4cd9e7..bf9c628911 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDrillingPlantBase {
public GT_MetaTileEntity_OreDrillingPlant2(int aID, String aName, String aNameRegional) {
@@ -17,8 +18,8 @@ public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDr
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("II");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("II");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java
index b7053a8ebd..411bbef3a7 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDrillingPlantBase {
public GT_MetaTileEntity_OreDrillingPlant3(int aID, String aName, String aNameRegional) {
@@ -17,8 +18,8 @@ public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDr
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("III");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("III");
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java
index db86b963ca..d7daea327c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDrillingPlantBase {
public GT_MetaTileEntity_OreDrillingPlant4(int aID, String aName, String aNameRegional) {
@@ -17,8 +18,8 @@ public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDr
}
@Override
- public String[] getDescription() {
- return getDescriptionInternal("IV");
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ return createTooltip("IV");
}
@Override
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 224f1de557..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
@@ -332,7 +332,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
protected abstract int getBaseProgressTime();
- protected String[] getDescriptionInternal(String tierSuffix) {
+ protected GT_Multiblock_Tooltip_Builder createTooltip(String tierSuffix) {
String casings = getCasingBlockItem().get(0).getDisplayName();
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
@@ -350,17 +350,13 @@ 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");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ return tt;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java
index f1b304a1b1..eab4e9c896 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java
@@ -282,7 +282,7 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn
for (int i = 0; i < limit; i++) {
int absi = INPUT_SLOTS + i;
if (this.mInventory[absi] == null) {
- this.mInventory[absi] = GT_Utility.copy(this.mOutputItems[i]);
+ this.mInventory[absi] = GT_Utility.copyOrNull(this.mOutputItems[i]);
} else if (GT_Utility.areStacksEqual(this.mInventory[absi], this.mOutputItems[i])) {
this.mInventory[absi].stackSize = Math.min(this.mInventory[absi].getMaxStackSize(),
this.mInventory[absi].stackSize + this.mOutputItems[i].stackSize);
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..26cccb7819 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<GT_MetaTileEntity_ProcessingArray> {
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")
@@ -76,18 +76,14 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -95,12 +91,12 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
if (aSide == aFacing) {
if (aActive) return new ITexture[]{
BlockIcons.casingTexturePages[0][48],
- TextureFactory.of(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW).extFacing().glow().build()};
return new ITexture[]{
BlockIcons.casingTexturePages[0][48],
- TextureFactory.of(OVERLAY_FRONT_PROCESSING_ARRAY),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW).extFacing().glow().build()};
}
return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][48]};
}
@@ -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<GT_MetaTileEntity_CubicMultiBlockBase<?>> getCasingElement() {
+ return ofBlock(GregTech_API.sBlockCasings4, 0);
+ }
+
+ @Override
+ protected int getHatchTextureIndex() {
+ return 48;
+ }
+
+ @Override
+ protected int getRequiredCasingCount() {
+ return 14;
}
@Override
@@ -408,25 +385,27 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
return new String[]{
StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " +
- EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " +
- EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " +
- EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " +
- EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU",
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU",
StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " +
- EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t",
+ EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t",
StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " +
- EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " +
+ StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET,
StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
- EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
- " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " +
+ StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %",
StatCollector.translateToLocal("GT5U.PA.machinetier") + ": " +
- EnumChatFormatting.GREEN + tTier + EnumChatFormatting.RESET +
- " " + StatCollector.translateToLocal("GT5U.PA.discount") + ": " +
+ EnumChatFormatting.GREEN + tTier + EnumChatFormatting.RESET + " " +
+ StatCollector.translateToLocal("GT5U.PA.discount") + ": " +
EnumChatFormatting.GREEN + (1 << mMult) + EnumChatFormatting.RESET + " x",
- StatCollector.translateToLocal("GT5U.PA.parallel") + ": " + EnumChatFormatting.GREEN + ((mInventory[1] != null) ? (mInventory[1].stackSize << mMult) : 0) + EnumChatFormatting.RESET
+ StatCollector.translateToLocal("GT5U.PA.parallel") + ": " +
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mInventory[1] != null) ? (mInventory[1].stackSize << mMult) : 0) + EnumChatFormatting.RESET
};
}
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 701a81b6ba..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
@@ -1,41 +1,76 @@
package gregtech.common.tileentities.machines.multi;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import cpw.mods.fml.common.Loader;
-import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
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;
import gregtech.api.util.GT_Utility;
-import gregtech.loaders.oreprocessing.ProcessingLog;
-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 net.minecraftforge.oredict.OreDictionary;
-import org.apache.commons.lang3.mutable.MutableBoolean;
-import org.lwjgl.input.Keyboard;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockUnlocalizedName;
+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<GT_MetaTileEntity_PyrolyseOven> {
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<GT_MetaTileEntity_PyrolyseOven> STRUCTURE_DEFINITION = createStructureDefinition();
+
+ private static IStructureDefinition<GT_MetaTileEntity_PyrolyseOven> createStructureDefinition() {
+ IStructureElement<GT_MetaTileEntity_PyrolyseOven> tCasingElement =
+ Loader.isModLoaded("dreamcraft") ?
+ ofBlockUnlocalizedName("dreamcraft", "gt.blockcasingsNH", 2) :
+ ofBlock(GregTech_API.sBlockCasings1, 0);
+
+ return StructureDefinition.<GT_MetaTileEntity_PyrolyseOven>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, tCasingElement))
+ .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, tCasingElement)
+ ))
+ .addElement('t', ofChain(
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addInputToMachineList, CASING_INDEX, 2),
+ ofHatchAdder(GT_MetaTileEntity_PyrolyseOven::addMufflerToMachineList, CASING_INDEX, 2),
+ onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement)
+ ))
+ .build();
+ }
+
+ private int mCasingAmount;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -46,7 +81,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")
@@ -60,19 +95,15 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
.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");
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getStructureInformation();
- } else {
- return tt.getInformation();
- }
+ return tt;
}
@Override
@@ -81,12 +112,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]};
}
@@ -108,10 +139,6 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- //Dynamic recipe adding for newly found logWoods - wont be visible in nei most probably
- if (tRecipe == null)
- tRecipe = addRecipesDynamically(tInputs, tFluids, tTier);
-
if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
return false;
@@ -133,172 +160,30 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return true;
}
- private GT_Recipe addRecipesDynamically(ItemStack[] tInputs, FluidStack[] tFluids, int tTier) {
- if (tInputs.length > 1 || (tInputs[0] != null && tInputs[0].getItem() != GT_Utility.getIntegratedCircuit(0).getItem())) {
- int oreId = OreDictionary.getOreID("logWood");
- for (ItemStack is : tInputs) {
- for (int id : OreDictionary.getOreIDs(is)) {
- if (oreId == id) {
- ProcessingLog.addPyrolyeOvenRecipes(is);
- return GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- }
- }
- }
- }
- return null;
- }
-
@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<GT_MetaTileEntity_PyrolyseOven> 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 void onCasingAdded() {
+ mCasingAmount++;
}
- 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;
+ public HeatingCoilLevel getCoilLevel() {
+ return coilHeat;
}
- 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);
- }
-
- 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 &&
+ mMaintenanceHatches.size() == 1 && !mMufflerHatches.isEmpty();
}
@Override
@@ -346,4 +231,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);
+ }
}
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..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
@@ -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<GT_MetaTileEntity_VacuumFreezer> {
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", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .toolTipFinisher("Gregtech");
+ return tt;
}
@Override
@@ -66,13 +62,13 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc
if (aActive) {
rTexture = new ITexture[]{
casingTexturePages[0][17],
- TextureFactory.of(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW).extFacing().glow().build()};
} else {
rTexture = new ITexture[]{
casingTexturePages[0][17],
- TextureFactory.of(OVERLAY_FRONT_VACUUM_FREEZER),
- TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_GLOW).glow().build()};
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER).extFacing().build(),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_GLOW).extFacing().glow().build()};
}
} else {
rTexture = new ITexture[]{casingTexturePages[0][17]};
@@ -96,11 +92,6 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- @Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs();
for (ItemStack tInput : tInputList) {
@@ -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<GT_MetaTileEntity_CubicMultiBlockBase<?>> getCasingElement() {
+ return StructureUtility.ofBlock(GregTech_API.sBlockCasings2, 1);
+ }
+
+ @Override
+ protected int getHatchTextureIndex() {
+ return 17;
+ }
+
+ @Override
+ protected int getRequiredCasingCount() {
+ return 16;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
index d78dd722fa..7110ed20f9 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
@@ -2,6 +2,7 @@ package gregtech.common.tileentities.storage;
import cpw.mods.fml.common.Optional;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
@@ -31,7 +32,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 3, new String[]{
- "This Chest stores " + commonSizeCompute(aTier) + " Blocks",
+ "This Chest stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + " Blocks",
"Use a screwdriver to enable",
"voiding items on overflow"
});
@@ -102,7 +103,10 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
@Optional.Method(modid = "appliedenergistics2")
@Override
public boolean isPrioritized(appeng.api.storage.data.IAEItemStack iaeItemStack) {
- return false;
+ ItemStack s = getItemStack();
+ if (s == null || iaeItemStack == null)
+ return false;
+ return iaeItemStack.isSameType(s);
}
@Optional.Method(modid = "appliedenergistics2")
@@ -364,15 +368,15 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
"Stored Items:",
EnumChatFormatting.GOLD + "No Items" + EnumChatFormatting.RESET,
EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET + " " +
- EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxItemCount()) + EnumChatFormatting.RESET
};
}
return new String[]{
EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET,
"Stored Items:",
EnumChatFormatting.GOLD + getItemStack().getDisplayName() + EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(getItemCount()) + EnumChatFormatting.RESET + " " +
- EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getItemCount()) + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxItemCount()) + EnumChatFormatting.RESET
};
}
@@ -403,6 +407,24 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
});
}
+ @Optional.Method(modid = "appliedenergistics2")
+ private boolean hasActiveMEConnection() {
+ if (listeners == null || listeners.isEmpty())
+ return false;
+ for (Map.Entry<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> e : listeners.entrySet())
+ {
+ if ((e.getKey() instanceof appeng.api.parts.IPart))
+ {
+ appeng.api.networking.IGridNode n = ((appeng.api.parts.IPart) e.getKey()).getGridNode();
+ if (n != null && n.isActive())
+ return true;
+ }
+ }
+ // if there are no active storage buses - clear the listeners
+ listeners.clear();
+ return false;
+ }
+
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setInteger("mItemCount", getItemCount());
@@ -423,11 +445,15 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection())
+ return false;
return aIndex == 1;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection())
+ return false;
return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack));
}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java
index 396b6d6464..ea935f1360 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java
@@ -5,6 +5,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
@@ -15,7 +16,8 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW;
public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank {
public GT_MetaTileEntity_QuantumTank(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + commonSizeCompute(aTier) + "L of fluid");
+ super(aID, aName, aNameRegional, aTier, 3,
+ "Stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + "L of fluid");
}
private static int commonSizeCompute(int tier) {
@@ -143,15 +145,15 @@ public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank {
"Stored Fluid:",
EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET,
EnumChatFormatting.GREEN + Integer.toString(0) + " L" + EnumChatFormatting.RESET + " " +
- EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET
};
}
return new String[]{
EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET,
"Stored Fluid:",
EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " +
- EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET
};
}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
index 41171720f5..edb69abb20 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
@@ -5,6 +5,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
@@ -15,7 +16,8 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW;
public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank {
public GT_MetaTileEntity_SuperTank(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + commonSizeCompute(aTier) + "L of fluid");
+ super(aID, aName, aNameRegional, aTier, 3,
+ "Stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + "L of fluid");
}
private static int commonSizeCompute(int tier) {
@@ -143,15 +145,15 @@ public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank {
"Stored Fluid:",
EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET,
EnumChatFormatting.GREEN + "0 L" + EnumChatFormatting.RESET + " " +
- EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET
};
}
return new String[]{
EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET,
"Stored Fluid:",
EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " +
- EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET
};
}