CustomNPC64 Created and Completed

Working on editting the code so that the load texture function is called differently for CustomNPC64.
This commit is contained in:
KAMKEEL committed 2021-04-29 02:53:19 -04:00
1 parent 265cc0cc7c
commit 5f2b7a0142
10 files changed
+68 -13

No files matched your search

+1 -1
View File
@@ -201,7 +201,7 @@ public class CustomNpcs {
registerNpc(EntityNpcDragon.class, "NpcDragon");
registerNpc(EntityNPCEnderman.class, "npcEnderman");
registerNpc(EntityNPCGolem.class, "npcGolem");
registerNpc(EntityNPC64x64.class, "CustomNpc64");
registerNpc(EntityCustomNpc64.class, "CustomNpc64");
registerNpc(EntityCustomNpc.class, "CustomNpc");
@@ -14,7 +14,6 @@ import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPC64x64;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.ScriptEvent;
import noppes.npcs.scripted.ScriptNpc;
@@ -183,7 +183,8 @@ public class ClientProxy extends CommonProxy {
// Changes Made Here:
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc());
RenderingRegistry.registerEntityRenderingHandler(EntityNPC64x64.class, new RenderCustomNpc(false)); // False for Steve
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc64.class, new RenderCustomNpc(false)); // False for Steve
// RenderingRegistry.registerEntityRenderingHandler(EntityNPCAlex.class, new RenderCustomNpc(true)); // False for Steve
RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale(
@@ -32,7 +32,7 @@ import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityFakeLiving;
import noppes.npcs.entity.EntityNPC64x64;
import noppes.npcs.entity.EntityCustomNpc64;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{
@@ -54,7 +54,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
for(Object name : mapping.keySet()){
Class<?> c = (Class<?>) mapping.get(name);
try {
if(!EntityCustomNpc.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){
if( (!EntityCustomNpc.class.isAssignableFrom(c) && !EntityCustomNpc.class.isAssignableFrom(c)) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){
if(RenderManager.instance.getEntityClassRenderObject(c) instanceof RendererLivingEntity)
data.put(name.toString(),c.asSubclass(EntityLivingBase.class));
}
@@ -63,7 +63,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
} catch (NoSuchMethodException e) {
}
}
data.put("CustomNPC64x64", EntityNPC64x64.class);
data.put("CustomNPC64x64", EntityCustomNpc64.class);
list = new ArrayList<String>(data.keySet());
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
}
@@ -161,7 +161,7 @@ public class ModelMPM extends ModelNPCMale{
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
headwear = new ModelHeadwear(this);
headwear = new ModelHeadwear(this, arms);
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg);
this.bipedBody.addChild(breasts = new ModelBreasts(this));
@@ -52,6 +52,51 @@ public class ModelHeadwear extends ModelScaleRenderer{
this.addChild(bottom);
}
public ModelHeadwear(ModelBase base, boolean alex) {
super(base);
Model2DRenderer right = new Model2DRenderer(base, 32, 8, 8, 8, 64, 64);
right.setRotationPoint(-4.641F, .8f, 4.64f);
right.setScale(0.58f);
right.setThickness(0.65f);
setRotation(right, 0, (float)(Math.PI/2f), 0);
this.addChild(right);
Model2DRenderer left = new Model2DRenderer(base, 48, 8, 8, 8, 64, 64);
left.setRotationPoint(4.639F, .8f, -4.64f);
left.setScale(0.58f);
left.setThickness(0.65f);
setRotation(left, 0, (float)(Math.PI/-2f), 0);
this.addChild(left);
Model2DRenderer front = new Model2DRenderer(base, 40, 8, 8, 8, 64, 64);
front.setRotationPoint(-4.64F, .801f, -4.641f);
front.setScale(0.58f);
front.setThickness(0.65f);
setRotation(front, 0, 0, 0);
this.addChild(front);
Model2DRenderer back = new Model2DRenderer(base, 56, 8, 8, 8, 64, 64);
back.setRotationPoint(4.64F, .801f, 4.639f);
back.setScale(0.58f);
back.setThickness(0.65f);
setRotation(back, 0, (float)(Math.PI), 0);
this.addChild(back);
Model2DRenderer top = new Model2DRenderer(base, 40, 0, 8, 8, 64, 64);
top.setRotationPoint(-4.64F, -8.5f, -4.64f);
top.setScale(0.5799f);
top.setThickness(0.65f);
setRotation(top, (float)(Math.PI / -2), 0, 0);
this.addChild(top);
Model2DRenderer bottom = new Model2DRenderer(base, 48, 0, 8, 8, 64, 64);
bottom.setRotationPoint(-4.64F, 0f, -4.64f);
bottom.setScale(0.5799f);
bottom.setThickness(0.65f);
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
this.addChild(bottom);
}
public void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
@@ -18,8 +18,8 @@ public class ImageBufferDownloadAlt extends ImageBufferDownload
NPC64 = false;
}
public ImageBufferDownloadAlt(boolean type){
NPC64 = type;
public ImageBufferDownloadAlt(boolean newVersion){
NPC64 = newVersion;
}
@@ -24,6 +24,7 @@ import noppes.npcs.client.model.ModelMPM;
import noppes.npcs.constants.EnumAnimation;
import noppes.npcs.constants.EnumStandingType;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityCustomNpc64;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
@@ -306,7 +307,12 @@ public class RenderNPCInterface extends RenderLiving{
sb.append(String.format("%02x", b&0xff));
}
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
loadSkin(null, npc.textureLocation, npc.display.url);
if(entity instanceof EntityCustomNpc64){
loadSkin(null, npc.textureLocation, npc.display.url, true);
}
loadSkin(null, npc.textureLocation, npc.display.url, false);
LastTextureTick = 0;
}
catch(Exception ex){
@@ -319,9 +325,13 @@ public class RenderNPCInterface extends RenderLiving{
return npc.textureLocation;
}
private void loadSkin(File file, ResourceLocation resource, String par1Str){
// True = 64x64 Skin
private void loadSkin(File file, ResourceLocation resource, String par1Str, boolean newVersion){
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt());
if(newVersion){
object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt(newVersion));
}
texturemanager.loadTexture(resource, object);
}
@@ -9,9 +9,9 @@ import noppes.npcs.ModelData;
import noppes.npcs.ModelPartData;
import noppes.npcs.client.EntityUtil;
public class EntityNPC64x64 extends EntityCustomNpc{
public class EntityCustomNpc64 extends EntityCustomNpc{
public EntityNPC64x64(World world) {
public EntityCustomNpc64(World world) {
super(world);
display.texture = "customnpcs:textures/entity/humanmale/Steve64.png";
}