Alex and Steve skins now switch to x64 or x32 models automatically.

This commit is contained in:
Luis C.M committed 2022-05-28 05:53:14 -05:00
1 parent 2b15ba9197
commit 4aa1799ec3
6 files changed
+69 -30

No files matched your search

@@ -46,6 +46,7 @@ public class DataDisplay {
public int showName = 0;
public int modelType = 0;
public boolean x64texture = false;
public boolean disableLivingAnimation = false;
@@ -110,25 +110,25 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
addButton(new GuiNpcButton(7, guiLeft + 50, y += 22, 50, 20, "selectServer.edit"));
addLabel(new GuiNpcLabel(4, "Legs", guiLeft, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Default","Steve64","Alex"}, this.npc.display.modelType));
addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Default","Steve64","Alex","Alex32"}, this.npc.display.modelType));
addLabel(new GuiNpcLabel(250, "Model", guiLeft, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(44, guiLeft + 310, guiTop + 14, 80, 20, "Save Model"));
addButton(new GuiNpcButton(45, guiLeft + 310, guiTop + 36, 80, 20, "Load Model"));
}
private void showPixelmonMenu(EntityLivingBase entity) {
GuiCustomScroll scroll = new GuiCustomScroll(this, 0);
scroll.setSize(120, 200);
scroll.guiLeft = guiLeft;
scroll.guiTop = guiTop + 20;
addScroll(scroll);
scroll.setList(PixelmonHelper.getPixelmonList());
scroll.setSelected(PixelmonHelper.getName(entity));
Minecraft.getMinecraft().thePlayer.sendChatMessage(PixelmonHelper.getName(entity));
}
@@ -137,7 +137,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
if(entity instanceof EntityNPCInterface)
return;
int y = guiTop + 20;
NBTTagCompound compound = getExtras(entity);
Set<String> keys = compound.func_150296_c();
int i = 0;
@@ -159,7 +159,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
i++;
addLabel(new GuiNpcLabel(100 + i, name, guiLeft, y + 5 + i * 22, 0xFFFFFF));
addButton(new GuiNpcButton(100 + i, guiLeft + 80, y + i * 22, 50, 20, new String[]{"gui.no","gui.yes"}, b));
mapped.put(i, name);
}
}
@@ -169,7 +169,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
Method method = entity.getClass().getMethod("getBreedID");
breed = (Integer) method.invoke(entity);
} catch (Exception e) {
}
i++;
addLabel(new GuiNpcLabel(201, "Breed", guiLeft, y + 5 + i * 22, 0xFFFFFF));
@@ -186,18 +186,18 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
private NBTTagCompound getExtras(EntityLivingBase entity) {
NBTTagCompound fake = new NBTTagCompound();
new EntityFakeLiving(entity.worldObj).writeEntityToNBT(fake);
NBTTagCompound compound = new NBTTagCompound();
try{
entity.writeEntityToNBT(compound);
}
catch(Exception e){
}
Set<String> keys = fake.func_150296_c();
for(String name : keys)
compound.removeTag(name);
return compound;
}
@@ -221,7 +221,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
}
else{
playerdata.setEntityClass(data.get(list.get(index)));
EntityLivingBase entity = playerdata.getEntity(npc);
if(entity != null){
RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity);
@@ -246,10 +246,10 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
playerdata.setEntityClass(data.get(list.get(index)));
updateTexture();
initGui();
}
if(button.id == 1){
this.mc.displayGuiScreen(new GuiEntitySelection(this, playerdata, npc));
}
@@ -283,7 +283,11 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
if (npc.display.skinType == 3){
npc.display.skinType = 2;
}
npc.display.modelType = 0;
if (npc.display.modelType == 2) {
npc.display.modelType = 3;
} else {
npc.display.modelType = 0;
}
}
npc.textureLocation = null;
}
@@ -194,7 +194,7 @@ public class ModelMPM extends ModelNPCMale{
}
// Steve 64x32
public ModelMPM(float par1) {
public ModelMPM(float par1, int alexArms) {
super(par1);
isArmor = par1 > 0;
@@ -219,14 +219,24 @@ public class ModelMPM extends ModelNPCMale{
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedRightArm = new ModelScaleRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
if (alexArms == 0) {
this.bipedRightArm = new ModelScaleRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
} else {
this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
this.bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1);
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
}
this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
@@ -29,7 +29,7 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
// Default Renderer
public RenderCustomNpc() {
super(new ModelMPM(0), new ModelMPM(1), new ModelMPM(0.5f));
super(new ModelMPM(0,0), new ModelMPM(1,0), new ModelMPM(0.5f,0));
}
@Override
@@ -37,6 +37,10 @@ public class RenderNPCHumanMale extends RenderNPCInterface
protected final static ModelMPM steve64 = new ModelMPM(0, false);
protected final static ModelMPM alex = new ModelMPM(0, true);
protected final static ModelMPM alex32mainmodel = new ModelMPM(0,1);
protected final static ModelMPM alex32armorChest = new ModelMPM(1,1);
protected final static ModelMPM alex32armor = new ModelMPM(0.5F,1);
public RenderNPCHumanMale(ModelNPCMale mainmodel, ModelNPCMale armorChest, ModelNPCMale armor)
{
super(mainmodel, 0.5F);
@@ -115,13 +119,32 @@ public class RenderNPCHumanMale extends RenderNPCInterface
EntityCustomNpc test = (EntityCustomNpc) npc;
if(test.modelData.entityClass == null){
int modelVal = npc.display.modelType;
if(modelVal == 1){
if(modelVal == 1 && npc.display.x64texture){
this.mainModel = steve64;
this.modelBipedMain = steve64;
}
else if(modelVal == 2){
this.mainModel = alex;
this.modelBipedMain = alex;
if (npc.display.x64texture) {
this.mainModel = alex;
this.modelBipedMain = alex;
} else {
((EntityCustomNpc) npc).modelData.bodywear = 0;
((EntityCustomNpc) npc).modelData.armwear = 0;
((EntityCustomNpc) npc).modelData.legwear = 0;
this.mainModel = alex32mainmodel;
this.modelBipedMain = alex32mainmodel;
this.modelArmorChestplate = alex32armorChest;
this.modelArmor = alex32armor;
}
}
else if(modelVal == 3){
((EntityCustomNpc) npc).modelData.bodywear = 0;
((EntityCustomNpc) npc).modelData.armwear = 0;
((EntityCustomNpc) npc).modelData.legwear = 0;
this.mainModel = alex32mainmodel;
this.modelBipedMain = alex32mainmodel;
this.modelArmorChestplate = alex32armorChest;
this.modelArmor = alex32armor;
}
else{
((EntityCustomNpc) npc).modelData.bodywear = 0;
@@ -363,7 +363,8 @@ public class RenderNPCInterface extends RenderLiving{
int totalWidth = bufferedimage.getWidth();
int totalHeight = bufferedimage.getHeight();
if (totalHeight > 32 && npc.display.modelType == 0) {
npc.display.x64texture = totalHeight > 32;
if (npc.display.x64texture && (npc.display.modelType == 0 || npc.display.modelType == 3)) {
bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32);
}