From 9b25e475dfab1a7a5e10d0fc1476b8894a9bd8d3 Mon Sep 17 00:00:00 2001 From: miozune Date: Wed, 16 Nov 2022 21:31:08 +0900 Subject: Deprecate Data Reader --- .../tectech/loader/recipe/BaseRecipeLoader.java | 20 -- .../tectech/loader/thing/MachineLoader.java | 2 - .../single/GT_MetaTileEntity_DataReader.java | 233 +--------------- .../single/gui/GT_Container_DataReader.java | 97 ------- .../single/gui/GT_GUIContainer_DataReader.java | 294 --------------------- 5 files changed, 6 insertions(+), 640 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java index bdd2dc1136..a2d3edfa5e 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -120,26 +120,6 @@ public class BaseRecipeLoader { OrePrefixes.gem.get(Materials.EnderPearl) }); - // Data reader - GT_ModHandler.addCraftingRecipe( - CustomItemList.Machine_DataReader.get(1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { - "BdB", - "GES", - "PwP", - 'B', - OrePrefixes.screw.get(Materials.Iridium), - 'P', - OrePrefixes.plate.get(Materials.Iridium), - 'G', - ItemList.Cover_Screen, - 'S', - OrePrefixes.circuit.get(Materials.Elite), - 'E', - ItemList.Hull_IV - }); - // Data Bank RA.addAssemblylineRecipe( ItemList.Hatch_DataAccess_EV.get(1), diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 53a16d2648..436c806da2 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -1042,8 +1042,6 @@ public class MachineLoader implements Runnable { GT_MetaTileEntity_Hatch_Rack.run(); - GT_MetaTileEntity_DataReader.run(); - GT_MetaTileEntity_Hatch_Capacitor.run(); if (!Loader.isModLoaded(Reference.DREAMCRAFT)) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java index 90f1d17dec..03a98d53bf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java @@ -1,43 +1,26 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static com.github.technus.tectech.util.CommonValues.V; -import static net.minecraft.util.StatCollector.translateToLocal; -import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DataReader; -import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DataReader; -import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.util.TT_Utility; -import cpw.mods.fml.common.FMLCommonHandler; 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.gui.GT_Slot_Holo; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; import java.util.*; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; -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.fluids.FluidStack; /** * Created by Tec on 23.03.2017. */ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine { - private static final HashMap> RENDER_REGISTRY = new HashMap<>(); public static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) { @@ -95,22 +78,13 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return null; } + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + return false; + } + @Override public int checkRecipe() { - if (getOutputAt(0) != null) { - return DID_NOT_FIND_RECIPE; - } - ItemStack input = getInputAt(0); - for (IDataRender render : getRenders(new TT_Utility.ItemStack_NoNBT(input))) { - if (render.canRender(input, mTier)) { - mOutputItems[0] = input.copy(); - input.stackSize -= 1; - calculateOverclockedNess(render.getReadingEUt(), render.getReadingTime()); - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - return FOUND_AND_SUCCESSFULLY_USED_RECIPE; - } - } return DID_NOT_FIND_RECIPE; } @@ -120,23 +94,6 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine aBaseMetaTileEntity.setActive(getOutputAt(0) != null || mMaxProgresstime > 0); } - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_DataReader(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_DataReader( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName(), - mGUIName, - GT_Utility.isStringValid(mNEIName) - ? mNEIName - : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); - } - @Override public boolean isSimpleMachine() { return false; @@ -149,14 +106,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine @Override public String[] getDescription() { - return new String[] { - CommonValues.TEC_MARK_GENERAL, - translateToLocal("gt.blockmachines.machine.tt.datareader.desc.0"), // Reads Data Sticks and Orbs - EnumChatFormatting.BLUE - + translateToLocal("gt.blockmachines.machine.tt.datareader.desc.1"), // Power it up and - EnumChatFormatting.BLUE - + translateToLocal("gt.blockmachines.machine.tt.datareader.desc.2") // Put the data storage in - }; + return new String[] {EnumChatFormatting.DARK_RED + "Deprecated"}; } @Override @@ -193,175 +143,4 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine public long getMinimumStoredEU() { return maxEUInput() * 4L; } - - public static void addDataRender(TT_Utility.ItemStack_NoNBT stack, IDataRender render) { - ArrayList renders = RENDER_REGISTRY.computeIfAbsent(stack, k -> new ArrayList<>()); - if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { - render.loadResources(); - } - renders.add(render); - } - - public static List getRenders(TT_Utility.ItemStack_NoNBT stack) { - ArrayList iDataRenders = RENDER_REGISTRY.get(stack); - return iDataRenders == null ? Collections.emptyList() : iDataRenders; - } - - public interface IDataRender { - @SideOnly(Side.CLIENT) - void loadResources(); - - @SideOnly(Side.CLIENT) - void initRender(ItemStack itemStack); - - @SideOnly(Side.CLIENT) - void renderTooltips(ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui); - - @SideOnly(Side.CLIENT) - void renderForeground( - ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui, FontRenderer font); - - @SideOnly(Side.CLIENT) - void renderBackgroundOverlay( - ItemStack itemStack, int mouseX, int mouseY, int X, int Y, GT_GUIContainer_DataReader gui); - - boolean canRender(ItemStack itemStack, byte tier); - - int getReadingEUt(); - - int getReadingTime(); - } - - public static void run() { - addDataRender(new TT_Utility.ItemStack_NoNBT(ItemList.Tool_DataStick.get(1)), new IDataRender() { - @SideOnly(Side.CLIENT) - private ResourceLocation bg; - - @SideOnly(Side.CLIENT) - private HashMap slots; - - private HashMap slots2; - - @Override - @SideOnly(Side.CLIENT) - public void loadResources() { - bg = new ResourceLocation(MODID + ":textures/gui/assLineRender.png"); - } - - @Override - public void initRender(ItemStack itemStack) { - slots = new HashMap<>(); - slots2 = new HashMap<>(); - - slots.put( - new GT_Slot_Holo(null, 0, 143, 55, false, false, 1), - ItemList.Tool_DataStick.getWithName(1, "Research data")); - ItemStack output = ItemStack.loadItemStackFromNBT(itemStack.stackTagCompound.getCompoundTag("output")); - if (output != null) { - slots.put(new GT_Slot_Holo(null, 0, 143, 19, false, false, 64), output); - } - - for (int i = 0; i < 16; i++) { - ArrayList array = new ArrayList<>(); - ItemStack input = ItemStack.loadItemStackFromNBT( - itemStack.stackTagCompound.getCompoundTag(Integer.toString(i))); - if (input != null) { - array.add(input); - } - for (int k = 0; k < itemStack.stackTagCompound.getInteger("a" + i); k++) { - input = ItemStack.loadItemStackFromNBT( - itemStack.stackTagCompound.getCompoundTag("a" + i + ":" + k)); - if (input != null) { - array.add(input); - } - } - if (array.size() > 0) { - slots2.put( - new GT_Slot_Holo(null, 0, 17 + (i & 0x3) * 18, 19 + (i >> 2) * 18, false, false, 64), - array.toArray(nullItem)); - } - } - for (int i = 0; i < 4; i++) { - FluidStack fs = - FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("f" + i)); - if (fs != null) { - slots.put( - new GT_Slot_Holo(null, 0, 107, 19 + i * 18, false, false, 1), - GT_Utility.getFluidDisplayStack(fs, true)); - } - } - } - - @Override - public void renderTooltips(ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui) { - for (Map.Entry entry : slots.entrySet()) { - gui.renderTooltipSimple(mouseX, mouseY, entry.getKey(), entry.getValue()); - } - int time = (int) (System.currentTimeMillis() / 2000); - for (Map.Entry entry : slots2.entrySet()) { - gui.renderTooltipSimple( - mouseX, mouseY, entry.getKey(), entry.getValue()[time % entry.getValue().length]); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void renderForeground( - ItemStack itemStack, int mouseX, int mouseY, GT_GUIContainer_DataReader gui, FontRenderer font) { - int time = itemStack.stackTagCompound.getInteger("time"); - int EUt = itemStack.stackTagCompound.getInteger("eu"); - font.drawString(translateToLocal("tt.keyphrase.Ass_line_recipe"), 7, 8, 0x80a0ff); - font.drawString( - GT_Utility.trans("152", "Total: ") + GT_Utility.formatNumbers((long) time * EUt) + " EU", - 7, - 93, - 0x80a0ff); - font.drawString( - GT_Utility.trans("153", "Usage: ") + GT_Utility.formatNumbers(EUt) + " EU/t", 7, 103, 0x80a0ff); - font.drawString( - GT_Utility.trans("154", "Voltage: ") + GT_Utility.formatNumbers(EUt) + " EU", 7, 113, 0x80a0ff); - font.drawString(GT_Utility.trans("155", "Amperage: ") + 1, 7, 123, 0x80a0ff); - font.drawString( - GT_Utility.trans("158", "Time: ") - + GT_Utility.formatNumbers(0.05d * time) - + GT_Utility.trans("161", " secs"), - 7, - 133, - 0x80a0ff); - - for (Map.Entry entry : slots.entrySet()) { - gui.renderItemSimple(entry.getKey(), entry.getValue()); - } - time = (int) (System.currentTimeMillis() / 2000); - for (Map.Entry entry : slots2.entrySet()) { - gui.renderItemSimple(entry.getKey(), entry.getValue()[time % entry.getValue().length]); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void renderBackgroundOverlay( - ItemStack itemStack, int mouseX, int mouseY, int X, int Y, GT_GUIContainer_DataReader gui) { - // 176/83 - gui.mc.getTextureManager().bindTexture(bg); - gui.drawTexturedModalRect(X, Y, 0, 0, 176, 151); - } - - @Override - public boolean canRender(ItemStack itemStack, byte tier) { - NBTTagCompound nbtTagCompound = itemStack.stackTagCompound; - return nbtTagCompound != null && nbtTagCompound.hasKey("output"); - } - - @Override - public int getReadingEUt() { - return (int) V[4]; - } - - @Override - public int getReadingTime() { - return 128; - } - }); - } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java deleted file mode 100644 index 57eda3f1d5..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DataReader.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.single.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_Container_BasicTank; -import gregtech.api.gui.GT_Slot_Output; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -public class GT_Container_DataReader extends GT_Container_BasicTank { - public boolean mStuttering = false; - - public GT_Container_DataReader(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - // this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 0, 8, 63, false, true, 1)); - // this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 0, 26, 63, false, true, 1)); - // this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 107, 63)); - - int tStartIndex = ((GT_MetaTileEntity_BasicMachine) this.mTileEntity.getMetaTileEntity()).getInputSlot(); - this.addSlotToContainer(new Slot(this.mTileEntity, tStartIndex, 53, 153)); - - tStartIndex = ((GT_MetaTileEntity_BasicMachine) this.mTileEntity.getMetaTileEntity()).getOutputSlot(); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, tStartIndex, 107, 153)); - - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 17, 153)); - // this.addSlotToContainer(new Slot(this.mTileEntity, 3, 125, 63)); - // this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex, 53, 63)); - } - - @Override - protected void bindPlayerInventory(InventoryPlayer aInventoryPlayer) { - int i; - for (i = 0; i < 3; ++i) { - for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new Slot(aInventoryPlayer, j + i * 9 + 9, 8 + j * 18, 174 + i * 18)); - } - } - - for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 232)); - } - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { - this.mStuttering = ((GT_MetaTileEntity_BasicMachine) this.mTileEntity.getMetaTileEntity()).mStuttering; - - for (Object crafter : this.crafters) { - ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 102, this.mStuttering ? 1 : 0); - } - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - if (par1 == 102) { - this.mStuttering = par2 != 0; - } - } - - @Override - public int getSlotStartIndex() { - return 0; - } - - @Override - public int getShiftClickStartIndex() { - return 0; - } - - @Override - public int getSlotCount() { - return 3; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java deleted file mode 100644 index d6f150d87e..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java +++ /dev/null @@ -1,294 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.single.gui; - -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader; -import com.github.technus.tectech.util.TT_Utility; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import java.util.List; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine { - public final String mName; - public final String mNEI; - public final byte mProgressBarDirection; - public final byte mProgressBarAmount; - private ItemStack stack = null; - - public GT_GUIContainer_DataReader( - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aTextureFile, - String aNEI) { - this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); - } - - public GT_GUIContainer_DataReader( - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aTextureFile, - String aNEI, - byte aProgressBarDirection, - byte aProgressBarAmount) { - super( - new GT_Container_DataReader(aInventoryPlayer, aTileEntity), - "gregtech:textures/gui/basicmachines/" + aTextureFile); - this.mProgressBarDirection = aProgressBarDirection; - this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); - this.mName = aName; - this.mNEI = aNEI; - ySize = 256; - } - - @Override - public void drawScreen(int mouseX, int mouseY, float par3) { - super.drawScreen(mouseX, mouseY, par3); - if (mContainer != null) { - if (mContainer.mTileEntity != null - && mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DataReader) { - GT_MetaTileEntity_DataReader reader = - (GT_MetaTileEntity_DataReader) mContainer.mTileEntity.getMetaTileEntity(); - renderDataTooltips(mouseX, mouseY, reader.mTier); - } - } - } - - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - if (mContainer != null) { - if (mContainer.mTileEntity != null - && mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DataReader) { - GT_MetaTileEntity_DataReader reader = - (GT_MetaTileEntity_DataReader) mContainer.mTileEntity.getMetaTileEntity(); - if (renderDataFG(mouseX, mouseY, reader.mTier)) { - return; - } - } - } - fontRendererObj.drawString(mName, 7, 8, 0xfafaff); - } - - protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) { - super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - if (((GT_Container_DataReader) this.mContainer).mStuttering) { - this.drawTexturedModalRect(x + 127, y + 152, 176, 54, 18, 18); - } - - if (this.mContainer.mMaxProgressTime > 0) { - int tSize = this.mProgressBarDirection < 2 ? 20 : 18; - int tProgress = Math.max( - 1, - Math.min( - tSize * this.mProgressBarAmount, - (this.mContainer.mProgressTime > 0 ? 1 : 0) - + this.mContainer.mProgressTime - * tSize - * this.mProgressBarAmount - / this.mContainer.mMaxProgressTime)) - % (tSize + 1); - switch (this.mProgressBarDirection) { - case 0: - this.drawTexturedModalRect(x + 78, y + 152, 176, 0, tProgress, 18); - break; - case 1: - this.drawTexturedModalRect(x + 78 + 20 - tProgress, y + 152, 196 - tProgress, 0, tProgress, 18); - break; - case 2: - this.drawTexturedModalRect(x + 78, y + 152, 176, 0, 20, tProgress); - break; - case 3: - this.drawTexturedModalRect( - x + 78, y + 152 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); - break; - case 4: - tProgress = 20 - tProgress; - this.drawTexturedModalRect(x + 78, y + 152, 176, 0, tProgress, 18); - break; - case 5: - tProgress = 20 - tProgress; - this.drawTexturedModalRect(x + 78 + 20 - tProgress, y + 152, 196 - tProgress, 0, tProgress, 18); - break; - case 6: - tProgress = 18 - tProgress; - this.drawTexturedModalRect(x + 78, y + 152, 176, 0, 20, tProgress); - break; - case 7: - tProgress = 18 - tProgress; - this.drawTexturedModalRect( - x + 78, y + 152 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); - } - } - } - if (mContainer != null) { - if (mContainer.mTileEntity != null - && mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DataReader) { - GT_MetaTileEntity_DataReader reader = - (GT_MetaTileEntity_DataReader) mContainer.mTileEntity.getMetaTileEntity(); - renderDataBG(reader.getStackInSlot(reader.getOutputSlot()), mouseX, mouseY, x, y, reader.mTier); - } - } - } - - private void renderDataBG(ItemStack thing, int mouseX, int mouseY, int x, int y, byte mTier) { - if (thing != null) { - for (GT_MetaTileEntity_DataReader.IDataRender render : - GT_MetaTileEntity_DataReader.getRenders(new TT_Utility.ItemStack_NoNBT(thing))) { - if (render.canRender(thing, mTier)) { - if (!GT_Utility.areStacksEqual(stack, thing, false)) { - render.initRender(thing); - } - render.renderBackgroundOverlay(thing, mouseX, mouseY, x, y, this); - break; - } - } - } - stack = thing; - } - - private boolean renderDataFG(int mouseX, int mouseY, byte mTier) { - if (stack == null) { - return false; - } - for (GT_MetaTileEntity_DataReader.IDataRender render : - GT_MetaTileEntity_DataReader.getRenders(new TT_Utility.ItemStack_NoNBT(stack))) { - if (render.canRender(stack, mTier)) { - render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj); - return true; - } - } - return false; - } - - private boolean renderDataTooltips(int mouseX, int mouseY, byte mTier) { - if (stack == null) { - return false; - } - for (GT_MetaTileEntity_DataReader.IDataRender render : - GT_MetaTileEntity_DataReader.getRenders(new TT_Utility.ItemStack_NoNBT(stack))) { - if (render.canRender(stack, mTier)) { - render.renderTooltips(stack, mouseX, mouseY, this); - return true; - } - } - return false; - } - - public void renderItemSimple(GT_Slot_Holo slot, ItemStack itemStack) { - int x = slot.xDisplayPosition; - int y = slot.yDisplayPosition; - this.zLevel = 100.0F; - itemRender.zLevel = 100.0F; - - if (itemStack == null) { - IIcon iicon = slot.getBackgroundIconIndex(); - - if (iicon != null) { - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); // Forge: Blending needs to be enabled for this. - this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture); - this.drawTexturedModelRectFromIcon(x, y, iicon, 16, 16); - GL11.glDisable(GL11.GL_BLEND); // Forge: And clean that up - GL11.glEnable(GL11.GL_LIGHTING); - } - } - GL11.glEnable(GL11.GL_DEPTH_TEST); - itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemStack, x, y); - itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemStack, x, y); - - itemRender.zLevel = 0.0F; - this.zLevel = 0.0F; - } - - public void renderTooltipSimple(int mouseX, int mouseY, GT_Slot_Holo slot, ItemStack itemStack) { - int x = slot.xDisplayPosition + (width - xSize) / 2; - int y = slot.yDisplayPosition + (height - ySize) / 2; - if (mouseX >= x && mouseY >= y && mouseX <= x + 16 && mouseY <= y + 16) { - List strings = itemStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - if (strings.size() > 0) { - strings.set(0, itemStack.getRarity().rarityColor + (String) strings.get(0)); - } - hoveringText(strings, mouseX, mouseY, fontRendererObj); - } - } - - private void hoveringText(List strings, int x, int y, FontRenderer font) { - if (!strings.isEmpty()) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - // RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - int k = 0; - - for (Object aP_146283_1_ : strings) { - String s = (String) aP_146283_1_; - int l = font.getStringWidth(s); - - if (l > k) { - k = l; - } - } - - int x2 = x + 12; - int y2 = y - 12; - int i1 = 8; - - if (strings.size() > 1) { - i1 += 2 + (strings.size() - 1) * 10; - } - - if (x2 + k > this.width) { - x2 -= 28 + k; - } - - if (y2 + i1 + 6 > this.height) { - y2 = this.height - i1 - 6; - } - - // this.zLevel = 300.0F; - // itemRender.zLevel = 300.0F; - int j1 = 0xf0001040; // bg - this.drawGradientRect(x2 - 3, y2 - 4, x2 + k + 3, y2 - 3, j1, j1); - this.drawGradientRect(x2 - 3, y2 + i1 + 3, x2 + k + 3, y2 + i1 + 4, j1, j1); - this.drawGradientRect(x2 - 3, y2 - 3, x2 + k + 3, y2 + i1 + 3, j1, j1); - this.drawGradientRect(x2 - 4, y2 - 3, x2 - 3, y2 + i1 + 3, j1, j1); - this.drawGradientRect(x2 + k + 3, y2 - 3, x2 + k + 4, y2 + i1 + 3, j1, j1); - int k1 = 0x500040ff; // border bright - int l1 = (k1 & 0xfefefe) >> 1 | k1 & 0xff000000; // border dark??? - this.drawGradientRect(x2 - 3, y2 - 3 + 1, x2 - 3 + 1, y2 + i1 + 3 - 1, k1, l1); - this.drawGradientRect(x2 + k + 2, y2 - 3 + 1, x2 + k + 3, y2 + i1 + 3 - 1, k1, l1); - this.drawGradientRect(x2 - 3, y2 - 3, x2 + k + 3, y2 - 3 + 1, k1, k1); - this.drawGradientRect(x2 - 3, y2 + i1 + 2, x2 + k + 3, y2 + i1 + 3, l1, l1); - - for (int i2 = 0; i2 < strings.size(); ++i2) { - String s1 = (String) strings.get(i2); - font.drawStringWithShadow(s1, x2, y2, -1); - - if (i2 == 0) { - y2 += 2; - } - - y2 += 10; - } - - // this.zLevel = 0.0F; - // itemRender.zLevel = 0.0F; - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - // RenderHelper.enableStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } - } -} -- cgit