From 5ee7bcd69067c8a457ba16191ce97f113e48f9d6 Mon Sep 17 00:00:00 2001 From: miozune Date: Fri, 18 Nov 2022 00:07:38 +0900 Subject: Uncertainty Resolvers --- .../tectech/thing/gui/TecTechUITextures.java | 26 ++++ .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 173 ++++++++++++++++++--- .../hatch/gui/GT_Container_Uncertainty.java | 127 --------------- .../hatch/gui/GT_GUIContainer_Uncertainty.java | 82 ---------- .../hatch/gui/GT_GUIContainer_UncertaintyAdv.java | 86 ---------- 5 files changed, 180 insertions(+), 314 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java (limited to 'src/main/java/com') 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 5f195bae64..26c484f4b1 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 @@ -2,10 +2,16 @@ package com.github.technus.tectech.thing.gui; import static com.github.technus.tectech.Reference.MODID; +import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; import com.gtnewhorizons.modularui.api.drawable.UITexture; +import java.util.stream.Collectors; +import java.util.stream.IntStream; public class TecTechUITextures { + public static final AdaptableUITexture BACKGROUND_SCREEN_BLUE = + 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 OVERLAY_BUTTON_POWER_SWITCH_OFF = @@ -14,10 +20,30 @@ public class TecTechUITextures { UITexture.fullImage(MODID, "gui/overlay_button/power_switch_on"); public static final UITexture OVERLAY_BUTTON_HEAT_OFF = UITexture.fullImage(MODID, "gui/overlay_button/heat_off"); public static final UITexture OVERLAY_BUTTON_HEAT_ON = UITexture.fullImage(MODID, "gui/overlay_button/heat_on"); + 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[] {}); public static final UITexture OVERLAY_SLOT_RACK = UITexture.fullImage(MODID, "gui/overlay_slot/rack"); public static final UITexture PICTURE_TECTECH_LOGO = UITexture.fullImage(MODID, "gui/picture/tectech_logo"); + public static final UITexture PICTURE_TECTECH_LOGO_DARK = + UITexture.fullImage(MODID, "gui/picture/tectech_logo_dark"); public static final UITexture PICTURE_RACK_LARGE = UITexture.fullImage(MODID, "gui/picture/rack_large"); public static final UITexture PICTURE_HEAT_SINK = UITexture.fullImage(MODID, "gui/picture/heat_sink"); + public static final UITexture PICTURE_UNCERTAINTY_MONITOR = + UITexture.fullImage(MODID, "gui/picture/uncertainty/monitor"); + public static final UITexture PICTURE_UNCERTAINTY_INDICATOR = + UITexture.fullImage(MODID, "gui/picture/uncertainty/indicator"); + public static final UITexture PICTURE_UNCERTAINTY_SELECTED = + UITexture.fullImage(MODID, "gui/picture/uncertainty/selected"); + 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[] {}); + 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[] {}); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java index 5c34243742..8dd056155c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java @@ -2,25 +2,36 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; +import static org.lwjgl.opengl.GL11.*; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Uncertainty; -import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Uncertainty; -import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_UncertaintyAdv; +import com.github.technus.tectech.thing.gui.TecTechUITextures; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.TT_Utility; +import com.gtnewhorizons.modularui.api.GlStateManager; +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.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; 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; @@ -30,7 +41,8 @@ import org.apache.commons.lang3.reflect.FieldUtils; /** * Created by danie_000 on 15.12.2016. */ -public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch { +public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch + implements IAddGregtechLogo, IAddUIWidgets { private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenOFF; public short[] matrix = @@ -58,19 +70,6 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/UC_ACTIVE"); } - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if (mTier > 7) { - return new GT_GUIContainer_UncertaintyAdv(aPlayerInventory, aBaseMetaTileEntity); - } - return new GT_GUIContainer_Uncertainty(aPlayerInventory, aBaseMetaTileEntity); - } - @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { return new ITexture[] {aBaseTexture, new GT_RenderedTexture(ScreenON)}; @@ -188,7 +187,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch } catch (Exception e) { clientLocale = "en_US"; } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -333,4 +332,140 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch // GT_Utility.sendChatToPlayer(aPlayer, "Equation mode: "+mode); // } // } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(TecTechUITextures.PICTURE_TECTECH_LOGO_DARK) + .setSize(18, 18) + .setPos(112, 55)); + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + final boolean isAdvanced = mTier > 7; + + builder.widget(new DrawableWidget() + .setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE) + .setPos(43, 4) + .setSize(90, 72)) + .widget(new DrawableWidget() + .setDrawable(TecTechUITextures.PICTURE_UNCERTAINTY_MONITOR) + .setPos(46, 27) + .setSize(46, 46)); + + int[] xPositions = new int[] {7, 25, 133, 151}; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + final int index = i * 4 + j; + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> { + TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); + if (selection == -1) { + selection = (byte) index; + } else { + short temp = matrix[selection]; + matrix[selection] = matrix[index]; + matrix[index] = temp; + selection = -1; + } + compute(); + }) + .setPlayClickSound(false) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + TecTechUITextures.OVERLAY_BUTTON_UNCERTAINTY[index]) + .setPos(xPositions[i], 4 + j * 18) + .setSize(18, 18)) + .widget(new FakeSyncWidget.ShortSyncer(() -> matrix[index], val -> matrix[index] = val)); + } + } + builder.widget(new FakeSyncWidget.ByteSyncer(() -> selection, val -> selection = val)) + .widget(new FakeSyncWidget.ByteSyncer(() -> mode, val -> mode = val)) + .widget(new FakeSyncWidget.ByteSyncer(() -> status, val -> status = val)); + + builder.widget(TextWidget.dynamicString(() -> "Status: " + (status == 0 ? "OK" : "NG")) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 7)); + + for (int i = 0; i < 9; i++) { + final int index = i; + builder.widget(new DrawableWidget() + .setDrawable(() -> { + UITexture valid = TecTechUITextures.PICTURE_UNCERTAINTY_VALID[index]; + UITexture invalid = TecTechUITextures.PICTURE_UNCERTAINTY_INVALID[index]; + switch (mode) { + case 1: // ooo oxo ooo + if (index == 4) return status == 0 ? valid : invalid; + break; + case 2: // ooo xox ooo + if (index == 3) return (status & 1) == 0 ? valid : invalid; + if (index == 5) return (status & 2) == 0 ? valid : invalid; + break; + case 3: // oxo xox oxo + if (index == 1) return (status & 1) == 0 ? valid : invalid; + if (index == 3) return (status & 2) == 0 ? valid : invalid; + if (index == 5) return (status & 4) == 0 ? valid : invalid; + if (index == 7) return (status & 8) == 0 ? valid : invalid; + break; + case 4: // xox ooo xox + if (index == 0) return (status & 1) == 0 ? valid : invalid; + if (index == 2) return (status & 2) == 0 ? valid : invalid; + if (index == 6) return (status & 4) == 0 ? valid : invalid; + if (index == 8) return (status & 8) == 0 ? valid : invalid; + break; + case 5: // xox oxo xox + if (index == 0) return (status & 1) == 0 ? valid : invalid; + if (index == 2) return (status & 2) == 0 ? valid : invalid; + if (index == 4) return (status & 4) == 0 ? valid : invalid; + if (index == 6) return (status & 8) == 0 ? valid : invalid; + if (index == 8) return (status & 16) == 0 ? valid : invalid; + break; + } + return null; + }) + .setPos(55 + (index % 3) * 12, 36 + (index / 3) * 12) + .setSize(4, 4)); + } + + for (int i = 0; i < 16; i++) { + final int index = i; + builder.widget( + new DrawableWidget() { + @Override + public void draw(float partialTicks) { + if (isAdvanced) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(1f, 1f, 1f, (float) matrix[index] / 1000f); + + // super.draw but without disabling blend + GlStateManager.pushMatrix(); + getDrawable().draw(Pos2d.ZERO, getSize(), partialTicks); + GlStateManager.popMatrix(); + + glDisable(GL_BLEND); + glColor4f(1f, 1f, 1f, 1f); + } else { + if (TecTech.RANDOM.nextInt(1000) < matrix[index]) { + super.draw(partialTicks); + } + } + } + }.setDrawable(TecTechUITextures.PICTURE_UNCERTAINTY_INDICATOR) + .setPos(47 + (i / 4) * 12, 28 + (i % 4) * 12) + .setSize(8, 8)) + .widget(new DrawableWidget() + .setDrawable( + () -> selection == index ? TecTechUITextures.PICTURE_UNCERTAINTY_SELECTED : null) + .setPos(46 + (i / 4) * 12, 27 + (i % 4) * 12) + .setSize(10, 10)); + } + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java deleted file mode 100644 index 88dab21c37..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Uncertainty; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { - public short[] matrix = - new short[] {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; - public byte selection = -1, mode = 0, status = -128; - - public GT_Container_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); - if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { - GT_MetaTileEntity_Hatch_Uncertainty catH = - (GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity(); - if (aSlotIndex < 16 && catH.matrix != null) { - IGregTechTileEntity base = catH.getBaseMetaTileEntity(); - TecTech.proxy.playSound(base, "fx_click"); - if (catH.selection == -1) { - catH.selection = (byte) aSlotIndex; - } else { - short temp = catH.matrix[catH.selection]; - catH.matrix[catH.selection] = catH.matrix[aSlotIndex]; - catH.matrix[aSlotIndex] = temp; - catH.selection = -1; - } - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - - ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).compute(); - - if (matrix != null) { - for (int i = 0; i < 16; i++) { - matrix[i] = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).matrix[i]; - } - } - - selection = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).selection; - mode = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).mode; - status = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).status; - - for (Object crafter : crafters) { - ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 100, selection); - var1.sendProgressBarUpdate(this, 101, mode); - var1.sendProgressBarUpdate(this, 102, status); - - if (matrix != null) { - for (int i = 0; i < 16; i++) { - var1.sendProgressBarUpdate(this, 103 + i, matrix[i]); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - selection = (byte) par2; - break; - case 101: - mode = (byte) par2; - break; - case 102: - status = (byte) par2; - break; - default: - if (matrix != null && par1 >= 103 && par1 < 119) { - matrix[par1 - 103] = (short) par2; - break; - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java deleted file mode 100644 index 5ef1ac9bc5..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.font.TecTechFontRender; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import org.lwjgl.opengl.GL11; - -public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine { - public GT_GUIContainer_Uncertainty(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - TecTechFontRender.INSTANCE.drawSplitString("Schr\u00F6dinger", 46, 7, 167, 0xffffff); - if (mContainer != null && ((GT_Container_Uncertainty) mContainer).status == 0) { - TecTechFontRender.INSTANCE.drawSplitString("Status: OK", 46, 16, 167, 0xffffff); - } else { - TecTechFontRender.INSTANCE.drawSplitString("Status: NG", 46, 16, 167, 0xffffff); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - if (mContainer != null && ((GT_Container_Uncertainty) mContainer).matrix != null) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - short bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; - x += 52; - y += 33; - int state = ((GT_Container_Uncertainty) mContainer).status; - switch (((GT_Container_Uncertainty) mContainer).mode) { - case 1: // ooo oxo ooo - drawTexturedModalRect(x + 12, y + 12, rU + (state == 0 ? 76 : 12), Vs + 12, 10, 10); - break; - case 2: // ooo xox ooo - drawTexturedModalRect(x, y + 12, rU + ((state & 1) == 0 ? 64 : 0), Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, rU + ((state & 2) == 0 ? 88 : 24), Vs + 12, 10, 10); - break; - case 3: // oxo xox oxo - drawTexturedModalRect(x + 12, y, rU + ((state & 1) == 0 ? 76 : 12), Vs, 10, 10); - drawTexturedModalRect(x, y + 12, rU + ((state & 2) == 0 ? 64 : 0), Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, rU + ((state & 4) == 0 ? 88 : 24), Vs + 12, 10, 10); - drawTexturedModalRect(x + 12, y + 24, rU + ((state & 8) == 0 ? 76 : 12), Vs + 24, 10, 10); - break; - case 4: // xox ooo xox - drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 64 : 0), Vs, 10, 10); - drawTexturedModalRect(x + 24, y, rU + ((state & 2) == 0 ? 88 : 24), Vs, 10, 10); - drawTexturedModalRect(x, y + 24, rU + ((state & 4) == 0 ? 64 : 0), Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, rU + ((state & 8) == 0 ? 88 : 24), Vs + 24, 10, 10); - break; - case 5: // xox oxo xox - drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 64 : 0), Vs, 10, 10); - drawTexturedModalRect(x + 24, y, rU + ((state & 2) == 0 ? 88 : 24), Vs, 10, 10); - drawTexturedModalRect(x + 12, y + 12, rU + ((state & 4) == 0 ? 76 : 12), Vs + 12, 10, 10); - drawTexturedModalRect(x, y + 24, rU + ((state & 8) == 0 ? 64 : 0), Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, rU + ((state & 16) == 0 ? 88 : 24), Vs + 24, 10, 10); - break; - } - x -= 6; - y -= 6; - for (int i = 0; i < 16; i++) { - if (TecTech.RANDOM.nextInt(1000) < ((GT_Container_Uncertainty) mContainer).matrix[i]) { - drawTexturedModalRect( - x + 12 * (i / 4), y + 12 * (i % 4), fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); - } - } - if (((GT_Container_Uncertainty) mContainer).selection > -1) { - int sel = ((GT_Container_Uncertainty) mContainer).selection; - drawTexturedModalRect( - x + 12 * (sel / 4), y + 12 * (sel % 4), bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); - } - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java deleted file mode 100644 index 1e9bccfe88..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; -import static org.lwjgl.opengl.GL11.*; - -import com.github.technus.tectech.font.TecTechFontRender; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_UncertaintyAdv extends GT_GUIContainerMetaTile_Machine { - protected static final short sX = 52, sY = 33, bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; - - public GT_GUIContainer_UncertaintyAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - TecTechFontRender.INSTANCE.drawSplitString("Schr\u00F6dinger X", 46, 7, 167, 0xffffff); - if (mContainer != null && ((GT_Container_Uncertainty) mContainer).status == 0) { - TecTechFontRender.INSTANCE.drawSplitString("Status: OK", 46, 16, 167, 0xffffff); - } else { - TecTechFontRender.INSTANCE.drawSplitString("Status: NG", 46, 16, 167, 0xffffff); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - if (mContainer != null && ((GT_Container_Uncertainty) mContainer).matrix != null) { - glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - x += sX; - y += sY; - int state = ((GT_Container_Uncertainty) mContainer).status; - switch (((GT_Container_Uncertainty) mContainer).mode) { - case 1: // ooo oxo ooo - drawTexturedModalRect(x + 12, y + 12, rU + (state == 0 ? 76 : 12), Vs + 12, 10, 10); - break; - case 2: // ooo xox ooo - drawTexturedModalRect(x, y + 12, rU + ((state & 1) == 0 ? 64 : 0), Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, rU + ((state & 2) == 0 ? 88 : 24), Vs + 12, 10, 10); - break; - case 3: // oxo xox oxo - drawTexturedModalRect(x + 12, y, rU + ((state & 1) == 0 ? 76 : 12), Vs, 10, 10); - drawTexturedModalRect(x, y + 12, rU + ((state & 2) == 0 ? 64 : 0), Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, rU + ((state & 4) == 0 ? 88 : 24), Vs + 12, 10, 10); - drawTexturedModalRect(x + 12, y + 24, rU + ((state & 8) == 0 ? 76 : 12), Vs + 24, 10, 10); - break; - case 4: // xox ooo xox - drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 64 : 0), Vs, 10, 10); - drawTexturedModalRect(x + 24, y, rU + ((state & 2) == 0 ? 88 : 24), Vs, 10, 10); - drawTexturedModalRect(x, y + 24, rU + ((state & 4) == 0 ? 64 : 0), Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, rU + ((state & 8) == 0 ? 88 : 24), Vs + 24, 10, 10); - break; - case 5: // xox ooo xox - drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 64 : 0), Vs, 10, 10); - drawTexturedModalRect(x + 24, y, rU + ((state & 2) == 0 ? 88 : 24), Vs, 10, 10); - drawTexturedModalRect(x + 12, y + 12, rU + ((state & 4) == 0 ? 76 : 12), Vs + 12, 10, 10); - drawTexturedModalRect(x, y + 24, rU + ((state & 8) == 0 ? 64 : 0), Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, rU + ((state & 16) == 0 ? 88 : 24), Vs + 24, 10, 10); - break; - } - x -= 6; - y -= 6; - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - for (int i = 0; i < 16; i++) { - glColor4f(1f, 1f, 1f, (float) ((GT_Container_Uncertainty) mContainer).matrix[i] / 1000f); - drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); - } - glDisable(GL_BLEND); - - glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if (((GT_Container_Uncertainty) mContainer).selection > -1) { - int sel = ((GT_Container_Uncertainty) mContainer).selection; - drawTexturedModalRect( - x + 12 * (sel / 4), y + 12 * (sel % 4), bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); - } - } - } -} -- cgit