4th Version of Model Switcher

Moved code to interiror to check if entity selected was a CustomNPC and not another model.
This commit is contained in:
KAMKEEL committed 2021-04-29 23:35:20 -04:00
1 parent c95905ebf9
commit 8f040b7501
2 files changed
+20 -12

No files matched your search

@@ -21,6 +21,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import noppes.npcs.client.model.ModelMPM;
import noppes.npcs.client.model.ModelNPCMale;
import noppes.npcs.constants.EnumAnimation;
import noppes.npcs.entity.EntityCustomNpc;
@@ -110,6 +111,24 @@ public class RenderNPCHumanMale extends RenderNPCInterface
public void renderPlayer(EntityNPCInterface npc, double d, double d1, double d2,
float f, float f1)
{
// SEEMS TO WORK FOR NOW. Keeps NPC from outsyncing with Creature Models
if(npc instanceof EntityCustomNpc){
EntityCustomNpc test = (EntityCustomNpc) npc;
if(test.modelData.entityClass == null){
int modelVal = npc.display.modelType;
if(modelVal == 0){
this.mainModel = originalModel;
}
else if(modelVal == 1){
this.mainModel = new ModelMPM(0, false);
}
else{
this.mainModel = new ModelMPM(0, true);
}
}
}
ItemStack itemstack = npc.getHeldItem();
modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight =
itemstack == null ? 0 : npc.hurtResistantTime > 0 ? 3 : 1;
@@ -36,7 +36,7 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
public class RenderNPCInterface extends RenderLiving{
public static long LastTextureTick = 0;
private ModelBase originalModel;
public ModelBase originalModel;
public RenderNPCInterface(ModelBase model, float f){
super(model, f);
@@ -197,17 +197,6 @@ public class RenderNPCInterface extends RenderLiving{
public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){
EntityNPCInterface npc = (EntityNPCInterface) entityliving;
int modelVal = npc.display.modelType;
if(modelVal == 0){
this.mainModel = this.originalModel;
}
else if(modelVal == 1){
this.mainModel = new ModelMPM(0, false);
}
else{
this.mainModel = new ModelMPM(0, true);
}
if(npc.isKilled() && npc.stats.hideKilledBody && npc.deathTime > 20){
return;
}