mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 19:34:09 +00:00
Added and linked npc tint sub gui
This commit is contained in:
1 parent
6dcbee69cd
commit
d10bb18ea4
2 files changed
+110
-4
No files matched your search
@@ -0,0 +1,105 @@
|
||||
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;
|
||||
private int lastColorClicked = -1;
|
||||
|
||||
public SubGuiNpcTint(CustomTintData tintData) {
|
||||
this.tintData = tintData;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = 30;
|
||||
addLabel(new GuiNpcLabel(0, "Enable Custom Tint", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(0, guiLeft + 122, guiTop + y, 56, 20, tintData.isEnableCustomTint()));
|
||||
y+=22;
|
||||
if (tintData.isEnableCustomTint()) {
|
||||
addLabel(new GuiNpcLabel(1, "Enable Npc Tint", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(1, guiLeft + 122, guiTop + y, 56, 20, tintData.isEnableNpcTint()));
|
||||
y+=22;
|
||||
if(tintData.isEnableNpcTint()) {
|
||||
String color = Integer.toHexString(tintData.getColorNpcTint());
|
||||
while (color.length() < 6) color = 0 + color;
|
||||
addLabel(new GuiNpcLabel(2, "Npc Tint", guiLeft + 4, guiTop + y + 5));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 122, guiTop + y, 60, 20, color));
|
||||
getButton(2).setTextColor(tintData.getColorNpcTint());
|
||||
y+=22;
|
||||
addLabel(new GuiNpcLabel(3,"Npc Tint Alpha", guiLeft + 5, guiTop + y + 5));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + y, 60, 20, tintData.getColorNpcTintAlpha() + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(1, 100, 40);
|
||||
y+=22;
|
||||
}
|
||||
addLabel(new GuiNpcLabel(4, "Enable Hurt Tint", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(4, guiLeft + 122, guiTop + y, 56, 20, tintData.isEnableHurtTint()));
|
||||
y+=22;
|
||||
if (tintData.isEnableHurtTint()) {
|
||||
String color2 = Integer.toHexString(tintData.getColorHurtTint());
|
||||
while (color2.length() < 6) color2 = 0 + color2;
|
||||
addLabel(new GuiNpcLabel(5, "Hurt Tint", guiLeft + 4, guiTop + y + 5));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 122, guiTop + y, 60, 20, color2));
|
||||
getButton(5).setTextColor(tintData.getColorHurtTint());
|
||||
}
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (id == 0) {
|
||||
tintData.setEnableCustomTint(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if (id == 1) {
|
||||
tintData.setEnableNpcTint(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if (id == 4) {
|
||||
tintData.setEnableHurtTint(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 2) {
|
||||
setSubGui(new SubGuiColorSelector(tintData.getColorNpcTint()));
|
||||
lastColorClicked = 0;
|
||||
}
|
||||
if (button.id == 5) {
|
||||
setSubGui(new SubGuiColorSelector(tintData.getColorHurtTint()));
|
||||
lastColorClicked = 1;
|
||||
}
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (lastColorClicked == 0) {
|
||||
tintData.setColorNpcTint(((SubGuiColorSelector) subgui).color);
|
||||
} else if (lastColorClicked == 1) {
|
||||
tintData.setColorHurtTint(((SubGuiColorSelector) subgui).color);
|
||||
}
|
||||
initGui();
|
||||
save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id==3){
|
||||
tintData.setColorNpcTintAlpha(textfield.getInteger());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.DataDisplay;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.GuiNPCTextures;
|
||||
import noppes.npcs.client.gui.GuiNpcTextureCloaks;
|
||||
import noppes.npcs.client.gui.GuiNpcTextureOverlays;
|
||||
import noppes.npcs.client.gui.SubGuiNpcName;
|
||||
import noppes.npcs.client.gui.*;
|
||||
import noppes.npcs.client.gui.model.GuiCreationScreen;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
@@ -46,6 +43,7 @@ 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));
|
||||
@@ -185,6 +183,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
npc.display.skinOverlayData.overlayList.get(0).setBlend(button.getValue() == 0);
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 13){
|
||||
setSubGui(new SubGuiNpcTint(display.customTintData));
|
||||
}
|
||||
else if(button.id == 14){
|
||||
String name = display.getRandomName();
|
||||
display.setName(name);
|
||||
|
||||
Reference in new issue
Block a user