Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
- Made GUI no longer rely on container logic
Browse files Browse the repository at this point in the history
- Replace all GL11 calls with GlStateManager in GUI
- Add backgroud to gui
- Possibly resolved JEI misinteraction by not relying on container logic
- Bump version to 1.5.2.1
  • Loading branch information
fuj1n committed Sep 12, 2017
1 parent 683deb7 commit ef03078
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "fuj1n.recmod",
"name": "Recording Status Mod",
"description": "Record/Stream status in the players list, /rec <r/s> to toggle",
"version": "v1.5.2",
"version": "v1.5.2.1",
"mcversion": "1.12.1",
"url": "",
"updateUrl": "",
Expand Down
2 changes: 1 addition & 1 deletion src/fuj1n/recmod/RecMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.io.File;
import java.util.HashMap;

@Mod(name = "Recording Status Mod", version = "v1.5.2", modid = "fuj1n.recmod", acceptableRemoteVersions = "*") public class RecMod
@Mod(name = "Recording Status Mod", version = "v1.5.2.1", modid = "fuj1n.recmod", acceptableRemoteVersions = "*") public class RecMod
{

@Instance("fuj1n.recmod") public static RecMod instance;
Expand Down
47 changes: 31 additions & 16 deletions src/fuj1n/recmod/client/gui/GuiSimple.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package fuj1n.recmod.client.gui;

import fuj1n.recmod.RecMod;
import fuj1n.recmod.inventory.ContainerDummy;
import fuj1n.recmod.network.packet.PacketUpdatePlayerStatus;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.*;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;

import java.io.IOException;

public class GuiSimple extends GuiContainer
public class GuiSimple extends GuiScreen
{

public String boundPlayer;

public int guiState = 0;
Expand All @@ -37,10 +34,13 @@ public class GuiSimple extends GuiContainer
public GuiNumTextField tfAbsX;
public GuiNumTextField tfAbsY;

/** The X size of the inventory window in pixels. */
protected int xSize = 176;
/** The Y size of the inventory window in pixels. */
protected int ySize = 166;

public GuiSimple (String boundPlayer)
{
super(new ContainerDummy());

this.boundPlayer = boundPlayer;

if (stateNames.length != returnStates.length)
Expand All @@ -49,33 +49,48 @@ public GuiSimple (String boundPlayer)
}
}

@Override public void drawGuiContainerForegroundLayer (int par1, int par2)
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks){
int guiLeft = (this.width - this.xSize) / 2;
int guiTop = (this.height - this.ySize) / 2;

this.drawDefaultBackground();

GlStateManager.pushMatrix();
GlStateManager.translate(guiLeft, guiTop, 0.0F);

this.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
GlStateManager.translate(-guiLeft, -guiTop, 0.0F);
super.drawScreen(mouseX, mouseY, partialTicks);
GlStateManager.translate(guiLeft, guiTop, 0.0F);
this.drawGuiContainerForegroundLayer(mouseX, mouseY);

GlStateManager.popMatrix();
}

private void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(translate("recmod.interface.name") + stateNames[guiState], 8, 11, 4210752);
switch (guiState)
{
case 2:

GL11.glPopMatrix();
GlStateManager.popMatrix();
if (tfAbsX != null && tfAbsY != null)
{
tfAbsX.draw("X Position: ");
tfAbsY.draw("Y Position: ");
}
GL11.glPushMatrix();
GlStateManager.pushMatrix();
break;
case 4:
break;
}
}

@Override public void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
private void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(background);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
this.drawTexturedModalRect(0, 0, 0, 0, this.xSize, this.ySize);
}

@Override public void initGui ()
Expand Down
14 changes: 0 additions & 14 deletions src/fuj1n/recmod/inventory/ContainerDummy.java

This file was deleted.

0 comments on commit ef03078

Please sign in to comment.