mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 12:25:59 +00:00
Tint Code Refactoring and some cleanup wo the lang file
This commit is contained in:
1 parent
d75a054118
commit
ea0b8ec5a4
8 files changed
+85
-84
No files matched your search
@@ -1,10 +1,8 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.DataStats;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.DialogImage;
|
||||
|
||||
public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, ITextfieldListener {
|
||||
private CustomTintData tintData;
|
||||
@@ -22,35 +20,35 @@ public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, I
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = 30;
|
||||
addLabel(new GuiNpcLabel(0, "tint.enablecustom", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(0, guiLeft + 122, guiTop + y, 56, 20, tintData.isEnableCustomTint()));
|
||||
addLabel(new GuiNpcLabel(0, "tint.enable", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(0, guiLeft + 122, guiTop + y, 56, 20, tintData.isTintEnabled()));
|
||||
y+=22;
|
||||
if (tintData.isEnableCustomTint()) {
|
||||
addLabel(new GuiNpcLabel(1, "tint.enablenpc", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(1, guiLeft + 122, guiTop + y, 56, 20, tintData.isEnableNpcTint()));
|
||||
if (tintData.isTintEnabled()) {
|
||||
addLabel(new GuiNpcLabel(1, "tint.enablegeneral", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(1, guiLeft + 122, guiTop + y, 56, 20, tintData.isGeneralTintEnabled()));
|
||||
y+=22;
|
||||
if(tintData.isEnableNpcTint()) {
|
||||
String color = Integer.toHexString(tintData.getColorNpcTint());
|
||||
if(tintData.isGeneralTintEnabled()) {
|
||||
String color = Integer.toHexString(tintData.getGeneralTint());
|
||||
while (color.length() < 6) color = 0 + color;
|
||||
addLabel(new GuiNpcLabel(2, "tint.tint", guiLeft + 4, guiTop + y + 5));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 122, guiTop + y, 60, 20, color));
|
||||
getButton(2).setTextColor(tintData.getColorNpcTint());
|
||||
getButton(2).setTextColor(tintData.getGeneralTint());
|
||||
y+=22;
|
||||
addLabel(new GuiNpcLabel(3,"tint.alpha", guiLeft + 5, guiTop + y + 5));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + y, 60, 20, tintData.getColorNpcTintAlpha() + ""));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + y, 60, 20, tintData.getGeneralAlpha() + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(1, 100, 40);
|
||||
y+=22;
|
||||
}
|
||||
addLabel(new GuiNpcLabel(4, "tint.enablehurt", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(4, guiLeft + 122, guiTop + y, 56, 20, tintData.isEnableHurtTint()));
|
||||
addButton(new GuiNpcButtonYesNo(4, guiLeft + 122, guiTop + y, 56, 20, tintData.isHurtTintEnabled()));
|
||||
y+=22;
|
||||
if (tintData.isEnableHurtTint()) {
|
||||
String color2 = Integer.toHexString(tintData.getColorHurtTint());
|
||||
if (tintData.isHurtTintEnabled()) {
|
||||
String color2 = Integer.toHexString(tintData.getHurtTint());
|
||||
while (color2.length() < 6) color2 = 0 + color2;
|
||||
addLabel(new GuiNpcLabel(5, "tint.hurt", guiLeft + 4, guiTop + y + 5));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 122, guiTop + y, 60, 20, color2));
|
||||
getButton(5).setTextColor(tintData.getColorHurtTint());
|
||||
getButton(5).setTextColor(tintData.getHurtTint());
|
||||
}
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
||||
@@ -61,23 +59,23 @@ public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, I
|
||||
int id = guibutton.id;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (id == 0) {
|
||||
tintData.setEnableCustomTint(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
tintData.setTintEnabled(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if (id == 1) {
|
||||
tintData.setEnableNpcTint(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
tintData.setGeneralTintEnabled(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if (id == 4) {
|
||||
tintData.setEnableHurtTint(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
tintData.setHurtTintEnabled(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 2) {
|
||||
setSubGui(new SubGuiColorSelector(tintData.getColorNpcTint()));
|
||||
setSubGui(new SubGuiColorSelector(tintData.getGeneralTint()));
|
||||
lastColorClicked = 0;
|
||||
}
|
||||
if (button.id == 5) {
|
||||
setSubGui(new SubGuiColorSelector(tintData.getColorHurtTint()));
|
||||
setSubGui(new SubGuiColorSelector(tintData.getHurtTint()));
|
||||
lastColorClicked = 1;
|
||||
}
|
||||
if (id == 66) {
|
||||
@@ -88,9 +86,9 @@ public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, I
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (lastColorClicked == 0) {
|
||||
tintData.setColorNpcTint(((SubGuiColorSelector) subgui).color);
|
||||
tintData.setGeneralTint(((SubGuiColorSelector) subgui).color);
|
||||
} else if (lastColorClicked == 1) {
|
||||
tintData.setColorHurtTint(((SubGuiColorSelector) subgui).color);
|
||||
tintData.setHurtTint(((SubGuiColorSelector) subgui).color);
|
||||
}
|
||||
initGui();
|
||||
save();
|
||||
@@ -99,7 +97,7 @@ public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, I
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id==3){
|
||||
tintData.setColorNpcTintAlpha(textfield.getInteger());
|
||||
tintData.setGeneralAlpha(textfield.getInteger());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(11,"gui.title", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(11,this, fontRendererObj, guiLeft + 50, y, 206, 20, display.title));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 259, y , 80, 20, "Tint settings"));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(1,"display.model", guiLeft + 5, y + 5));
|
||||
@@ -82,16 +81,18 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0));
|
||||
|
||||
addLabel(new GuiNpcLabel(6,"Collides With Entities", guiLeft + 185, y + 5));
|
||||
addLabel(new GuiNpcLabel(6,"display.collides", guiLeft + 185, y + 5));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 300, y, 100, 20, new String[]{"gui.yes","gui.no","Only CNPCs","Only Players","CNPCs & Players"}, display.collidesWith));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible));
|
||||
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 185, y , 100, 20, "display.tintsettings"));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 120, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 60, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar));
|
||||
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayInitGui(this);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user