mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 13:49:05 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -9,9 +9,9 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class GuiMenuSideButton extends GuiNpcButton{
|
||||
public static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/menusidebutton.png");
|
||||
public static final ResourceLocation resource2 = new ResourceLocation("customnpcs","textures/gui/menusidebutton2.png");
|
||||
public class GuiMenuSideButton extends GuiNpcButton {
|
||||
public static final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/menusidebutton.png");
|
||||
public static final ResourceLocation resource2 = new ResourceLocation("customnpcs", "textures/gui/menusidebutton2.png");
|
||||
|
||||
public boolean active;
|
||||
public boolean rightSided;
|
||||
@@ -20,40 +20,40 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
public int renderIconPosX = 0;
|
||||
public int renderIconPosY = 0;
|
||||
|
||||
public GuiMenuSideButton(int id, int x, int y, String s){
|
||||
public GuiMenuSideButton(int id, int x, int y, String s) {
|
||||
this(id, x, y, 200, 20, s);
|
||||
}
|
||||
|
||||
public GuiMenuSideButton(int id, int x, int y, int width, int height, String s){
|
||||
super(id, x, y, width, height, s);
|
||||
public GuiMenuSideButton(int id, int x, int y, int width, int height, String s) {
|
||||
super(id, x, y, width, height, s);
|
||||
active = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHoverState(boolean flag){
|
||||
public int getHoverState(boolean flag) {
|
||||
if (active)
|
||||
return 0;
|
||||
return super.getHoverState(flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int i, int j){
|
||||
if (!visible){
|
||||
public void drawButton(Minecraft minecraft, int i, int j) {
|
||||
if (!visible) {
|
||||
return;
|
||||
}
|
||||
FontRenderer fontrenderer = minecraft.fontRenderer;
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int width = this.width + (active?2:0);
|
||||
int width = this.width + (active ? 2 : 0);
|
||||
field_146123_n = i >= xPosition && j >= yPosition && i < xPosition + width && j < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
if (this.rightSided) {
|
||||
minecraft.renderEngine.bindTexture(resource2);
|
||||
drawTexturedModalRect(xPosition, yPosition, 197 - width, k * 22, width, height);
|
||||
drawTexturedModalRect(xPosition, yPosition, 197 - width, k * 22, width, height);
|
||||
} else {
|
||||
minecraft.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(xPosition, yPosition, 0, k * 22, width, height);
|
||||
drawTexturedModalRect(xPosition, yPosition, 0, k * 22, width, height);
|
||||
}
|
||||
mouseDragged(minecraft, i, j);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
if (this.renderResource != null) {
|
||||
this.zLevel = 100.0F;
|
||||
minecraft.renderEngine.bindTexture(renderResource);
|
||||
drawTexturedModalRect(xPosition + 2, yPosition + height/2 - 8, renderIconPosX, renderIconPosY, 16, 16);
|
||||
drawTexturedModalRect(xPosition + 2, yPosition + height / 2 - 8, renderIconPosX, renderIconPosY, 16, 16);
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
@@ -74,9 +74,9 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
itemRenderer.renderItemAndEffectIntoGUI(minecraft.fontRenderer,
|
||||
minecraft.renderEngine, this.renderStack, xPosition + 2, yPosition + height/2 - 8);
|
||||
minecraft.renderEngine, this.renderStack, xPosition + 2, yPosition + height / 2 - 8);
|
||||
itemRenderer.renderItemOverlayIntoGUI(minecraft.fontRenderer,
|
||||
minecraft.renderEngine, this.renderStack, xPosition + 2, yPosition + height/2 - 8);
|
||||
minecraft.renderEngine, this.renderStack, xPosition + 2, yPosition + height / 2 - 8);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
@@ -86,39 +86,36 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
|
||||
String text = "";
|
||||
float maxWidth = width * 0.75f;
|
||||
if(fontrenderer.getStringWidth(displayString) > maxWidth){
|
||||
for(int h = 0; h < displayString.length(); h++){
|
||||
char c = displayString.charAt(h);
|
||||
if(fontrenderer.getStringWidth(text + c) > maxWidth)
|
||||
break;
|
||||
text += c;
|
||||
}
|
||||
text += "...";
|
||||
}
|
||||
else
|
||||
text = displayString;
|
||||
if (active){
|
||||
if (fontrenderer.getStringWidth(displayString) > maxWidth) {
|
||||
for (int h = 0; h < displayString.length(); h++) {
|
||||
char c = displayString.charAt(h);
|
||||
if (fontrenderer.getStringWidth(text + c) > maxWidth)
|
||||
break;
|
||||
text += c;
|
||||
}
|
||||
text += "...";
|
||||
} else
|
||||
text = displayString;
|
||||
if (active) {
|
||||
drawCenteredString(fontrenderer, text, xPosition + width / 2, yPosition + (height - 8) / 2, 0xffffa0);
|
||||
}
|
||||
else if (field_146123_n){
|
||||
} else if (field_146123_n) {
|
||||
drawCenteredString(fontrenderer, text, xPosition + width / 2, yPosition + (height - 8) / 2, 0xffffa0);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
drawCenteredString(fontrenderer, text, xPosition + width / 2, yPosition + (height - 8) / 2, 0xe0e0e0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseDragged(Minecraft minecraft, int i, int j){
|
||||
protected void mouseDragged(Minecraft minecraft, int i, int j) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int i, int j){
|
||||
public void mouseReleased(int i, int j) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft minecraft, int i, int j){
|
||||
public boolean mousePressed(Minecraft minecraft, int i, int j) {
|
||||
return !active && visible && field_146123_n;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user