mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Added custom hitbox editing gui and linked it to GuiNpcDisplay
This commit is contained in:
1 parent
d10d582a18
commit
c3a8171fda
2 files changed
+67
-6
No files matched your search
@@ -0,0 +1,61 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.data.CustomHitboxData;
|
||||
|
||||
public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private CustomHitboxData hitboxData;
|
||||
public SubGuiCustomHitbox(CustomHitboxData hitboxData){
|
||||
this.hitboxData = hitboxData;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"Custom hitbox", guiLeft + 5, guiTop + 35));
|
||||
addButton(new GuiNpcButtonYesNo(0,guiLeft + 122, guiTop + 30, 56, 20 ,hitboxData.isCustomHitbox()));
|
||||
if(hitboxData.isCustomHitbox()){
|
||||
addLabel(new GuiNpcLabel(3,"Width", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, hitboxData.getWidth() + ""));
|
||||
getTextField(2).floatsOnly = true;
|
||||
getTextField(2).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 20);
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"Height", guiLeft + 5, guiTop + 79));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + 75, 50, 18, hitboxData.getHeight() + ""));
|
||||
getTextField(3).floatsOnly = true;
|
||||
getTextField(3).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 20);
|
||||
}
|
||||
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(button.id == 0){
|
||||
hitboxData.setCustomHitbox(((GuiNpcButtonYesNo)button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if(id == 66){
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 2){
|
||||
hitboxData.setWidth(textfield.getFloat());
|
||||
}
|
||||
if(textfield.id == 3){
|
||||
hitboxData.setHeight(textfield.getFloat());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,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));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(1,"display.model", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 50, y,110,20, "selectServer.edit"));
|
||||
@@ -94,7 +90,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
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));
|
||||
|
||||
addButton(new GuiNpcButton(12,guiLeft + 290, y, 56, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(12,"Hitbox", guiLeft + 240, y + 5));
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayInitGui(this);
|
||||
}
|
||||
|
||||
@@ -185,6 +182,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
npc.display.skinOverlayData.overlayList.get(0).setBlend(button.getValue() == 0);
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 12){
|
||||
setSubGui(new SubGuiCustomHitbox(display.customHitboxData));
|
||||
}
|
||||
else if(button.id == 14){
|
||||
String name = display.getRandomName();
|
||||
display.setName(name);
|
||||
|
||||
Reference in new issue
Block a user