mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 19:42:19 +00:00
GeckoLib Addon is now an OPTIONAL Supported Addon [WIP]
This commit is contained in:
1 parent
5678029e30
commit
3c225f74db
20 files changed
+167
-476
No files matched your search
@@ -1,8 +1,3 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.client.gui.custom.components;
|
||||
|
||||
import com.ibm.icu.text.ArabicShaping;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.client.gui.model;
|
||||
|
||||
import kamkeel.addon.GeckoAddonSupport;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -14,10 +15,6 @@ import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.model.custom.GuiCustomAnimFileSelection;
|
||||
import noppes.npcs.client.gui.model.custom.GuiCustomAnimationSelection;
|
||||
import noppes.npcs.client.gui.model.custom.GuiCustomModelSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.compat.PixelmonHelper;
|
||||
@@ -27,6 +24,8 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
|
||||
import static kamkeel.addon.GeckoAddonSupport.openGeckoGui;
|
||||
|
||||
public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{
|
||||
|
||||
public HashMap<String,Class<? extends EntityLivingBase>> data = new HashMap<String, Class<? extends EntityLivingBase>>();
|
||||
@@ -170,7 +169,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
addButton(new GuiNpcButton(201, guiLeft + 80, y + i * 22, 50, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}, breed));
|
||||
}
|
||||
|
||||
if(EntityList.getEntityString(entity).equals("customnpcs.CustomModel") || EntityList.getEntityString(entity).equals("CustomModel")){
|
||||
if(EntityList.getEntityString(entity).equals("customnpcsgecko.CustomModel") || EntityList.getEntityString(entity).equals("CustomModel")){
|
||||
this.addButton(new GuiNpcButton(202, guiLeft, y + i * 22, 120, 20, "Select model"));
|
||||
this.addButton(new GuiNpcButton(203, guiLeft, y + i * 22+20, 120, 20, "Select animation file"));
|
||||
this.addButton(new GuiNpcButton(204, guiLeft, y + i * 22+40, 120, 20, "Select idle animation"));
|
||||
@@ -327,16 +326,8 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
if(button.id == 202){
|
||||
NoppesUtil.openGUI(player, new GuiCustomModelSelection(npc, this));
|
||||
}
|
||||
|
||||
if(button.id == 203){
|
||||
NoppesUtil.openGUI(player, new GuiCustomAnimFileSelection(npc, this));
|
||||
}
|
||||
|
||||
if(button.id == 204){
|
||||
NoppesUtil.openGUI(player, new GuiCustomAnimationSelection(npc, this, (name)-> npc.display.idleAnim=name));
|
||||
if(GeckoAddonSupport.supportEnabled){
|
||||
openGeckoGui(this, button, player, npc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package noppes.npcs.client.gui.model.custom;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiCustomAnimFileSelection extends GuiNPCInterface {
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
|
||||
public GuiCustomAnimFileSelection(EntityNPCInterface npc, GuiScreen parent){
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
String ss = "Selecting geckolib animation file:";
|
||||
addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff));
|
||||
Vector<String> list = new Vector<String>();
|
||||
for(ResourceLocation resLoc : GeckoLibCache.getInstance().getAnimations().keySet()){
|
||||
list.add(resLoc.toString());
|
||||
}
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doubleClicked(){
|
||||
npc.display.animFile=slot.selected;
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package noppes.npcs.client.gui.model.custom;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import software.bernie.geckolib3.core.builder.Animation;
|
||||
import software.bernie.geckolib3.file.AnimationFile;
|
||||
import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class GuiCustomAnimationSelection extends GuiNPCInterface {
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
public Consumer<String> action;
|
||||
|
||||
public GuiCustomAnimationSelection(EntityNPCInterface npc, GuiScreen parent, Consumer<String> action){
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
this.action=action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
String ss = "Selecting geckolib animation:";
|
||||
addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff));
|
||||
Vector<String> list = new Vector<String>();
|
||||
AnimationFile file = GeckoLibCache.getInstance().getAnimations().get(new ResourceLocation(npc.display.animFile));
|
||||
if(file!=null) {
|
||||
for (Animation anim : file.getAllAnimations()) {
|
||||
list.add(anim.animationName);
|
||||
}
|
||||
}
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doubleClicked(){
|
||||
//npc.display.animFile=slot.selected;
|
||||
action.accept(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package noppes.npcs.client.gui.model.custom;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiCustomModelSelection extends GuiNPCInterface {
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
|
||||
public GuiCustomModelSelection(EntityNPCInterface npc, GuiScreen parent){
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
String ss = "Selecting geckolib model:";
|
||||
addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff));
|
||||
Vector<String> list = new Vector<String>();
|
||||
for(ResourceLocation resLoc : GeckoLibCache.getInstance().getGeoModels().keySet()){
|
||||
list.add(resLoc.toString());
|
||||
}
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doubleClicked(){
|
||||
npc.display.model=slot.selected;
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user