Added simple buttons
Need to open GUI without placing block we held
This commit is contained in:
parent
899b9b7c30
commit
38f5fc8aa7
@ -28,6 +28,7 @@ public class BigAlarm {
|
|||||||
public void preInit(FMLInitializationEvent event)
|
public void preInit(FMLInitializationEvent event)
|
||||||
{
|
{
|
||||||
System.out.println("[BigAlarm]: Making nuut sound...");
|
System.out.println("[BigAlarm]: Making nuut sound...");
|
||||||
|
proxy.registerTileEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -8,6 +8,7 @@ public class BigAlarmRefs {
|
|||||||
public static final String PROXY_CLIENT = "fr.jcs.bigalarm.proxy.ClientProxy";
|
public static final String PROXY_CLIENT = "fr.jcs.bigalarm.proxy.ClientProxy";
|
||||||
public static final String PROXY_SERVER = "fr.jcs.bigalarm.proxy.CommonProxy";
|
public static final String PROXY_SERVER = "fr.jcs.bigalarm.proxy.CommonProxy";
|
||||||
public static final boolean isDevEnv = (Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
public static final boolean isDevEnv = (Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
||||||
|
public static final String RESOURCESPREFIX = MOD_ID.toLowerCase() + ":";
|
||||||
|
|
||||||
public static final String GUI = "gui." + MOD_ID + ".";
|
public static final String GUI = "gui." + MOD_ID + ".";
|
||||||
|
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
package fr.jcs.bigalarm.gui;
|
package fr.jcs.bigalarm.gui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import fr.jcs.bigalarm.tileentitys.TileEntityAlarm;
|
import fr.jcs.bigalarm.tileentitys.TileEntityAlarm;
|
||||||
|
import fr.jcs.bigalarm.utils.GuiHelper;
|
||||||
|
import fr.jcs.bigalarm.utils.ResourceHandler;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
public class GuiAlarmBlock extends GuiScreen{
|
public class GuiAlarmBlock extends GuiScreen{
|
||||||
private TileEntityAlarm tile;
|
private TileEntityAlarm tile;
|
||||||
@ -10,12 +19,22 @@ public class GuiAlarmBlock extends GuiScreen{
|
|||||||
this.tile = alarm;
|
this.tile = alarm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesGuiPauseGame() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
int guiLeft = (width / 2) - (197 / 2);
|
int guiLeft = (width / 2) - (197 / 2);
|
||||||
int guiTop = (height / 2) - (88 / 2);
|
int guiTop = (height / 2) - (88 / 2);
|
||||||
buttonList.clear();
|
buttonList.clear();
|
||||||
|
|
||||||
|
buttonList.add(new GuiTextureButton(0, guiLeft + 20, guiTop + 20, 0, 108, 18, 18, ""));
|
||||||
|
buttonList.add(new GuiTextureButton(1, guiLeft + 159, guiTop + 20, 0, 54, 18, 18, ""));
|
||||||
|
|
||||||
|
buttonList.add(new GuiTextureButton(2, guiLeft + 20, guiTop + 50, 0, 108, 18, 18, ""));
|
||||||
|
buttonList.add(new GuiTextureButton(3, guiLeft + 159, guiTop + 50, 0, 54, 18, 18, ""));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (tile.flowOverridden) return;
|
if (tile.flowOverridden) return;
|
||||||
@ -34,6 +53,39 @@ public class GuiAlarmBlock extends GuiScreen{
|
|||||||
int guiTop = (height / 2) - (88 / 2);
|
int guiTop = (height / 2) - (88 / 2);
|
||||||
|
|
||||||
drawDefaultBackground();
|
drawDefaultBackground();
|
||||||
//ResourceHandler.bindResource("textures/gui/ToolConfig.png");
|
ResourceHandler.bindResource("textures/gui/configPanel.png");
|
||||||
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 197, 88);
|
||||||
|
fontRendererObj.drawString(StatCollector.translateToLocal("gui.bigalarm.alarmBlock.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.bigalarm.alarmBlock.name")) / 2), guiTop + 5, 0x2c2c2c);
|
||||||
|
|
||||||
|
ResourceHandler.bindResource("textures/gui/widgets.png");
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
|
List<String> hoverText = new ArrayList<String>();
|
||||||
|
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||||
|
boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||||
|
|
||||||
|
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, mouseX, mouseY)) {
|
||||||
|
//hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl));
|
||||||
|
hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name"));
|
||||||
|
}
|
||||||
|
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, mouseX, mouseY)) {
|
||||||
|
//hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(1, shift, ctrl));
|
||||||
|
hoverText.add(StatCollector.translateToLocal("gui.de.increment.name"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, mouseX, mouseY)) {
|
||||||
|
//hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(0, shift, ctrl));
|
||||||
|
hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name"));
|
||||||
|
}
|
||||||
|
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, mouseX, mouseY)) {
|
||||||
|
//hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(0, shift, ctrl));
|
||||||
|
hoverText.add(StatCollector.translateToLocal("gui.de.increment.name"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hoverText.isEmpty()) {
|
||||||
|
hoverText.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gui.de.pressOrScroll.name"));
|
||||||
|
//drawHoveringText(hoverText, x - (x < width / 2 ? fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)) + 25 : 0), y, fontRendererObj);
|
||||||
|
drawHoveringText(hoverText, mouseX - (mouseX < width / 2 ? fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.decrement.name")) + 25 : 0), mouseY, fontRendererObj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
src/main/java/fr/jcs/bigalarm/gui/GuiTextureButton.java
Normal file
46
src/main/java/fr/jcs/bigalarm/gui/GuiTextureButton.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package fr.jcs.bigalarm.gui;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
|
||||||
|
public class GuiTextureButton extends GuiButton {
|
||||||
|
public int textureXPos;
|
||||||
|
public int textureYPos;
|
||||||
|
|
||||||
|
public GuiTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, String text) {
|
||||||
|
super(id, xPos, yPos, xSise, ySise, text);
|
||||||
|
this.textureXPos = textureXPos;
|
||||||
|
this.textureYPos = textureYPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawButton(Minecraft mc, int x, int y) {
|
||||||
|
if (this.visible) {
|
||||||
|
FontRenderer fontrenderer = mc.fontRendererObj;
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
|
||||||
|
int k = this.getHoverState(this.hovered);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
this.drawTexturedModalRect(this.xPosition, this.yPosition, textureXPos, textureYPos + k * height, this.width, this.height);
|
||||||
|
|
||||||
|
this.mouseDragged(mc, x, y);
|
||||||
|
int l = 14737632;
|
||||||
|
|
||||||
|
if (packedFGColour != 0) {
|
||||||
|
l = packedFGColour;
|
||||||
|
} else if (!this.enabled) {
|
||||||
|
l = 10526880;
|
||||||
|
} else if (this.hovered) {
|
||||||
|
l = 16777120;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import fr.jcs.bigalarm.tileentitys.TileEntityAlarm;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy {
|
public class ClientProxy extends CommonProxy {
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public void registerTileEntities() {
|
public void registerTileEntities() {
|
||||||
//TileEntityIC2ThermoRenderer renderThermalMonitor = new TileEntityIC2ThermoRenderer();
|
//TileEntityIC2ThermoRenderer renderThermalMonitor = new TileEntityIC2ThermoRenderer();
|
||||||
@ -16,6 +17,7 @@ public class ClientProxy extends CommonProxy {
|
|||||||
//ClientRegistry.registerTileEntity(shedar.mods.ic2.nuclearcontrol.tileentities.TileEntityThermo.class, "IC2Thermo", renderThermalMonitor);
|
//ClientRegistry.registerTileEntity(shedar.mods.ic2.nuclearcontrol.tileentities.TileEntityThermo.class, "IC2Thermo", renderThermalMonitor);
|
||||||
//GameRegistry.registerTileEntity(shedar.mods.ic2.nuclearcontrol.tileentities.TileEntityHowlerAlarm.class, "IC2HowlerAlarm");
|
//GameRegistry.registerTileEntity(shedar.mods.ic2.nuclearcontrol.tileentities.TileEntityHowlerAlarm.class, "IC2HowlerAlarm");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openGui(int id, Object arg) {
|
public void openGui(int id, Object arg) {
|
||||||
|
@ -10,7 +10,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public class CommonProxy {
|
public class CommonProxy {
|
||||||
public void registerTileEntities() {
|
public void registerTileEntities() {
|
||||||
//GameRegistry.registerTileEntity(TileEntityThermo.class, "IC2Thermo");
|
GameRegistry.registerTileEntity(TileEntityAlarm.class, BigAlarmRefs.MOD_ID + "TileAlarmBlock");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openGui(int id, Object arg) {}
|
public void openGui(int id, Object arg) {}
|
||||||
|
@ -67,4 +67,13 @@ public class TileEntityAlarm extends TileEntity {
|
|||||||
nbttagcompound.setString("soundName", soundName);
|
nbttagcompound.setString("soundName", soundName);
|
||||||
nbttagcompound.setInteger("range", range);
|
nbttagcompound.setInteger("range", range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public String getToolTip(int selector, boolean shift, boolean ctrl) {
|
||||||
|
int i = selector == 0 ? flowRSLow / 100000 * 10000 : flowRSHigh / 100000 * 10000;
|
||||||
|
int b1 = shift ? ctrl ? 10000 + i : 1000 : ctrl ? 5 : 50;
|
||||||
|
int b2 = shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10;
|
||||||
|
return b1 + "/" + b2 + " RF/t";
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
139
src/main/java/fr/jcs/bigalarm/utils/GuiHelper.java
Normal file
139
src/main/java/fr/jcs/bigalarm/utils/GuiHelper.java
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
package fr.jcs.bigalarm.utils;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
|
||||||
|
public class GuiHelper {
|
||||||
|
public static final double PXL128 = 0.0078125;
|
||||||
|
public static final double PXL256 = 0.00390625;
|
||||||
|
|
||||||
|
public static boolean isInRect(int x, int y, int xSize, int ySize, int mouseX, int mouseY){
|
||||||
|
return ((mouseX >= x && mouseX <= x+xSize) && (mouseY >= y && mouseY <= y+ySize));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawTexturedRect(int x, int y, int u, int v, int width, int height){
|
||||||
|
drawTexturedRect(x, y, width, height, u, v, width, height, 0, PXL256);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawTexturedRect(double x, double y, double width, double height, int u, int v, int uSize, int vSize, double zLevel, double pxl){
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.addVertexWithUV(x, y + height, zLevel, u * pxl, (v + vSize) * pxl);
|
||||||
|
tessellator.addVertexWithUV(x + width, y + height, zLevel, (u + uSize) * pxl, (v + vSize) * pxl);
|
||||||
|
tessellator.addVertexWithUV(x + width, y, zLevel, (u + uSize) * pxl, v * pxl);
|
||||||
|
tessellator.addVertexWithUV(x, y, zLevel, u * pxl, v * pxl);
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawHoveringText(List list, int x, int y, FontRenderer font, float fade, double scale, int guiWidth, int guiHeight) {
|
||||||
|
if (!list.isEmpty())
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
GL11.glScaled(scale, scale, 1);
|
||||||
|
x = (int)(x/scale);
|
||||||
|
y = (int)(y/scale);
|
||||||
|
|
||||||
|
int k = 0;
|
||||||
|
Iterator iterator = list.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
String s = (String)iterator.next();
|
||||||
|
int l = font.getStringWidth(s);
|
||||||
|
|
||||||
|
if (l > k)
|
||||||
|
{
|
||||||
|
k = l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int adjX = x + 12;
|
||||||
|
int adjY = y - 12;
|
||||||
|
int i1 = 8;
|
||||||
|
|
||||||
|
if (list.size() > 1)
|
||||||
|
{
|
||||||
|
i1 += 2 + (list.size() - 1) * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adjX + k > (int)(guiWidth/scale))
|
||||||
|
{
|
||||||
|
adjX -= 28 + k;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adjY + i1 + 6 > (int)(guiHeight/scale))
|
||||||
|
{
|
||||||
|
adjY = (int)(guiHeight/scale) - i1 - 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
int j1 = -267386864;
|
||||||
|
drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1, fade, scale);
|
||||||
|
drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1, fade, scale);
|
||||||
|
drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1, fade, scale);
|
||||||
|
drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1, fade, scale);
|
||||||
|
drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1, fade, scale);
|
||||||
|
int k1 = 1347420415;
|
||||||
|
int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
|
||||||
|
drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1, fade, scale);
|
||||||
|
drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1, fade, scale);
|
||||||
|
drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1, fade, scale);
|
||||||
|
drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1, fade, scale);
|
||||||
|
|
||||||
|
for (int i2 = 0; i2 < list.size(); ++i2)
|
||||||
|
{
|
||||||
|
String s1 = (String)list.get(i2);
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
font.drawStringWithShadow(s1, adjX, adjY, ((int)(fade*240F)+0x10 << 24) | 0x00FFFFFF);
|
||||||
|
|
||||||
|
adjY += 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawGradientRect(int x1, int y1, int x2, int y2, int colour1, int colour2, float fade, double scale) {
|
||||||
|
float f = ((colour1 >> 24 & 255) / 255.0F) * fade;
|
||||||
|
float f1 = (float)(colour1 >> 16 & 255) / 255.0F;
|
||||||
|
float f2 = (float)(colour1 >> 8 & 255) / 255.0F;
|
||||||
|
float f3 = (float)(colour1 & 255) / 255.0F;
|
||||||
|
float f4 = ((colour2 >> 24 & 255) / 255.0F) * fade;
|
||||||
|
float f5 = (float)(colour2 >> 16 & 255) / 255.0F;
|
||||||
|
float f6 = (float)(colour2 >> 8 & 255) / 255.0F;
|
||||||
|
float f7 = (float)(colour2 & 255) / 255.0F;
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setColorRGBA_F(f1, f2, f3, f);
|
||||||
|
tessellator.addVertex((double)x2, (double)y1, 300D);
|
||||||
|
tessellator.addVertex((double)x1, (double)y1, 300D);
|
||||||
|
tessellator.setColorRGBA_F(f5, f6, f7, f4);
|
||||||
|
tessellator.addVertex((double)x1, (double)y2, 300D);
|
||||||
|
tessellator.addVertex((double)x2, (double)y2, 300D);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
}
|
27
src/main/java/fr/jcs/bigalarm/utils/ResourceHandler.java
Normal file
27
src/main/java/fr/jcs/bigalarm/utils/ResourceHandler.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package fr.jcs.bigalarm.utils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import fr.jcs.bigalarm.BigAlarmRefs;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class ResourceHandler {
|
||||||
|
public static ResourceHandler instance = new ResourceHandler();
|
||||||
|
private static Map<String, ResourceLocation> cachedResources = new HashMap<String, ResourceLocation>();
|
||||||
|
|
||||||
|
public static ResourceLocation getResource(String rs) {
|
||||||
|
if (!cachedResources.containsKey(rs))
|
||||||
|
cachedResources.put(rs, new ResourceLocation(BigAlarmRefs.RESOURCESPREFIX + rs));
|
||||||
|
return cachedResources.get(rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void bindTexture(ResourceLocation texture) {
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void bindResource(String rs) {
|
||||||
|
bindTexture(ResourceHandler.getResource(rs));
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1,3 @@
|
|||||||
tile.bigalarm:alarmBlock.name=Alarm
|
tile.bigalarm:alarmBlock.name=Alarm
|
||||||
|
|
||||||
|
gui.bigalarm.alarmBlock.name=Configuration Panel
|
BIN
src/main/resources/assets/bigalarm/textures/gui/configPanel.png
Normal file
BIN
src/main/resources/assets/bigalarm/textures/gui/configPanel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
src/main/resources/assets/bigalarm/textures/gui/widgets.png
Normal file
BIN
src/main/resources/assets/bigalarm/textures/gui/widgets.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
Loading…
x
Reference in New Issue
Block a user