mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
a314fccd1b
commit
8f026dad8f
161 files changed
+14073
-12846
No files matched your search
@@ -18,66 +18,74 @@ import com.google.common.collect.Lists;
|
||||
|
||||
public class GuiAutoChisel extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
||||
|
||||
private TileEntityAutoChisel autochisel;
|
||||
private TileEntityAutoChisel autochisel;
|
||||
|
||||
public GuiAutoChisel(InventoryPlayer inventoryPlayer, TileEntityAutoChisel tileEntityAutoChisel) {
|
||||
super(new ContainerAutoChisel(inventoryPlayer, tileEntityAutoChisel));
|
||||
autochisel = tileEntityAutoChisel;
|
||||
}
|
||||
public GuiAutoChisel(InventoryPlayer inventoryPlayer, TileEntityAutoChisel tileEntityAutoChisel) {
|
||||
super(new ContainerAutoChisel(inventoryPlayer, tileEntityAutoChisel));
|
||||
autochisel = tileEntityAutoChisel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTick) {
|
||||
super.drawScreen(mouseX, mouseY, partialTick);
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTick) {
|
||||
super.drawScreen(mouseX, mouseY, partialTick);
|
||||
|
||||
for (Slot slot : (List<Slot>) inventorySlots.inventorySlots) {
|
||||
if (!slot.getHasStack() && mouseInside(slot, mouseX - x, mouseY - y)) {
|
||||
if (slot.slotNumber < autochisel.getSizeInventory()) {
|
||||
String tt = autochisel.getSlotTooltipUnloc(slot.slotNumber);
|
||||
if (!Strings.isNullOrEmpty(tt)) {
|
||||
this.func_146283_a(Lists.newArrayList(tt), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
}
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
|
||||
private boolean mouseInside(Slot slot, int x, int y) {
|
||||
return x >= slot.xDisplayPosition && x <= slot.xDisplayPosition + 16 && y >= slot.yDisplayPosition && y <= slot.yDisplayPosition + 16;
|
||||
}
|
||||
for (Slot slot : (List<Slot>) inventorySlots.inventorySlots) {
|
||||
if (!slot.getHasStack() && mouseInside(slot, mouseX - x, mouseY - y)) {
|
||||
if (slot.slotNumber < autochisel.getSizeInventory()) {
|
||||
String tt = autochisel.getSlotTooltipUnloc(slot.slotNumber);
|
||||
if (!Strings.isNullOrEmpty(tt)) {
|
||||
this.func_146283_a(Lists.newArrayList(tt), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(gui);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
private boolean mouseInside(Slot slot, int x, int y) {
|
||||
return x >= slot.xDisplayPosition && x <= slot.xDisplayPosition + 16
|
||||
&& y >= slot.yDisplayPosition
|
||||
&& y <= slot.yDisplayPosition + 16;
|
||||
}
|
||||
|
||||
for (int i = TileEntityAutoChisel.BASE; i < TileEntityAutoChisel.CHISEL; i++) {
|
||||
if (autochisel.getStackInSlot(i) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(i), xSize, 0, 8);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(gui);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
if (autochisel.getStackInSlot(TileEntityAutoChisel.CHISEL) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(TileEntityAutoChisel.CHISEL), xSize, 24, 0);
|
||||
}
|
||||
}
|
||||
for (int i = TileEntityAutoChisel.BASE; i < TileEntityAutoChisel.CHISEL; i++) {
|
||||
if (autochisel.getStackInSlot(i) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(i), xSize, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
||||
padding /= 2;
|
||||
gui.drawTexturedModalRect(x + (slot.xDisplayPosition - padding), y + (slot.yDisplayPosition - padding), u, v, 18 + padding, 18 + padding);
|
||||
}
|
||||
if (autochisel.getStackInSlot(TileEntityAutoChisel.CHISEL) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(TileEntityAutoChisel.CHISEL), xSize, 24, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
||||
padding /= 2;
|
||||
gui.drawTexturedModalRect(
|
||||
x + (slot.xDisplayPosition - padding),
|
||||
y + (slot.yDisplayPosition - padding),
|
||||
u,
|
||||
v,
|
||||
18 + padding,
|
||||
18 + padding);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package team.chisel.client.gui;
|
||||
|
||||
import com.cricketcraft.chisel.api.IAdvancedChisel;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import static team.chisel.Chisel.MOD_ID;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -13,8 +10,10 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.client.gui.widgets.GuiButtonChiselMode;
|
||||
import team.chisel.inventory.ContainerChisel;
|
||||
import team.chisel.inventory.InventoryChiselSelection;
|
||||
@@ -24,12 +23,19 @@ import team.chisel.network.PacketHandler;
|
||||
import team.chisel.network.message.MessageChiselMode;
|
||||
import team.chisel.utils.General;
|
||||
|
||||
import static team.chisel.Chisel.MOD_ID;
|
||||
import com.cricketcraft.chisel.api.IAdvancedChisel;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiChisel extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png");
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(
|
||||
MOD_ID,
|
||||
"textures/chisel2GuiScroll.png");
|
||||
public static final int TEXTURE_WIDTH = 266;
|
||||
public static final int TEXTURE_HEIGHT = 250;
|
||||
public static final int GUI_WIDTH = 266;
|
||||
@@ -84,8 +90,7 @@ public class GuiChisel extends GuiContainer {
|
||||
}
|
||||
|
||||
private boolean showMode() {
|
||||
return container.chisel != null
|
||||
&& container.chisel.getItem() instanceof IChiselItem
|
||||
return container.chisel != null && container.chisel.getItem() instanceof IChiselItem
|
||||
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
|
||||
}
|
||||
|
||||
@@ -94,11 +99,16 @@ public class GuiChisel extends GuiContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
|
||||
fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
||||
fontRendererObj
|
||||
.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
||||
|
||||
if (showMode()) {
|
||||
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
|
||||
fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
modeText,
|
||||
12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2,
|
||||
122,
|
||||
0x404040);
|
||||
}
|
||||
|
||||
scrollBar.draw(this);
|
||||
@@ -115,7 +125,15 @@ public class GuiChisel extends GuiContainer {
|
||||
|
||||
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
||||
if (main.getStack() == null) {
|
||||
func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
func_146110_a(
|
||||
guiLeft + 8,
|
||||
guiTop + 8,
|
||||
0,
|
||||
GUI_HEIGHT,
|
||||
CHISEL_INPUT_SIZE,
|
||||
CHISEL_INPUT_SIZE,
|
||||
TEXTURE_WIDTH,
|
||||
TEXTURE_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package team.chisel.client.gui;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.config.Configurations;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.config.Configurations;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
|
||||
public class GuiChiselConfig extends GuiConfig {
|
||||
|
||||
public GuiChiselConfig(GuiScreen parent) {
|
||||
super(parent, new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Chisel.MOD_ID, false, false, GuiConfig
|
||||
.getAbridgedConfigPath(Configurations.config.toString()));
|
||||
}
|
||||
public GuiChiselConfig(GuiScreen parent) {
|
||||
super(
|
||||
parent,
|
||||
new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL))
|
||||
.getChildElements(),
|
||||
Chisel.MOD_ID,
|
||||
false,
|
||||
false,
|
||||
GuiConfig.getAbridgedConfigPath(Configurations.config.toString()));
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,28 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return GuiChiselConfig.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return GuiChiselConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,22 +11,22 @@ import team.chisel.inventory.ContainerPresent;
|
||||
|
||||
public class GuiPresent extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/present-gui.png");
|
||||
private int rows;
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/present-gui.png");
|
||||
private int rows;
|
||||
|
||||
public GuiPresent(InventoryPlayer inventoryPlayer, TileEntityPresent tileEntityPresent) {
|
||||
super(new ContainerPresent(inventoryPlayer, tileEntityPresent));
|
||||
rows = tileEntityPresent.getSizeInventory() / 9;
|
||||
this.ySize = 114 + rows * 18;
|
||||
}
|
||||
public GuiPresent(InventoryPlayer inventoryPlayer, TileEntityPresent tileEntityPresent) {
|
||||
super(new ContainerPresent(inventoryPlayer, tileEntityPresent));
|
||||
rows = tileEntityPresent.getSizeInventory() / 9;
|
||||
this.ySize = 114 + rows * 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(gui);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
|
||||
this.drawTexturedModalRect(x, y + this.rows * 18 + 17, 0, 126, this.xSize, 96);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(gui);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
|
||||
this.drawTexturedModalRect(x, y + this.rows * 18 + 17, 0, 126, this.xSize, 96);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
package team.chisel.client.gui;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.inventory.ContainerChisel;
|
||||
import team.chisel.network.PacketHandler;
|
||||
import team.chisel.network.message.MessageScrollUpdate;
|
||||
|
||||
public class GuiScrollbar {
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation("minecraft", "textures/gui/container/creative_inventory/tabs.png");
|
||||
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(
|
||||
"minecraft",
|
||||
"textures/gui/container/creative_inventory/tabs.png");
|
||||
|
||||
private int displayX = 0;
|
||||
private int displayY = 0;
|
||||
@@ -21,7 +26,8 @@ public class GuiScrollbar {
|
||||
private ContainerChisel container;
|
||||
|
||||
public void draw(GuiChisel g) {
|
||||
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking vanilla one
|
||||
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking
|
||||
// vanilla one
|
||||
g.mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
|
||||
@@ -1,106 +1,119 @@
|
||||
package team.chisel.client.gui.widgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import team.chisel.client.gui.GuiChisel;
|
||||
import team.chisel.item.chisel.ChiselMode;
|
||||
|
||||
import static team.chisel.client.gui.GuiChisel.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.client.gui.GuiChisel;
|
||||
import team.chisel.item.chisel.ChiselMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonChiselMode extends GuiButton {
|
||||
public static final int BUTTON_WIDTH = 48;
|
||||
public static final int BUTTON_HEIGHT = 48;
|
||||
private static final float BUTTON_BACKGROUND_U = 48;
|
||||
private static final float BUTTON_BACKGROUND_V = 202;
|
||||
private static final float MODE_VIGNETTE_U = BUTTON_BACKGROUND_U + 2 * BUTTON_WIDTH + 3;
|
||||
private static final float MODE_VIGNETTE_V = BUTTON_BACKGROUND_V + 3;
|
||||
private static final int MODE_VIGNETTE_WIDTH = 14;
|
||||
private static final int MODE_VIGNETTE_ROW_WIDTH = 3 * MODE_VIGNETTE_WIDTH;
|
||||
private static final int MODE_VIGNETTE_HEIGHT = 14;
|
||||
private static final int MODE_VIGNETTE_COL_HEIGHT = 3 * MODE_VIGNETTE_HEIGHT;
|
||||
private final GuiChisel guiChisel;
|
||||
|
||||
public GuiButtonChiselMode(int id, int x, int y, GuiChisel guiChisel) {
|
||||
super(id, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, "");
|
||||
this.guiChisel = guiChisel;
|
||||
}
|
||||
public static final int BUTTON_WIDTH = 48;
|
||||
public static final int BUTTON_HEIGHT = 48;
|
||||
private static final float BUTTON_BACKGROUND_U = 48;
|
||||
private static final float BUTTON_BACKGROUND_V = 202;
|
||||
private static final float MODE_VIGNETTE_U = BUTTON_BACKGROUND_U + 2 * BUTTON_WIDTH + 3;
|
||||
private static final float MODE_VIGNETTE_V = BUTTON_BACKGROUND_V + 3;
|
||||
private static final int MODE_VIGNETTE_WIDTH = 14;
|
||||
private static final int MODE_VIGNETTE_ROW_WIDTH = 3 * MODE_VIGNETTE_WIDTH;
|
||||
private static final int MODE_VIGNETTE_HEIGHT = 14;
|
||||
private static final int MODE_VIGNETTE_COL_HEIGHT = 3 * MODE_VIGNETTE_HEIGHT;
|
||||
private final GuiChisel guiChisel;
|
||||
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*
|
||||
* @param mc The Minecraft instance
|
||||
* @param mouseX The horizontal location of the mouse within the GuiScreen
|
||||
* @param mouseY The vertical location of the mouse relative to the GuiScreen
|
||||
*/
|
||||
@Override
|
||||
public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Mouse Hover State
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
drawButtonBackgroundLayer();
|
||||
drawButtonForegroundLayer();
|
||||
}
|
||||
}
|
||||
public GuiButtonChiselMode(int id, int x, int y, GuiChisel guiChisel) {
|
||||
super(id, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, "");
|
||||
this.guiChisel = guiChisel;
|
||||
}
|
||||
|
||||
private void drawButtonBackgroundLayer() {
|
||||
final float u = BUTTON_BACKGROUND_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(this.xPosition, this.yPosition, u, BUTTON_BACKGROUND_V, this.width, this.height, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
}
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*
|
||||
* @param mc The Minecraft instance
|
||||
* @param mouseX The horizontal location of the mouse within the GuiScreen
|
||||
* @param mouseY The vertical location of the mouse relative to the GuiScreen
|
||||
*/
|
||||
@Override
|
||||
public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Mouse Hover State
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
drawButtonBackgroundLayer();
|
||||
drawButtonForegroundLayer();
|
||||
}
|
||||
}
|
||||
|
||||
private void drawButtonForegroundLayer() {
|
||||
final int xBase = this.xPosition + 3;
|
||||
final int yBase = this.yPosition + 3;
|
||||
final float uBase = MODE_VIGNETTE_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
final float u;
|
||||
final float v;
|
||||
final int w;
|
||||
final int h;
|
||||
final int x;
|
||||
final int y;
|
||||
switch ((ChiselMode) guiChisel.getCurrentMode()) {
|
||||
case SINGLE:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case ROW:
|
||||
x = xBase;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case COLUMN:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
case PANEL:
|
||||
x = xBase;
|
||||
y = yBase;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(x, y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
}
|
||||
private void drawButtonBackgroundLayer() {
|
||||
final float u = BUTTON_BACKGROUND_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
u,
|
||||
BUTTON_BACKGROUND_V,
|
||||
this.width,
|
||||
this.height,
|
||||
TEXTURE_WIDTH,
|
||||
TEXTURE_HEIGHT);
|
||||
}
|
||||
|
||||
private void drawButtonForegroundLayer() {
|
||||
final int xBase = this.xPosition + 3;
|
||||
final int yBase = this.yPosition + 3;
|
||||
final float uBase = MODE_VIGNETTE_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
final float u;
|
||||
final float v;
|
||||
final int w;
|
||||
final int h;
|
||||
final int x;
|
||||
final int y;
|
||||
switch ((ChiselMode) guiChisel.getCurrentMode()) {
|
||||
case SINGLE:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case ROW:
|
||||
x = xBase;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case COLUMN:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
case PANEL:
|
||||
x = xBase;
|
||||
y = yBase;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(x, y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user