Update CNPC+ to Support GeckoLib Mixin with Addon Classes

This commit is contained in:
Kam committed 2024-01-24 22:05:56 -05:00
1 parent 3c225f74db
commit fc34e0a40d
14 files changed
+96 -154

No files matched your search

@@ -1,11 +1,10 @@
package noppes.npcs.client;
import kamkeel.addon.GeckoAddonSupport;
import kamkeel.addon.GeckoAddon;
import net.minecraft.entity.EntityLivingBase;
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.EntityNPCInterface;
public class EntityUtil {
@@ -86,7 +85,7 @@ public class EntityUtil {
entity.setCurrentItemOrArmor(i, copied.getEquipmentInSlot(i));
}
GeckoAddonSupport.geckoModelCopy(copied, entity);
GeckoAddon.instance.geckoCopyData(copied, entity);
if(copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface){
EntityNPCInterface npc = (EntityNPCInterface) copied;
@@ -1,6 +1,7 @@
package noppes.npcs.client.gui.mainmenu;
import com.mojang.authlib.GameProfile;
import kamkeel.addon.client.GeckoAddonClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.DataDisplay;
@@ -95,6 +96,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
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));
GeckoAddonClient.Instance.geckoNpcDisplayInitGui(this);
}
@Override
@@ -192,6 +194,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
else if(button.id == 15){
setSubGui(new SubGuiNpcName(display));
}
GeckoAddonClient.Instance.geckoNpcDisplayActionPerformed(this, button);
}
@Override
@@ -1,6 +1,7 @@
package noppes.npcs.client.gui.model;
import kamkeel.addon.GeckoAddonSupport;
import kamkeel.addon.GeckoAddon;
import kamkeel.addon.client.GeckoAddonClient;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@@ -24,8 +25,6 @@ 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>>();
@@ -169,12 +168,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("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"));
//this.addButton(new GuiNpcButton(203, guiLeft, y + i * 22+60, 120, 20, "Select animation file"));
}
GeckoAddonClient.Instance.showGeckoButtons(this, entity);
}
private boolean isIgnored(String tag){
for(String s : ignoredTags)
@@ -326,9 +320,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
} catch (Exception ignored) {}
}
if(GeckoAddonSupport.supportEnabled){
openGeckoGui(this, button, player, npc);
}
GeckoAddonClient.Instance.geckoGuiCreationScreenActionPerformed(this, button);
}
private void updateTexture(){
@@ -2,7 +2,8 @@ package noppes.npcs.client.renderer;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import kamkeel.addon.GeckoAddonSupport;
import kamkeel.addon.GeckoAddon;
import kamkeel.addon.client.GeckoAddonClient;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.FontRenderer;
@@ -11,7 +12,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.SkinManager;
@@ -33,7 +33,6 @@ import org.lwjgl.opengl.GL11;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
@@ -220,10 +219,8 @@ public class RenderNPCInterface extends RenderLiving{
protected void renderModel(EntityLivingBase entityliving, float par2, float par3, float par4, float par5, float par6, float par7) {
EntityNPCInterface npc = (EntityNPCInterface) entityliving;
if(GeckoAddonSupport.geckoModelRender(mainModel)){
GL11.glRotatef(180, 1,0,0);
GL11.glTranslated(0, -1.5,0);
renderGeoModel(npc, npc.rotationYaw, Minecraft.getMinecraft().timer.renderPartialTicks);
if(GeckoAddonClient.Instance.isGeckoModel(mainModel)){
GeckoAddonClient.Instance.geckoRenderModel((ModelMPM) mainModel, npc, npc.rotationYaw, Minecraft.getMinecraft().timer.renderPartialTicks);
} else if (this.getEntityTexture(entityliving) != null) {
super.renderModel(entityliving, par2, par3, par4, par5, par6, par7);
}