diff options
31 files changed, 476 insertions, 104 deletions
diff --git a/dependencies.gradle b/dependencies.gradle index 983d1205ce..0180eebb0b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { shadowImplementation('com.github.GTNewHorizons:AVRcore:master-SNAPSHOT') - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.128-pre:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.135-pre:dev') compile('com.github.GTNewHorizons:Yamcl:0.5.84:dev') compile('com.github.GTNewHorizons:NotEnoughItems:2.3.7-GTNH:dev') compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev') diff --git a/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java b/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java index 26c484f4b1..b09984e388 100644 --- a/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java +++ b/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java @@ -13,7 +13,11 @@ public class TecTechUITextures { AdaptableUITexture.of(MODID, "gui/background/screen_blue", 90, 72, 2); public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16"); + public static final UITexture BUTTON_STANDARD_LIGHT_16x16 = + UITexture.fullImage(MODID, "gui/button/standard_light_16x16"); + public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_DISABLED = + UITexture.fullImage(MODID, "gui/overlay_button/power_switch_disabled"); public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_OFF = UITexture.fullImage(MODID, "gui/overlay_button/power_switch_off"); public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_ON = @@ -23,9 +27,22 @@ public class TecTechUITextures { public static final UITexture[] OVERLAY_BUTTON_UNCERTAINTY = IntStream.range(0, 16) .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_button/uncertainty/" + i)) .collect(Collectors.toList()) - .toArray(new UITexture[] {}); + .toArray(new UITexture[0]); + public static final UITexture OVERLAY_BUTTON_SAFE_VOID_DISABLED = + UITexture.fullImage(MODID, "gui/overlay_button/safe_void_disabled"); + public static final UITexture OVERLAY_BUTTON_SAFE_VOID_OFF = + UITexture.fullImage(MODID, "gui/overlay_button/safe_void_off"); + public static final UITexture OVERLAY_BUTTON_SAFE_VOID_ON = + UITexture.fullImage(MODID, "gui/overlay_button/safe_void_on"); + public static final UITexture OVERLAY_BUTTON_POWER_PASS_DISABLED = + UITexture.fullImage(MODID, "gui/overlay_button/power_pass_disabled"); + public static final UITexture OVERLAY_BUTTON_POWER_PASS_OFF = + UITexture.fullImage(MODID, "gui/overlay_button/power_pass_off"); + public static final UITexture OVERLAY_BUTTON_POWER_PASS_ON = + UITexture.fullImage(MODID, "gui/overlay_button/power_pass_on"); public static final UITexture OVERLAY_SLOT_RACK = UITexture.fullImage(MODID, "gui/overlay_slot/rack"); + public static final UITexture OVERLAY_SLOT_MESH = UITexture.fullImage(MODID, "gui/overlay_slot/mesh"); public static final UITexture PICTURE_TECTECH_LOGO = UITexture.fullImage(MODID, "gui/picture/tectech_logo"); public static final UITexture PICTURE_TECTECH_LOGO_DARK = @@ -41,9 +58,34 @@ public class TecTechUITextures { public static final UITexture[] PICTURE_UNCERTAINTY_VALID = IntStream.range(0, 9) .mapToObj(i -> UITexture.fullImage(MODID, "gui/picture/uncertainty/valid_" + i)) .collect(Collectors.toList()) - .toArray(new UITexture[] {}); + .toArray(new UITexture[0]); public static final UITexture[] PICTURE_UNCERTAINTY_INVALID = IntStream.range(0, 9) .mapToObj(i -> UITexture.fullImage(MODID, "gui/picture/uncertainty/invalid_" + i)) .collect(Collectors.toList()) - .toArray(new UITexture[] {}); + .toArray(new UITexture[0]); + public static final UITexture PICTURE_HEAT_SINK_SMALL = UITexture.fullImage(MODID, "gui/picture/heat_sink_small"); + public static final UITexture PICTURE_PARAMETER_BLANK = UITexture.fullImage(MODID, "gui/picture/parameter_blank"); + public static final UITexture[] PICTURE_PARAMETER_BLUE = IntStream.range(0, 20) + .mapToObj(i -> UITexture.partly(MODID, "gui/picture/parameter_blue", 158, 4, i * 8, 0, i * 8 + 6, 4)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture[] PICTURE_PARAMETER_CYAN = IntStream.range(0, 20) + .mapToObj(i -> UITexture.partly(MODID, "gui/picture/parameter_cyan", 158, 4, i * 8, 0, i * 8 + 6, 4)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture[] PICTURE_PARAMETER_GREEN = IntStream.range(0, 20) + .mapToObj(i -> UITexture.partly(MODID, "gui/picture/parameter_green", 158, 4, i * 8, 0, i * 8 + 6, 4)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture[] PICTURE_PARAMETER_ORANGE = IntStream.range(0, 20) + .mapToObj(i -> UITexture.partly(MODID, "gui/picture/parameter_orange", 158, 4, i * 8, 0, i * 8 + 6, 4)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture[] PICTURE_PARAMETER_RED = IntStream.range(0, 20) + .mapToObj(i -> UITexture.partly(MODID, "gui/picture/parameter_red", 158, 4, i * 8, 0, i * 8 + 6, 4)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture PICTURE_PARAMETER_GRAY = UITexture.fullImage(MODID, "gui/picture/parameter_gray"); + public static final UITexture PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE = + UITexture.fullImage(MODID, "gui/picture/uncertainty/monitor_multimachine"); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java index 9381f432f3..af6197be39 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -160,13 +160,13 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch impl }) .setPos(79, 38)) .widget(new DrawableWidget() - .setDrawable(TecTechUITextures.BUTTON_STANDARD_16x16) + .setDrawable(TecTechUITextures.BUTTON_STANDARD_LIGHT_16x16) .setPos(152, 24) .setSize(16, 16)) .widget(new DrawableWidget() .setDrawable(() -> getBaseMetaTileEntity().isActive() ? TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_ON - : TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF) + : TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_DISABLED) .setPos(152, 24) .setSize(16, 16)) .widget(new FakeSyncWidget.BooleanSyncer( diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java index cede4a33b1..b99e030559 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java @@ -328,20 +328,20 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem .setPos(positions[i])); builder.widget(new DrawableWidget() - .setDrawable(TecTechUITextures.BUTTON_STANDARD_16x16) + .setDrawable(TecTechUITextures.BUTTON_STANDARD_LIGHT_16x16) .setPos(152, 24) .setSize(16, 16)) .widget(new DrawableWidget() .setDrawable(() -> getBaseMetaTileEntity().isActive() ? TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_ON - : TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF) + : TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_DISABLED) .setPos(152, 24) .setSize(16, 16)) .widget(new FakeSyncWidget.BooleanSyncer( () -> getBaseMetaTileEntity().isActive(), val -> getBaseMetaTileEntity().setActive(val))); builder.widget(new DrawableWidget() - .setDrawable(TecTechUITextures.BUTTON_STANDARD_16x16) + .setDrawable(TecTechUITextures.BUTTON_STANDARD_LIGHT_16x16) .setPos(152, 41) .setSize(16, 16)) .widget(new DrawableWidget() diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 01eab07bd5..c663fea79b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -14,8 +14,6 @@ import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; @@ -38,7 +36,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -176,23 +173,6 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName(), - "EMDisplay.png", - true, - false, - true); // todo texture - } - - @Override public ITexture[] getTexture( IGregTechTileEntity aBaseMetaTileEntity, byte aSide, @@ -301,4 +281,19 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB return GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList; } } + + @Override + public boolean isPowerPassButtonEnabled() { + return true; + } + + @Override + public boolean isSafeVoidButtonEnabled() { + return false; + } + + @Override + public boolean isAllowedToWorkButtonEnabled() { + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index d7159ab682..de338c53e8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -12,8 +12,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.util.CommonValues; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; @@ -27,7 +25,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -277,17 +274,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa return tt; } - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true); - } - public static final ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_whooum"); @Override @@ -310,4 +296,19 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa public String[] getStructureDescription(ItemStack stackSize) { return description; } + + @Override + public boolean isPowerPassButtonEnabled() { + return true; + } + + @Override + public boolean isSafeVoidButtonEnabled() { + return false; + } + + @Override + public boolean isAllowedToWorkButtonEnabled() { + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 613dbe0e21..faf94436ce 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -13,8 +13,6 @@ import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static net.minecraft.util.StatCollector.translateToLocal; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.CommonValues; @@ -29,7 +27,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -154,17 +151,6 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, false); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, false); - } - - @Override public ITexture[] getTexture( IGregTechTileEntity aBaseMetaTileEntity, byte aSide, @@ -224,4 +210,19 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo public String[] getStructureDescription(ItemStack stackSize) { return description; } + + @Override + public boolean isPowerPassButtonEnabled() { + return true; + } + + @Override + public boolean isSafeVoidButtonEnabled() { + return false; + } + + @Override + public boolean isAllowedToWorkButtonEnabled() { + return false; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 4406977759..112405ff05 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -29,7 +29,6 @@ import java.util.HashSet; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; @@ -240,23 +239,6 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName(), - "EMDisplay.png", - true, - false, - true); // todo texture - } - - @Override public ITexture[] getTexture( IGregTechTileEntity aBaseMetaTileEntity, byte aSide, @@ -326,4 +308,19 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock public String[] getStructureDescription(ItemStack stackSize) { return description; } + + @Override + public boolean isPowerPassButtonEnabled() { + return true; + } + + @Override + public boolean isSafeVoidButtonEnabled() { + return false; + } + + @Override + public boolean isAllowedToWorkButtonEnabled() { + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index a26003dd74..66d7acf2c2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -11,6 +11,7 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +@Deprecated public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public LedStatus[] eParamsInStatus = LedStatus.makeArray(20, LedStatus.STATUS_UNDEFINED); public LedStatus[] eParamsOutStatus = LedStatus.makeArray(20, LedStatus.STATUS_UNDEFINED); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 0c20d76dae..cca5eee361 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -15,6 +15,7 @@ import org.lwjgl.opengl.GL12; /** * Created by Tec on 21.02.2017. */ +@Deprecated public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { protected final String mName; protected static byte counter = 0; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index bc5cece66c..17ca3ae2d9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -7,6 +7,7 @@ import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.util.DoubleCount.div; import static com.github.technus.tectech.util.TT_Utility.getTier; import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static java.lang.Math.min; import com.github.technus.tectech.Reference; @@ -15,6 +16,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.thing.gui.TecTechUITextures; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.TT_Utility; @@ -29,6 +31,17 @@ import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.util.Vec3Impl; +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.api.math.Pos2d; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.api.widget.Widget; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -36,6 +49,7 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.modularui.IBindPlayerInventoryUI; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -51,19 +65,19 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -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.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.opengl.GL11; /** * Created by danie_000 on 27.10.2016. */ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_TooltipMultiBlockBase - implements IAlignment { + implements IAlignment, IBindPlayerInventoryUI { // region Client side variables (static - one per class) // Front icon holders - static so it is default one for my blocks @@ -517,33 +531,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt // region GUI/SOUND/RENDER /** - * Server side container - * - * @param aID - * @param aPlayerInventory - * @param aBaseMetaTileEntity - * @return - */ - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity); - } - - /** - * Client side gui - * - * @param aID - * @param aPlayerInventory - * @param aBaseMetaTileEntity - * @return - */ - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png"); - } - - /** * add more textures * * @param aBlockIconRegister @@ -2904,4 +2891,351 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } return false; } + + // region ModularUI + + @Override + public int getGUIWidth() { + return 198; + } + + @Override + public int getGUIHeight() { + return 192; + } + + @Override + public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.bindPlayerInventory( + buildContext.getPlayer(), new Pos2d(7, 109), getGUITextureSet().getItemSlot()); + } + + public boolean isPowerPassButtonEnabled() { + return true; + } + + public boolean isSafeVoidButtonEnabled() { + return true; + } + + public boolean isAllowedToWorkButtonEnabled() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(TecTechUITextures.PICTURE_TECTECH_LOGO_DARK) + .setSize(18, 18) + .setPos(173, 74)); + } + + private static byte LEDCounter = 0; + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE) + .setPos(4, 4) + .setSize(190, 91)); + final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1); + builder.widget(inventorySlot + .setBackground(getGUITextureSet().getItemSlot(), TecTechUITextures.OVERLAY_SLOT_MESH) + .setPos(173, 167)) + .widget(new DrawableWidget() + .setDrawable(TecTechUITextures.PICTURE_HEAT_SINK_SMALL) + .setPos(173, 185) + .setSize(18, 6)); + + final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); + drawTexts(screenElements, inventorySlot); + builder.widget(screenElements.setPos(7, 8)); + + Widget powerPassButton = new ButtonWidget() + .setOnClick((clickData, widget) -> { + if (isPowerPassButtonEnabled() || ePowerPassCover) { + TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); + ePowerPass = !ePowerPass; + if (!isAllowedToWorkButtonEnabled()) { // TRANSFORMER HACK + if (ePowerPass) { + getBaseMetaTileEntity().enableWorking(); + } else { + getBaseMetaTileEntity().disableWorking(); + } + } + } + }) + .setPlayClickSound(false) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(TecTechUITextures.BUTTON_STANDARD_16x16); + if (!isPowerPassButtonEnabled() && !ePowerPassCover) { + ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_PASS_DISABLED); + } else { + if (ePowerPass) { + ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_PASS_ON); + } else { + ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_PASS_OFF); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(174, 116) + .setSize(16, 16); + if (isPowerPassButtonEnabled()) { + powerPassButton.addTooltip("Power Pass").setTooltipShowUpDelay(TOOLTIP_DELAY); |
