diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index 6bbe14b8e..77680e888 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -156,7 +156,7 @@ public class CustomNpcs { registerNpc(EntityNPCEnderman.class, "npcEnderman"); registerNpc(EntityNPCGolem.class, "npcGolem"); registerNpc(EntityCustomNpc.class, "CustomNpc"); - registerCustomModel(EntityGeckoModel.class, "CustomModel"); + registerCustomModel(EntityCustomModel.class, "CustomModel"); registerNewEntity(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false); registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true); diff --git a/src/main/java/noppes/npcs/client/ClientProxy.java b/src/main/java/noppes/npcs/client/ClientProxy.java index 1cffb9659..bbf4782dd 100644 --- a/src/main/java/noppes/npcs/client/ClientProxy.java +++ b/src/main/java/noppes/npcs/client/ClientProxy.java @@ -87,7 +87,7 @@ public class ClientProxy extends CommonProxy { new ScriptSoundController(); RenderingRegistry.registerEntityRenderingHandler(EntityNpcPony.class, new RenderNPCPony()); - RenderingRegistry.registerEntityRenderingHandler(EntityGeckoModel.class, new RenderGeckolib()); + RenderingRegistry.registerEntityRenderingHandler(EntityCustomModel.class, new RenderCustomModel()); RenderingRegistry.registerEntityRenderingHandler(EntityNpcCrystal.class, new RenderNpcCrystal(new ModelNpcCrystal(0.5F))); RenderingRegistry.registerEntityRenderingHandler(EntityNpcDragon.class, new RenderNpcDragon(new ModelNpcDragon(0.0F), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityNpcSlime.class, new RenderNpcSlime(new ModelNpcSlime(16), new ModelNpcSlime(0), 0.25F)); diff --git a/src/main/java/noppes/npcs/client/EntityUtil.java b/src/main/java/noppes/npcs/client/EntityUtil.java index 23aab1882..3142f2d4a 100644 --- a/src/main/java/noppes/npcs/client/EntityUtil.java +++ b/src/main/java/noppes/npcs/client/EntityUtil.java @@ -5,7 +5,7 @@ import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; -import noppes.npcs.entity.EntityGeckoModel; +import noppes.npcs.entity.EntityCustomModel; import noppes.npcs.entity.EntityNPCInterface; public class EntityUtil { @@ -86,11 +86,11 @@ public class EntityUtil { entity.setCurrentItemOrArmor(i, copied.getEquipmentInSlot(i)); } - if(entity instanceof EntityGeckoModel && copied instanceof EntityNPCInterface){ - ((EntityGeckoModel) entity).textureResLoc=new ResourceLocation(((EntityNPCInterface) copied).display.texture); - ((EntityGeckoModel) entity).modelResLoc=new ResourceLocation(((EntityNPCInterface) copied).display.model); - ((EntityGeckoModel) entity).animResLoc=new ResourceLocation(((EntityNPCInterface) copied).display.animFile); - ((EntityGeckoModel) entity).idleAnim=((EntityNPCInterface) copied).display.idleAnim; + if(entity instanceof EntityCustomModel && copied instanceof EntityNPCInterface){ + ((EntityCustomModel) entity).textureResLoc=new ResourceLocation(((EntityNPCInterface) copied).display.texture); + ((EntityCustomModel) entity).modelResLoc=new ResourceLocation(((EntityNPCInterface) copied).display.model); + ((EntityCustomModel) entity).animResLoc=new ResourceLocation(((EntityNPCInterface) copied).display.animFile); + ((EntityCustomModel) entity).idleAnim=((EntityNPCInterface) copied).display.idleAnim; } if(copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface){ diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java index 0962a1178..71283f649 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -15,6 +15,9 @@ 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; @@ -325,15 +328,15 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol } if(button.id == 202){ - NoppesUtil.openGUI(player, new GuiGeckoModelSelection(npc, this)); + NoppesUtil.openGUI(player, new GuiCustomModelSelection(npc, this)); } if(button.id == 203){ - NoppesUtil.openGUI(player, new GuiGeckoAnimFileSelection(npc, this)); + NoppesUtil.openGUI(player, new GuiCustomAnimFileSelection(npc, this)); } if(button.id == 204){ - NoppesUtil.openGUI(player, new GuiGeckoAnimationSelection(npc, this, (name)-> npc.display.idleAnim=name)); + NoppesUtil.openGUI(player, new GuiCustomAnimationSelection(npc, this, (name)-> npc.display.idleAnim=name)); } } diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiGeckoAnimFileSelection.java b/src/main/java/noppes/npcs/client/gui/model/GuiGeckoAnimFileSelection.java deleted file mode 100644 index caaba8155..000000000 --- a/src/main/java/noppes/npcs/client/gui/model/GuiGeckoAnimFileSelection.java +++ /dev/null @@ -1,72 +0,0 @@ -package noppes.npcs.client.gui.model; - -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.HashSet; -import java.util.Vector; - -public class GuiGeckoAnimFileSelection extends GuiNPCInterface { - public GuiNPCStringSlot slot; - public GuiScreen parent; - - public GuiGeckoAnimFileSelection(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 list = new Vector(); - 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() { - } -} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/model/GuiGeckoAnimFileSelection.java b/src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomAnimFileSelection.java similarity index 90% rename from src/main/java/noppes/npcs/client/model/GuiGeckoAnimFileSelection.java rename to src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomAnimFileSelection.java index dbccc392c..011a2a419 100644 --- a/src/main/java/noppes/npcs/client/model/GuiGeckoAnimFileSelection.java +++ b/src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomAnimFileSelection.java @@ -1,4 +1,4 @@ -package noppes.npcs.client.model; +package noppes.npcs.client.gui.model.custom; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -9,14 +9,13 @@ import noppes.npcs.entity.EntityNPCInterface; import software.bernie.geckolib3.resource.GeckoLibCache; import java.util.Collections; -import java.util.HashSet; import java.util.Vector; -public class GuiGeckoAnimFileSelection extends GuiNPCInterface { +public class GuiCustomAnimFileSelection extends GuiNPCInterface { public GuiNPCStringSlot slot; public GuiScreen parent; - public GuiGeckoAnimFileSelection(EntityNPCInterface npc, GuiScreen parent){ + public GuiCustomAnimFileSelection(EntityNPCInterface npc, GuiScreen parent){ super(npc); drawDefaultBackground = false; title = ""; diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiGeckoAnimationSelection.java b/src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomAnimationSelection.java similarity index 90% rename from src/main/java/noppes/npcs/client/gui/model/GuiGeckoAnimationSelection.java rename to src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomAnimationSelection.java index 64c398e3b..16f8ad557 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiGeckoAnimationSelection.java +++ b/src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomAnimationSelection.java @@ -1,4 +1,4 @@ -package noppes.npcs.client.gui.model; +package noppes.npcs.client.gui.model.custom; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -11,16 +11,15 @@ import software.bernie.geckolib3.file.AnimationFile; import software.bernie.geckolib3.resource.GeckoLibCache; import java.util.Collections; -import java.util.HashSet; import java.util.Vector; import java.util.function.Consumer; -public class GuiGeckoAnimationSelection extends GuiNPCInterface { +public class GuiCustomAnimationSelection extends GuiNPCInterface { public GuiNPCStringSlot slot; public GuiScreen parent; public Consumer action; - public GuiGeckoAnimationSelection(EntityNPCInterface npc, GuiScreen parent, Consumer action){ + public GuiCustomAnimationSelection(EntityNPCInterface npc, GuiScreen parent, Consumer action){ super(npc); drawDefaultBackground = false; title = ""; diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiGeckoModelSelection.java b/src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomModelSelection.java similarity index 90% rename from src/main/java/noppes/npcs/client/gui/model/GuiGeckoModelSelection.java rename to src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomModelSelection.java index 06160f426..725cb5506 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiGeckoModelSelection.java +++ b/src/main/java/noppes/npcs/client/gui/model/custom/GuiCustomModelSelection.java @@ -1,4 +1,4 @@ -package noppes.npcs.client.gui.model; +package noppes.npcs.client.gui.model.custom; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -9,14 +9,13 @@ import noppes.npcs.entity.EntityNPCInterface; import software.bernie.geckolib3.resource.GeckoLibCache; import java.util.Collections; -import java.util.HashSet; import java.util.Vector; -public class GuiGeckoModelSelection extends GuiNPCInterface { +public class GuiCustomModelSelection extends GuiNPCInterface { public GuiNPCStringSlot slot; public GuiScreen parent; - public GuiGeckoModelSelection(EntityNPCInterface npc, GuiScreen parent){ + public GuiCustomModelSelection(EntityNPCInterface npc, GuiScreen parent){ super(npc); drawDefaultBackground = false; title = ""; diff --git a/src/main/java/noppes/npcs/client/model/ModelGeckolib.java b/src/main/java/noppes/npcs/client/model/ModelCustom.java similarity index 57% rename from src/main/java/noppes/npcs/client/model/ModelGeckolib.java rename to src/main/java/noppes/npcs/client/model/ModelCustom.java index 4d4dfe884..7ab1a8f81 100644 --- a/src/main/java/noppes/npcs/client/model/ModelGeckolib.java +++ b/src/main/java/noppes/npcs/client/model/ModelCustom.java @@ -1,23 +1,22 @@ package noppes.npcs.client.model; import net.minecraft.util.ResourceLocation; -import noppes.npcs.entity.EntityGeckoModel; -import software.bernie.geckolib3.GeckoLib; +import noppes.npcs.entity.EntityCustomModel; import software.bernie.geckolib3.model.AnimatedGeoModel; -public class ModelGeckolib extends AnimatedGeoModel { +public class ModelCustom extends AnimatedGeoModel { @Override - public ResourceLocation getAnimationFileLocation(EntityGeckoModel entity) { + public ResourceLocation getAnimationFileLocation(EntityCustomModel entity) { return entity.animResLoc;//new ResourceLocation(GeckoLib.ModID, "animations/bike.animation.json"); } @Override - public ResourceLocation getModelLocation(EntityGeckoModel entity) { + public ResourceLocation getModelLocation(EntityCustomModel entity) { return entity.modelResLoc;//new ResourceLocation(GeckoLib.ModID, "geo/bike.geo.json"); } @Override - public ResourceLocation getTextureLocation(EntityGeckoModel entity) { + public ResourceLocation getTextureLocation(EntityCustomModel entity) { return entity.textureResLoc;//new ResourceLocation(GeckoLib.ModID, "textures/model/entity/bike.png"); } } \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/renderer/RenderGeckolib.java b/src/main/java/noppes/npcs/client/renderer/RenderCustomModel.java similarity index 81% rename from src/main/java/noppes/npcs/client/renderer/RenderGeckolib.java rename to src/main/java/noppes/npcs/client/renderer/RenderCustomModel.java index c13b63b2a..10ba064cd 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderGeckolib.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderCustomModel.java @@ -3,8 +3,8 @@ package noppes.npcs.client.renderer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; -import noppes.npcs.client.model.ModelGeckolib; -import noppes.npcs.entity.EntityGeckoModel; +import noppes.npcs.client.model.ModelCustom; +import noppes.npcs.entity.EntityCustomModel; import org.lwjgl.opengl.GL11; import software.bernie.geckolib3.geo.render.built.GeoBone; import software.bernie.geckolib3.geo.render.built.GeoModel; @@ -12,12 +12,12 @@ import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; import java.util.ArrayList; -public class RenderGeckolib extends GeoEntityRenderer { +public class RenderCustomModel extends GeoEntityRenderer { - public RenderGeckolib() { - super(new ModelGeckolib()); + public RenderCustomModel() { + super(new ModelCustom()); } - public void renderAfter(GeoModel model, EntityGeckoModel animatable, float ticks, float red, float green, float blue, float alpha) { + public void renderAfter(GeoModel model, EntityCustomModel animatable, float ticks, float red, float green, float blue, float alpha) { super.renderAfter(model, animatable, ticks, red, green, blue, alpha); if (model.getBone("held_item").isPresent() && animatable.getHeldItem() != null) { GeoBone bone = model.getBone("held_item").get(); @@ -34,7 +34,7 @@ public class RenderGeckolib extends GeoEntityRenderer { return (GeoBone[])bones.toArray(new GeoBone[0]); } - public void renderItem(EntityGeckoModel animatable, GeoBone locator, float ticks) { + public void renderItem(EntityCustomModel animatable, GeoBone locator, float ticks) { GL11.glPushMatrix(); float scale = 0.5F; GL11.glScaled(scale, scale, scale); @@ -59,7 +59,7 @@ public class RenderGeckolib extends GeoEntityRenderer { GL11.glPopMatrix(); } - public boolean isBoneRenderOverriden(EntityGeckoModel entity, GeoBone bone) { + public boolean isBoneRenderOverriden(EntityCustomModel entity, GeoBone bone) { return bone.name.equals("held_item"); } } \ No newline at end of file diff --git a/src/main/java/noppes/npcs/entity/EntityGeckoModel.java b/src/main/java/noppes/npcs/entity/EntityCustomModel.java similarity index 95% rename from src/main/java/noppes/npcs/entity/EntityGeckoModel.java rename to src/main/java/noppes/npcs/entity/EntityCustomModel.java index 36630bf41..caffd6e7b 100644 --- a/src/main/java/noppes/npcs/entity/EntityGeckoModel.java +++ b/src/main/java/noppes/npcs/entity/EntityCustomModel.java @@ -16,7 +16,7 @@ import software.bernie.geckolib3.core.manager.AnimationFactory; import java.util.Objects; -public class EntityGeckoModel extends EntityCreature implements IAnimatable, IAnimationTickable { +public class EntityCustomModel extends EntityCreature implements IAnimatable, IAnimationTickable { private AnimationFactory factory = new AnimationFactory(this); public ResourceLocation modelResLoc=new ResourceLocation("geckolib3", "geo/npc.geo.json"); public ResourceLocation animResLoc=new ResourceLocation("custom", "geo_npc.animation.json"); @@ -46,7 +46,7 @@ public class EntityGeckoModel extends EntityCreature implements IAnimatable, IAn return PlayState.CONTINUE; } - public EntityGeckoModel(World worldIn) { + public EntityCustomModel(World worldIn) { super(worldIn); this.ignoreFrustumCheck = true; this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));