aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/client
diff options
context:
space:
mode:
authorKiwi <42833050+Kiwi233@users.noreply.github.com>2020-05-22 20:23:55 +0800
committerGitHub <noreply@github.com>2020-05-22 20:23:55 +0800
commit56689ec7b67c46c882d49da4742770e3397a4e9f (patch)
tree879a3372906ec2c5f2a53a4ac46f7dde860a654f /src/main/java/client
parentbc19f3ab32c9bccbf936bbeffcc8ddad967ffffd (diff)
parent306a0822c27c59cdbd0a61698939a2dfc02068d2 (diff)
downloadGT5-Unofficial-56689ec7b67c46c882d49da4742770e3397a4e9f.tar.gz
GT5-Unofficial-56689ec7b67c46c882d49da4742770e3397a4e9f.tar.bz2
GT5-Unofficial-56689ec7b67c46c882d49da4742770e3397a4e9f.zip
Merge pull request #1 from kekzdealer/master
5/22
Diffstat (limited to 'src/main/java/client')
-rw-r--r--src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java46
-rw-r--r--src/main/java/client/gui/Gui_ItemProxyEndpoint.java51
-rw-r--r--src/main/java/client/gui/Gui_ItemProxySource.java51
-rw-r--r--src/main/java/client/renderer/ConduitRenderer.java93
-rw-r--r--src/main/java/client/renderer/TESR_SECapacitor.java74
-rw-r--r--src/main/java/client/renderer/TESR_SETether.java76
6 files changed, 391 insertions, 0 deletions
diff --git a/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java b/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java
new file mode 100644
index 0000000000..d6f2a61ce4
--- /dev/null
+++ b/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java
@@ -0,0 +1,46 @@
+package client.gui;
+
+import org.lwjgl.opengl.GL11;
+
+import common.container.Container_ModularNuclearReactor;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import kekztech.KekzCore;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+
+public class GUIContainer_ModularNuclearReactor extends GuiContainer {
+
+ private ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/MultiblockDisplay_REACTOR.png");
+
+ private InventoryPlayer inventory;
+ private IGregTechTileEntity te;
+
+ public GUIContainer_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player)
+ {
+ super(new Container_ModularNuclearReactor(te, player));
+ inventory = player.inventory;
+ this.te = te;
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
+ {
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+ final int x = (super.width - super.xSize) / 2;
+ final int y = (super.height - super.ySize) / 2;
+ super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2)
+ {
+
+ }
+
+}
diff --git a/src/main/java/client/gui/Gui_ItemProxyEndpoint.java b/src/main/java/client/gui/Gui_ItemProxyEndpoint.java
new file mode 100644
index 0000000000..f978ed6495
--- /dev/null
+++ b/src/main/java/client/gui/Gui_ItemProxyEndpoint.java
@@ -0,0 +1,51 @@
+package client.gui;
+
+import org.lwjgl.opengl.GL11;
+
+import common.container.Container_ItemProxyEndpoint;
+import kekztech.KekzCore;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class Gui_ItemProxyEndpoint extends GuiContainer {
+
+ private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTechReceiverNode.png");
+
+ private final InventoryPlayer inventory;
+ private final IInventory te;
+
+ public Gui_ItemProxyEndpoint(TileEntity te, EntityPlayer player) {
+ super(new Container_ItemProxyEndpoint(te, player));
+ inventory = player.inventory;
+ this.te = (IInventory) te;
+
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ final int x = (super.width - super.xSize) / 2;
+ final int y = (super.height - super.ySize) / 2;
+
+ super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int p1, int p2) {
+ super.fontRendererObj.drawString(
+ I18n.format(te.getInventoryName()),
+ (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2),
+ 6, 4210752, false);
+ super.fontRendererObj.drawString(
+ I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752);
+ }
+}
diff --git a/src/main/java/client/gui/Gui_ItemProxySource.java b/src/main/java/client/gui/Gui_ItemProxySource.java
new file mode 100644
index 0000000000..a811f01bbe
--- /dev/null
+++ b/src/main/java/client/gui/Gui_ItemProxySource.java
@@ -0,0 +1,51 @@
+package client.gui;
+
+import org.lwjgl.opengl.GL11;
+
+import common.container.Container_ItemProxySource;
+import kekztech.KekzCore;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class Gui_ItemProxySource extends GuiContainer {
+
+ private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech4by4.png");
+
+ private final InventoryPlayer inventory;
+ private final IInventory te;
+
+ public Gui_ItemProxySource(TileEntity te, EntityPlayer player) {
+ super(new Container_ItemProxySource(te, player));
+ inventory = player.inventory;
+ this.te = (IInventory) te;
+
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ final int x = (super.width - super.xSize) / 2;
+ final int y = (super.height - super.ySize) / 2;
+
+ super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int p1, int p2) {
+ super.fontRendererObj.drawString(
+ I18n.format(te.getInventoryName()),
+ (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2),
+ 6, 4210752, false);
+ super.fontRendererObj.drawString(
+ I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752);
+ }
+}
diff --git a/src/main/java/client/renderer/ConduitRenderer.java b/src/main/java/client/renderer/ConduitRenderer.java
new file mode 100644
index 0000000000..9266d22f55
--- /dev/null
+++ b/src/main/java/client/renderer/ConduitRenderer.java
@@ -0,0 +1,93 @@
+package client.renderer;
+
+import common.tileentities.TE_ItemProxyCable;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class ConduitRenderer implements ISimpleBlockRenderingHandler {
+
+ public static final int RID = RenderingRegistry.getNextAvailableRenderId();
+ private static final ConduitRenderer INSTANCE = new ConduitRenderer();
+
+ private ConduitRenderer() {
+
+ }
+
+ public static ConduitRenderer getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
+ RenderBlocks renderer) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if(te instanceof TE_ItemProxyCable) {
+ final TE_ItemProxyCable cable = (TE_ItemProxyCable) te;
+
+ final float thickness = TE_ItemProxyCable.getThickness();
+ final float space = (1.0f - thickness) / 2.0f;
+
+ float xThickness = thickness;
+ float xOffset = space;
+ float yThickness = thickness;
+ float yOffset = space;
+ float zThickness = thickness;
+ float zOffset = space;
+
+ for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
+ if(cable.isConnected(side)) {
+ switch(side) {
+ case DOWN:
+ yOffset = 0.0F;
+ yThickness += space;
+ break;
+ case UP:
+ yThickness += space;
+ break;
+ case NORTH:
+ zOffset = 0.0F;
+ zThickness += space;
+ break;
+ case SOUTH:
+ zThickness += space;
+ break;
+ case WEST:
+ xOffset += 0.0F;
+ xThickness += space;
+ break;
+ case EAST:
+ xThickness += space;
+ break;
+ }
+ }
+ }
+
+ block.setBlockBounds(xOffset, yOffset, zOffset,
+ xOffset + xThickness, yOffset + yThickness, zOffset + zThickness);
+ renderer.setRenderBoundsFromBlock(block);
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return ConduitRenderer.RID;
+ }
+
+}
diff --git a/src/main/java/client/renderer/TESR_SECapacitor.java b/src/main/java/client/renderer/TESR_SECapacitor.java
new file mode 100644
index 0000000000..16c820917d
--- /dev/null
+++ b/src/main/java/client/renderer/TESR_SECapacitor.java
@@ -0,0 +1,74 @@
+package client.renderer;
+
+import common.tileentities.TE_SpaceElevatorCapacitor;
+import kekztech.KekzCore;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class TESR_SECapacitor extends TileEntitySpecialRenderer {
+
+ private static final ResourceLocation capSide = new ResourceLocation(KekzCore.MODID, "textures/blocks/SpaceElevatorCapacitor_side_renderbase.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
+ final Tessellator tessellator = Tessellator.instance;
+ final TE_SpaceElevatorCapacitor teCap = (TE_SpaceElevatorCapacitor) te;
+ // Setup vertices
+ final double fbr_x = x + 1;
+ final double fbr_z = z + 1;
+
+ final double ftr_y = y + 1;
+
+ final double uv_a_u = 1.0D;
+ final double uv_a_v = 1.0D;
+
+ final double uv_b_u = 1.0D;
+ final double uv_b_v = 0.0D;
+
+ final double uv_c_u = 0.0D;
+ final double uv_c_v = 0.0D;
+
+ final double uv_d_u = 0.0D;
+ final double uv_d_v = 1.0D;
+ // Render sides
+ super.bindTexture(capSide);
+
+ // Prepare Tessellator
+ tessellator.startDrawingQuads();
+ // Render the caps as red if there are maintenance issues
+ if(teCap.isDamaged()) {
+ final float wave = (float) Math.abs(Math.sin((te.getWorldObj().getTotalWorldTime() + partialTick) / 20.0D));
+ final int redSat = 64 + (int) Math.ceil(191 * wave);
+ tessellator.setColorRGBA(redSat, 0, 0, 255);
+ } else {
+ final int sat = (int) Math.ceil(teCap.getChargeLevel() * 255);
+ tessellator.setColorRGBA(0, 0, sat, 255);
+ }
+ tessellator.setBrightness(255);
+ // (DOWN and UP faces are not rendered as they will not ever be visible in the Space Elevator structure)
+ // NORTH
+ tessellator.addVertexWithUV(x, y, z, uv_a_u, uv_a_v);
+ tessellator.addVertexWithUV(x, ftr_y, z, uv_b_u, uv_b_v);
+ tessellator.addVertexWithUV(fbr_x, ftr_y, z, uv_c_u, uv_c_v);
+ tessellator.addVertexWithUV(fbr_x, y, z, uv_d_u, uv_d_v);
+ // SOUTH
+ tessellator.addVertexWithUV(fbr_x, y, fbr_z, uv_a_u, uv_a_v);
+ tessellator.addVertexWithUV(fbr_x, ftr_y, fbr_z, uv_b_u, uv_b_v);
+ tessellator.addVertexWithUV(x, ftr_y, fbr_z, uv_c_u, uv_c_v);
+ tessellator.addVertexWithUV(x, y, fbr_z, uv_d_u, uv_d_v);
+ // WEST
+ tessellator.addVertexWithUV(x, y, fbr_z, uv_a_u, uv_a_v);
+ tessellator.addVertexWithUV(x, ftr_y, fbr_z, uv_b_u, uv_b_v);
+ tessellator.addVertexWithUV(x, ftr_y, z, uv_c_u, uv_c_v);
+ tessellator.addVertexWithUV(x, y, z, uv_d_u, uv_d_v);
+ // EAST
+ tessellator.addVertexWithUV(fbr_x, y, z, uv_a_u, uv_a_v);
+ tessellator.addVertexWithUV(fbr_x, ftr_y, z, uv_b_u, uv_b_v);
+ tessellator.addVertexWithUV(fbr_x, ftr_y, fbr_z, uv_c_u, uv_c_v);
+ tessellator.addVertexWithUV(fbr_x, y, fbr_z, uv_d_u, uv_d_v);
+ // Draw!
+ tessellator.draw();
+ }
+}
diff --git a/src/main/java/client/renderer/TESR_SETether.java b/src/main/java/client/renderer/TESR_SETether.java
new file mode 100644
index 0000000000..2e4fa95cc5
--- /dev/null
+++ b/src/main/java/client/renderer/TESR_SETether.java
@@ -0,0 +1,76 @@
+package client.renderer;
+
+import kekztech.KekzCore;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+public class TESR_SETether extends TileEntitySpecialRenderer {
+
+ private static final ResourceLocation tetherBeamTexture = new ResourceLocation(KekzCore.MODID, "textures/effects/Tether_beam.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
+ float beamLengthScale = 1.0F; // [0.0F, 1.0F] -> linear scale from 0 to 256
+ GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
+
+ // Get Tessellator instance
+ final Tessellator tessellator = Tessellator.instance;
+ // Bind beam texture and set texture params
+ super.bindTexture(tetherBeamTexture);
+ GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
+ GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
+ // Set render flags for inner beam
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_CULL_FACE);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthMask(true);
+ OpenGlHelper.glBlendFunc(770, 1, 1, 0);
+ // Prepare Tessellator
+ tessellator.startDrawingQuads();
+ tessellator.setColorRGBA(255, 255, 255, 32);
+ // Variables stuff II
+ final double halfBeamWidth = 0.38D;
+ final double d_rot1 = 0.5D + Math.cos(2.356194490192345D) * halfBeamWidth; // rotates the beam...
+ final double d_rot2 = 0.5D + Math.sin(2.356194490192345D) * halfBeamWidth;
+ final double d_rot3 = 0.5D + Math.cos((Math.PI / 4D)) * halfBeamWidth;
+ final double d_rot4 = 0.5D + Math.sin((Math.PI / 4D)) * halfBeamWidth;
+ final double d_rot5 = 0.5D + Math.cos(3.9269908169872414D) * halfBeamWidth;
+ final double d_rot6 = 0.5D + Math.sin(3.9269908169872414D) * halfBeamWidth;
+ final double d_rot7 = 0.5D + Math.cos(5.497787143782138D) * halfBeamWidth;
+ final double d_rot8 = 0.5D + Math.sin(5.497787143782138D) * halfBeamWidth; // ...until here
+ final double height = 256.0F * beamLengthScale;
+ final double uv_x1 = 0.0D;
+ final double uv_x2 = 1.0D;
+ final double uv_y1 = -1.0D; // This makes the beam stream upwards if you add a time sensitive number to it
+ final double uv_y2 = (double)(256.0F * beamLengthScale) * (0.5D / halfBeamWidth) + uv_y1;
+ // Construct mesh with texture
+ tessellator.addVertexWithUV(x + d_rot1, y + height, z + d_rot2, uv_x2, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot1, y, z + d_rot2, uv_x2, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot3, y, z + d_rot4, uv_x1, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot3, y + height, z + d_rot4, uv_x1, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot7, y + height, z + d_rot8, uv_x2, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot7, y, z + d_rot8, uv_x2, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot5, y, z + d_rot6, uv_x1, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot5, y + height, z + d_rot6, uv_x1, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot3, y + height, z + d_rot4, uv_x2, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot3, y, z + d_rot4, uv_x2, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot7, y, z + d_rot8, uv_x1, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot7, y + height, z + d_rot8, uv_x1, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot5, y + height, z + d_rot6, uv_x2, uv_y2);
+ tessellator.addVertexWithUV(x + d_rot5, y, z + d_rot6, uv_x2, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot1, y, z + d_rot2, uv_x1, uv_y1);
+ tessellator.addVertexWithUV(x + d_rot1, y + height, z + d_rot2, uv_x1, uv_y2);
+ // Draw!
+ tessellator.draw();
+
+ // Reset render flags
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glDepthMask(true);
+ }
+
+}