Refactor skin meta and general cleanup.

This commit is contained in:
Matthew Messinger 2015-12-08 22:14:42 -05:00
parent 78d0052464
commit 423064c504
35 changed files with 542 additions and 647 deletions

View file

@ -1,6 +1,5 @@
package com.brohoof.minelittlepony;
import java.awt.Color;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
@ -14,38 +13,19 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class Pony {
private static PonyConfig config = MineLittlePony.getConfig();
public PonyRace race = PonyRace.EARTH;
public boolean advancedTexturing;
public ResourceLocation textureResourceLocation;
public boolean isSpPlayer;
public boolean isPony;
public boolean isPonySkin;
public boolean isPegasus;
public boolean isUnicorn;
public boolean isFlying;
public boolean isGlow;
public int glowColor = -12303190;
public boolean isMale;
public int size = 1;
public int wantTail;
public boolean isVillager;
public int villagerProfession = 1;
public float defaultYOffset = 1.62F;
boolean pegasusFlying;
@SuppressWarnings("unused")
private final int dangerzone = 2;
private float previousFallDistance;
private static int ponyCount = 0;
private final int ponyId = ponyCount++;
public ResourceLocation textureResourceLocation;
public PonyData metadata = new PonyData();
private int skinCheckCount;
private boolean skinChecked;
private boolean newSkinSize;
@ -65,7 +45,6 @@ public class Pony {
}
public void invalidateSkinCheck() {
this.resetValues();
this.skinChecked = false;
}
@ -114,248 +93,67 @@ public class Pony {
public void checkSkin(BufferedImage bufferedimage) {
MineLPLogger.debug("\tStart skin check #%d for pony #%d with image %s.", ++this.skinCheckCount, this.ponyId);
this.resetValues();
Color flagPix = new Color(bufferedimage.getRGB(0, 0), true);
Color applejack = new Color(249, 177, 49, 255);
Color dashie = new Color(136, 202, 240, 255);
Color twilight = new Color(209, 159, 228, 255);
Color celestia = new Color(254, 249, 252, 255);
Color zecora = new Color(208, 204, 207, 255);
Color changeling = new Color(40, 43, 41, 255);
if (flagPix.equals(applejack)) {
this.isPony = true;
this.isPonySkin = true;
this.race = Pony.PonyRace.EARTH;
}
if (flagPix.equals(zecora)) {
this.isPony = true;
this.isPonySkin = true;
this.race = Pony.PonyRace.ZEBRA;
}
if (flagPix.equals(dashie)) {
this.isPony = true;
this.isPonySkin = true;
this.isPegasus = true;
this.race = Pony.PonyRace.PEGASUS;
}
if (flagPix.equals(twilight)) {
this.isPony = true;
this.isPonySkin = true;
this.isUnicorn = true;
this.race = Pony.PonyRace.UNICORN;
}
if (flagPix.equals(celestia)) {
this.isPony = true;
this.isPonySkin = true;
this.isPegasus = true;
this.isUnicorn = true;
this.race = Pony.PonyRace.ALICORN;
}
if (flagPix.equals(changeling)) {
this.isPony = true;
this.isPonySkin = true;
this.isPegasus = true;
this.isUnicorn = true;
this.race = Pony.PonyRace.CHANGELING;
}
Color tailcolor = new Color(bufferedimage.getRGB(1, 0), true);
Color tailcolor1 = new Color(66, 88, 68, 255);
Color tailcolor2 = new Color(70, 142, 136, 255);
Color tailcolor3 = new Color(83, 75, 118, 255);
Color tailcolor4 = new Color(138, 107, 127, 255);
if (tailcolor.equals(tailcolor1)) {
this.wantTail = 4;
} else if (tailcolor.equals(tailcolor2)) {
this.wantTail = 3;
} else if (tailcolor.equals(tailcolor3)) {
this.wantTail = 2;
} else if (tailcolor.equals(tailcolor4)) {
this.wantTail = 1;
} else {
this.wantTail = 0;
}
Color gendercolor = new Color(bufferedimage.getRGB(2, 0), true);
Color gendercolor1 = new Color(255, 255, 255, 255);
if (gendercolor.equals(gendercolor1)) {
this.isMale = true;
} else {
this.isMale = false;
}
Color sizecolor = new Color(bufferedimage.getRGB(3, 0), true);
Color scootaloo = new Color(255, 190, 83);
Color bigmac = new Color(206, 50, 84);
Color luna = new Color(42, 60, 120);
if (config.getSizes().get()) {
if (sizecolor.equals(scootaloo)) {
this.size = 0;
} else if (sizecolor.equals(bigmac)) {
this.size = 2;
} else if (sizecolor.equals(luna)) {
this.size = 3;
} else {
this.size = 1;
}
}
Color black = new Color(0, 0, 0);
int scaleFactor = bufferedimage.getHeight() / 32;
int tileSize = 8 * scaleFactor;
Color advcutiecolor = new Color(bufferedimage.getRGB(tileSize / 2, 0), true);
if (advcutiecolor.getAlpha() == 0) {
this.advancedTexturing = false;
} else {
this.advancedTexturing = false;
for (int tempGlowColor = tileSize / 2; tempGlowColor < tileSize; ++tempGlowColor) {
for (int y = 0; y < tileSize; ++y) {
Color aColor = new Color(bufferedimage.getRGB(tempGlowColor, y), true);
if (!aColor.equals(black)) {
this.advancedTexturing = true;
}
}
}
}
Color var27 = new Color(bufferedimage.getRGB(0, 1), true);
if (!var27.equals(black) && var27.getAlpha() != 0) {
this.glowColor = var27.getRGB();
} else {
this.glowColor = -12303190;
}
metadata = PonyData.parse(bufferedimage);
this.newSkinSize = bufferedimage.getWidth() == bufferedimage.getHeight();
this.skinChecked = true;
MineLPLogger.debug(
"\tSkin check #%d for pony #%d completed. {IsPony:%b, Race:%s, FlagPixel:%s, AdvancedTexturing:%b}",
this.skinCheckCount, this.ponyId, this.isPony, this.race, flagPix, this.advancedTexturing);
}
protected void resetValues() {
this.isPony = false;
this.isPonySkin = false;
this.isPegasus = false;
this.isUnicorn = false;
this.isPonySkin = false;
this.isMale = false;
this.wantTail = 0;
this.size = 1;
}
public boolean isPony() {
return this.isPony;
}
public boolean isPonySkin() {
return this.isPonySkin;
}
public boolean isUnicorn() {
return this.isUnicorn;
}
public boolean isPegasus() {
return this.isPegasus;
}
public Pony.PonyRace getRace() {
return this.race;
}
public int wantTail() {
return this.wantTail;
}
public boolean isMale() {
return this.isMale;
}
public int size() {
return config.getSizes().get() ? this.size : 1;
}
public boolean advancedTexturing() {
return this.advancedTexturing;
}
public boolean isFlying() {
return this.isFlying;
}
public boolean isGlow() {
return this.isGlow;
}
public int glowColor() {
return this.glowColor;
}
public int villagerProfession() {
return this.villagerProfession;
}
public boolean isPegasusFlying(double posX, double posY, double posZ, float fallDistance, boolean isJumping,
boolean onGround, World equestria) {
if (!this.isPegasus) {
return pegasusFlying = false;
} else if (isJumping) {
return true;
} else if (onGround) {
public boolean isPegasusFlying(EntityPlayer player) {
if (this.metadata.getRace() == null || !this.metadata.getRace().hasWings()) {
return false;
} else {
boolean falling = fallDistance > 0;
boolean levitating = fallDistance == this.previousFallDistance;
boolean standingOnAir;
if (falling && !levitating) {
standingOnAir = this.standingOnAir(posX, posY, posZ, 1.5F, equestria);
} else {
standingOnAir = this.standingOnAir(posX, posY, posZ, 1.0F, equestria);
}
if (!standingOnAir) {
return pegasusFlying = false;
} else if (this.pegasusFlying) {
return true;
} else if (levitating) {
return pegasusFlying = true;
} else {
this.previousFallDistance = fallDistance;
if (fallDistance < 2.0F) {
return false;
}
return pegasusFlying = true;
}
}
}
public boolean standingOnAir(double posX, double posY, double posZ, float range, World equestria) {
boolean foundSolidBlock = false;
int y;
if (this.isSpPlayer) {
y = MathHelper.floor_double(posY - this.defaultYOffset - 0.009999999776482582D);
} else {
y = MathHelper.floor_double(posY - 0.009999999776482582D);
return player.capabilities.isFlying ||!(player.onGround || player.isOnLadder() || player.isInWater());
//@formatter:off
// boolean falling = player.fallDistance > 0;
// boolean levitating = player.fallDistance == this.previousFallDistance;
// boolean standingOnAir;
// if (falling && !levitating) {
// standingOnAir = this.standingOnAir(posX, posY, posZ, 1.5F, equestria);
// } else {
// standingOnAir = this.standingOnAir(posX, posY, posZ, 1.0F, equestria);
// }
//
// if (!standingOnAir) {
// return pegasusFlying = false;
// } else if (this.pegasusFlying) {
// return true;
// } else if (levitating) {
// return pegasusFlying = true;
// } else {
// this.previousFallDistance = fallDistance;
// if (fallDistance < 2.0F) {
// return false;
// }
// return pegasusFlying = true;
// }
}
for (float shiftX = 0.0F - range; shiftX < range * 2.0F; shiftX += range) {
for (float shiftZ = 0.0F - range; shiftZ < range * 2.0F; shiftZ += range) {
int x = MathHelper.floor_double(posX + shiftX);
int z = MathHelper.floor_double(posZ + shiftZ);
if (!equestria.isAirBlock(new BlockPos(x, y, z))) {
foundSolidBlock = true;
}
}
}
return !foundSolidBlock;
}
// public boolean standingOnAir(BlockPos pos, float range, World equestria) {
// boolean foundSolidBlock = false;
// int y;
// if (this.isSpPlayer) {
// y = MathHelper.floor_double(posY - this.defaultYOffset - 0.009999999776482582D);
// } else {
// y = MathHelper.floor_double(posY - 0.009999999776482582D);
// }
//
// for (float shiftX = 0.0F - range; shiftX < range * 2.0F; shiftX += range) {
// for (float shiftZ = 0.0F - range; shiftZ < range * 2.0F; shiftZ += range) {
// int x = MathHelper.floor_double(posX + shiftX);
// int z = MathHelper.floor_double(posZ + shiftZ);
// if (!equestria.isAirBlock(new BlockPos(x, y, z))) {
// foundSolidBlock = true;
// }
// }
// }
//
// return !foundSolidBlock;
// }
// @formatter:on
public PlayerModel getModel() {
return getModel(false);
@ -368,7 +166,7 @@ public class Pony {
is_a_pony = false;
break;
case BOTH:
is_a_pony = isPonySkin;
is_a_pony = metadata.getRace() != null;
break;
case PONIES:
is_a_pony = true;
@ -387,17 +185,4 @@ public class Pony {
return this.textureResourceLocation;
}
public void setVillager(int profession) {
this.isVillager = true;
this.villagerProfession = profession;
}
public static enum PonyRace {
EARTH,
PEGASUS,
UNICORN,
ALICORN,
CHANGELING,
ZEBRA;
}
}

View file

@ -0,0 +1,133 @@
package com.brohoof.minelittlepony;
import java.awt.image.BufferedImage;
import java.util.Map;
import com.google.common.collect.ImmutableBiMap;
public class PonyData {
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace> builder()
.put(0xfff9b131, PonyRace.EARTH)
.put(0xffd19fe4, PonyRace.UNICORN)
.put(0xff88caf0, PonyRace.PEGASUS)
.put(0xfffef9fc, PonyRace.ALICORN)
.put(0xffd0cccf, PonyRace.ZEBRA)
.put(0xff282b29, PonyRace.CHANGELING)
.build();
private static final Map<Integer, TailLengths> TAIL_COLORS = ImmutableBiMap.<Integer, TailLengths> builder()
.put(0xff425844, TailLengths.STUB)
.put(0xffd19fe4, TailLengths.QUARTER)
.put(0xff534b76, TailLengths.HALF)
.put(0xff8a6b7f, TailLengths.THREE_QUARTERS).build();
private static final Map<Integer, PonySize> SIZE_COLORS = ImmutableBiMap.<Integer, PonySize> builder()
.put(0xffffbe53, PonySize.FOAL)
.put(0xffce3254, PonySize.LARGE)
.put(0xff534b76, PonySize.PRINCESS)
.build();
private PonyRace race = PonyRace.EARTH;
private TailLengths tailSize = TailLengths.FULL;
private PonyGender gender = PonyGender.MARE;
private PonySize size = PonySize.NORMAL;
private int glowColor = 0x4444aa;
private int textureWidth;
private int textureHeight;
public PonyRace getRace() {
return race;
}
public void setRace(PonyRace race) {
this.race = race;
}
public TailLengths getTail() {
return tailSize;
}
public void setTail(TailLengths tailSize) {
this.tailSize = tailSize;
}
public PonyGender getGender() {
return gender;
}
public void setGender(PonyGender gender) {
this.gender = gender;
}
public PonySize getSize() {
return size;
}
public void setSize(PonySize size) {
this.size = size;
}
public int getGlowColor() {
return glowColor;
}
public void setGlowColor(int glowColor) {
this.glowColor = glowColor;
}
public int getTextureWidth() {
return textureWidth;
}
public int getTextureHeight() {
return textureHeight;
}
public static PonyData parse(BufferedImage image) {
PonyData data = new PonyData();
int race = TriggerPixels.RACE.readColor(image);
data.race = RACE_COLORS.get(race);
int tail = TriggerPixels.TAIL.readColor(image);
if (TAIL_COLORS.containsKey(tail))
data.tailSize = TAIL_COLORS.get(tail);
int gender = TriggerPixels.GENDER.readColor(image);
if (gender == 0xffffff)
data.gender = PonyGender.STALLION;
int size = TriggerPixels.SIZE.readColor(image);
if (SIZE_COLORS.containsKey(size))
data.size = SIZE_COLORS.get(size);
int color = TriggerPixels.GLOW.readColor(image);
if (color != 0x000000)
data.glowColor = color;
data.textureWidth = image.getWidth();
data.textureHeight = image.getHeight();
return data;
}
private enum TriggerPixels {
RACE(0, 0),
TAIL(0, 1),
GENDER(0, 2),
SIZE(0, 3),
GLOW(1, 0);
private int x, y;
private TriggerPixels(int x, int y) {
this.x = x;
this.y = y;
}
private int readColor(BufferedImage image) {
return image.getRGB(x, y);
}
}
}

View file

@ -0,0 +1,6 @@
package com.brohoof.minelittlepony;
public enum PonyGender {
MARE,
STALLION
}

View file

@ -1,44 +1,57 @@
package com.brohoof.minelittlepony;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.util.MineLPLogger;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.util.ResourceLocation;
public class PonyManager {
public static final String RESOURCE_NAMESPACE = "minelittlepony";
public static final ResourceLocation zombiePonyResource = new ResourceLocation("minelittlepony",
"textures/entity/zombie/zombie_pony.png");
public static final ResourceLocation zombieVillagerPonyResource = new ResourceLocation("minelittlepony",
"textures/entity/zombie/zombie_villager_pony.png");
public static final ResourceLocation zombiePigmanPonyResource = new ResourceLocation("minelittlepony",
"textures/entity/zombie_pigman_pony.png");
public static final ResourceLocation skeletonPonyResource = new ResourceLocation("minelittlepony",
"textures/entity/skeleton/skeleton_pony.png");
public static final ResourceLocation skeletonWitherPonyResource = new ResourceLocation("minelittlepony",
"textures/entity/skeleton/skeleton_wither_pony.png");
public static final ResourceLocation defaultPonyResourceLocation = new ResourceLocation("minelittlepony",
"textures/entity/pony/charpony.png");
public static List<ResourceLocation> backgroundPonyResourceLocations = new ArrayList<ResourceLocation>();
public static List<ResourceLocation> villagerResourceLocations;
public static final ResourceLocation ZOMBIE = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pony.png");
public static final ResourceLocation ZOMBIE_VILLAGER = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_villager_pony.png");
public static final ResourceLocation PIGMAN = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png");
public static final ResourceLocation SKELETON = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_pony.png");
public static final ResourceLocation WITHER_SKELETON = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png");
public static final ResourceLocation STEVE = new ResourceLocation("minelittlepony", "textures/entity/steve_pony.png");
public static final ResourceLocation ALEX = new ResourceLocation("minelittlepony", "textures/entity/alex_pony.png");
private static final int MAX_BGPONY_COUNT = 141;
private static int numberOfPonies;
public final List<ResourceLocation> backgroundPonyList = makeBkgndPonies();
public final List<ResourceLocation> villagerList = ImmutableList.<ResourceLocation> builder()
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/farmer_pony.png"))
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/librarian_pony.png"))
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/priest_pony.png"))
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/smith_pony.png"))
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/butcher_pony.png"))
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/villager_pony.png"))
.build();
private static List<ResourceLocation> makeBkgndPonies() {
ImmutableList.Builder<ResourceLocation> list = ImmutableList.builder();
for (int check = 0; check < MAX_BGPONY_COUNT; ++check) {
list.add(new ResourceLocation("minelittlepony", "textures/entity/pony/bpony_" + check + ".png"));
}
return list.build();
}
private PonyConfig config;
private Map<ResourceLocation, Pony> ponyResourceRegistry = new HashMap<ResourceLocation, Pony>();
private Map<ResourceLocation, Pony> backgroudPonyResourceRegistry = new HashMap<ResourceLocation, Pony>();
private Map<ResourceLocation, Pony> ponies = Maps.newHashMap();
private Map<ResourceLocation, Pony> backgroudPonies = Maps.newHashMap();
public PonyManager(PonyConfig config) {
this.config = config;
initmodels();
MineLPLogger.info("Detected %d of %d background ponies installed.", getNumberOfPonies(), MAX_BGPONY_COUNT);
}
public void initmodels() {
@ -49,16 +62,16 @@ public class PonyManager {
private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) {
Pony myLittlePony;
if (!this.ponyResourceRegistry.containsKey(skinResourceLocation)) {
if (!this.ponies.containsKey(skinResourceLocation)) {
if (player != null) {
myLittlePony = new Pony(player);
} else {
myLittlePony = new Pony(skinResourceLocation);
}
this.ponyResourceRegistry.put(skinResourceLocation, myLittlePony);
this.ponies.put(skinResourceLocation, myLittlePony);
} else {
myLittlePony = this.ponyResourceRegistry.get(skinResourceLocation);
myLittlePony = this.ponies.get(skinResourceLocation);
}
return myLittlePony;
@ -70,14 +83,10 @@ public class PonyManager {
public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) {
Pony myLittlePony = this.getPonyFromResourceRegistry(player.getLocationSkin(), player);
if (config.getPonyLevel().get() == PonyLevel.PONIES && !myLittlePony.isPonySkin()) {
if (config.getPonyLevel().get() == PonyLevel.PONIES && myLittlePony.metadata.getRace() == null) {
myLittlePony = this.getPonyFromBackgroundResourceRegistry(player);
}
if (player.getCommandSenderName().equals(MineLittlePony.getSPUsername())) {
myLittlePony.isSpPlayer = true;
}
return myLittlePony;
}
@ -86,81 +95,48 @@ public class PonyManager {
ResourceLocation villagerResourceLocation;
try {
villagerResourceLocation = villagerResourceLocations.get(profession);
villagerResourceLocation = villagerList.get(profession);
} catch (IndexOutOfBoundsException var5) {
villagerResourceLocation = villagerResourceLocations.get(5);
villagerResourceLocation = villagerList.get(5);
}
Pony myLittlePony = this.getPonyFromResourceRegistry(villagerResourceLocation);
myLittlePony.setVillager(profession);
// myLittlePony.setVillager(profession);
return myLittlePony;
}
private ResourceLocation getBackgroundPonyResource(String username) {
if (numberOfPonies > 0) {
int backgroundIndex = username.hashCode() % this.getNumberOfPonies();
private ResourceLocation getBackgroundPonyResource(AbstractClientPlayer player) {
if (getNumberOfPonies() > 0) {
int backgroundIndex = player.getEntityId() % this.getNumberOfPonies();
if (backgroundIndex < 0) {
backgroundIndex += this.getNumberOfPonies();
}
return backgroundPonyResourceLocations.get(backgroundIndex);
return backgroundPonyList.get(backgroundIndex);
}
return defaultPonyResourceLocation;
return STEVE;
}
public Pony getPonyFromBackgroundResourceRegistry(AbstractClientPlayer player) {
ResourceLocation textureResourceLocation;
if (player.getCommandSenderName() == MineLittlePony.getSPUsername()) {
textureResourceLocation = defaultPonyResourceLocation;
if (player.isUser()) {
textureResourceLocation = (player.getUniqueID().hashCode() & 1) == 0 ? STEVE : ALEX;
} else {
textureResourceLocation = this.getBackgroundPonyResource(player.getCommandSenderName());
textureResourceLocation = this.getBackgroundPonyResource(player);
}
Pony myLittlePony;
if (!this.backgroudPonyResourceRegistry.containsKey(textureResourceLocation)) {
if (!this.backgroudPonies.containsKey(textureResourceLocation)) {
myLittlePony = new Pony(textureResourceLocation);
this.backgroudPonyResourceRegistry.put(textureResourceLocation, myLittlePony);
this.backgroudPonies.put(textureResourceLocation, myLittlePony);
} else {
myLittlePony = this.backgroudPonyResourceRegistry.get(textureResourceLocation);
myLittlePony = this.backgroudPonies.get(textureResourceLocation);
}
return myLittlePony;
}
public int getNumberOfPonies() {
return numberOfPonies;
}
static {
for (int check = 0; check < MAX_BGPONY_COUNT; ++check) {
backgroundPonyResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/pony/bpony_" + check + ".png"));
}
numberOfPonies = backgroundPonyResourceLocations.size();
MineLPLogger.info("Detected %d of %d background ponies installed.",
new Object[] { Integer.valueOf(numberOfPonies), Integer.valueOf(MAX_BGPONY_COUNT) });
villagerResourceLocations = new ArrayList<ResourceLocation>();
villagerResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/farmer_pony.png"));
villagerResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/librarian_pony.png"));
villagerResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/priest_pony.png"));
villagerResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/smith_pony.png"));
villagerResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/butcher_pony.png"));
villagerResourceLocations
.add(new ResourceLocation("minelittlepony", "textures/entity/villager/villager_pony.png"));
}
public static enum PonyRace {
EARTH,
PEGASUS,
UNICORN,
ALICORN,
CHANGELING,
ZEBRA;
return backgroundPonyList.size();
}
}

View file

@ -0,0 +1,26 @@
package com.brohoof.minelittlepony;
public enum PonyRace {
EARTH(false, false),
PEGASUS(true, false),
UNICORN(false, true),
ALICORN(true, true),
CHANGELING(true, true),
ZEBRA(false, false);
private boolean wings;
private boolean horn;
private PonyRace(boolean wings, boolean horn) {
this.wings = wings;
this.horn = horn;
}
public boolean hasHorn() {
return horn;
}
public boolean hasWings() {
return wings;
}
}

View file

@ -0,0 +1,8 @@
package com.brohoof.minelittlepony;
public enum PonySize {
NORMAL,
LARGE,
FOAL,
PRINCESS
}

View file

@ -0,0 +1,20 @@
package com.brohoof.minelittlepony;
public enum TailLengths {
STUB(4),
QUARTER(3),
HALF(2),
THREE_QUARTERS(1),
FULL(0);
private int size;
private TailLengths(int size) {
this.size = size;
}
public int getSize() {
return size;
}
}

View file

@ -22,15 +22,8 @@ public class RenderPonyModel extends RenderPlayerModel {
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(this.getEntityTexture(playerModelEntity));
thePony.checkSkin();
PlayerModel pm = thePony.getModel(true);
this.mainModel = pm.model;
pm.model.isFlying = thePony.isFlying = false;
pm.model.isPegasus = thePony.isPegasus();
pm.model.isUnicorn = thePony.isUnicorn();
pm.model.isMale = thePony.isMale();
pm.model.size = thePony.size();
pm.model.glowColor = thePony.glowColor();
pm.model.wantTail = thePony.wantTail();
pm.model.isVillager = false;
this.mainModel = pm.getModel();
pm.apply(thePony.metadata);
this.mainModel.render(par1EntityLivingBase, par2, par3, par4, par5, par6, par7);
}

View file

@ -1,15 +1,12 @@
package com.brohoof.minelittlepony.model;
import com.brohoof.minelittlepony.PonyData;
public abstract class ModelArmor {
public final String path;
public ModelPony base;
public ModelPony modelArmorChestplate;
public ModelPony modelArmor;
public ModelArmor(String path) {
this.path = path;
}
public float layer() {
return 1;
}
@ -18,4 +15,9 @@ public abstract class ModelArmor {
return slot == 2 ? 2 : 1;
}
public void apply(PonyData meta) {
modelArmorChestplate.metadata = meta;
modelArmor.metadata = meta;
}
}

View file

@ -1,5 +1,6 @@
package com.brohoof.minelittlepony.model;
import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.renderer.AniParams;
import net.minecraft.client.entity.AbstractClientPlayer;
@ -11,30 +12,24 @@ import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
public abstract class ModelPony extends ModelPlayer {
public String texture;
protected float strech = 0.0F;
protected float scale = 0.0625F;
public boolean issneak = false;
public boolean isArmour = false;
public int glowColor = -12303190;
public final float pi = 3.141593F;
public boolean isPegasus;
public boolean isUnicorn;
public boolean isMale;
public int wantTail;
public int size;
public boolean isVillager;
public int villagerProfession;
public boolean isFlying;
public boolean isGlow;
public boolean isSleeping;
public PonyData metadata = new PonyData();
public int heldItemLeft;
public int heldItemRight;
public boolean aimedBow;
public ModelPony(String texture) {
public ModelPony() {
super(0, false);
this.texture = texture;
}
public void setStrech(float strech) {
@ -74,25 +69,25 @@ public abstract class ModelPony extends ModelPlayer {
@Override
public final void renderRightArm() {
// Use the human model
PMAPI.human.model.renderModelRightArm();
PMAPI.human.getModel().renderModelRightArm();
}
@Override
public final void renderLeftArm() {
// Use the human model
PMAPI.human.model.renderModelLeftArm();
PMAPI.human.getModel().renderModelLeftArm();
}
@Override
public final void setRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity ent) {
// set the angles for the humans in preparation for arm rendering
// Comes from RenderPlayer.render[Left|Right]Arm?
if (PMAPI.human.model != this
if (PMAPI.human.getModel() != this
&& Thread.currentThread().getStackTrace()[2].getClassName().equals(RenderPlayer.class.getName())) {
PMAPI.human.model.setModelVisibilities((AbstractClientPlayer) ent);
PMAPI.human.model.isSneak = isSneak;
PMAPI.human.model.swingProgress = swingProgress;
PMAPI.human.model.setModelRotationAngles(f1, f2, f3, f4, f5, f6, ent);
PMAPI.human.getModel().setModelVisibilities((AbstractClientPlayer) ent);
PMAPI.human.getModel().isSneak = isSneak;
PMAPI.human.getModel().swingProgress = swingProgress;
PMAPI.human.getModel().setModelRotationAngles(f1, f2, f3, f4, f5, f6, ent);
}
setModelRotationAngles(f1, f2, f3, f4, f5, f6, ent);
}

View file

@ -13,29 +13,19 @@ import com.brohoof.minelittlepony.model.pony.armor.pma_zombiePony;
public final class PMAPI {
public static PlayerModel newPonyAdv_32 = new PlayerModel("newPonyAdv", new pm_newPonyAdv("/mob/char.png"), 0)
public static PlayerModel newPonyAdv_32 = new PlayerModel(new pm_newPonyAdv())
.setTextureHeight(32)
.setArmor(new pma_newPony("minelittlepony:textures/models/armor/"))
.setURL("http://skins.minecraft.net/MinecraftSkins/%NAME%.png")
.setScale(0.9375F);
public static PlayerModel newPonyAdv = new PlayerModel("newPonyAdv", new pm_newPonyAdv("/mob/char.png"), 0)
.setArmor(new pma_newPony("minelittlepony:textures/models/armor/"))
.setURL("http://skins.minecraft.net/MinecraftSkins/%NAME%.png")
.setScale(0.9375F);
public static PlayerModel zombiePony = new PlayerModel("zombiePony", new pm_zombiePony("/mob/char.png"), 0)
.setArmor(new pma_newPony());
public static PlayerModel newPonyAdv = new PlayerModel(new pm_newPonyAdv())
.setArmor(new pma_newPony());
public static PlayerModel zombiePony = new PlayerModel(new pm_zombiePony())
.setTextureHeight(32)
.setArmor(new pma_zombiePony("minelittlepony:textures/models/armor/"))
.setURL("http://skins.minecraft.net/MinecraftSkins/%NAME%.png")
.setScale(0.9375F);
public static PlayerModel skeletonPony = new PlayerModel("skeletonPony", new pm_skeletonPony("/mob/char.png"), 0)
.setArmor(new pma_zombiePony());
public static PlayerModel skeletonPony = new PlayerModel(new pm_skeletonPony())
.setTextureHeight(32)
.setArmor(new pma_skeletonPony("minelittlepony:textures/models/armor/"))
.setURL("http://skins.minecraft.net/MinecraftSkins/%NAME%.png")
.setScale(0.9375F);
public static PlayerModel human = new PlayerModel("Human", new pm_Human("/mob/char.png"), 1)
.setArmor(new pma_Human("minecraft:textures/models/armor/"))
.setURL("http://skins.minecraft.net/MinecraftSkins/%NAME%.png")
.setScale(0.9375F);
.setArmor(new pma_skeletonPony());
public static PlayerModel human = new PlayerModel(new pm_Human())
.setArmor(new pma_Human());
public static void init() {
for (Field field : PMAPI.class.getFields()) {

View file

@ -1,81 +1,52 @@
package com.brohoof.minelittlepony.model;
import java.text.DecimalFormat;
import com.brohoof.minelittlepony.model.ModelArmor;
import com.brohoof.minelittlepony.model.ModelPony;
import com.brohoof.minelittlepony.PonyData;
public class PlayerModel {
public final int id;
public String name;
public String url;
public ModelPony model;
public ModelArmor armor;
public float width = 0.6F;
public float height = 1.8F;
public float shadowsize = 0.5F;
public float thirdpersondistance = 4.0F;
public float yoffset = 1.62F;
public float globalscale = 1.0F;
public PlayerModel(String name, ModelPony model, int manual_id) {
this.name = name;
private final ModelPony model;
private ModelArmor armor;
private float shadowsize = 0.5F;
public PlayerModel(ModelPony model) {
this.model = model;
this.id = manual_id;
}
public PlayerModel setTextureHeight(int height) {
model.textureHeight = height;
getModel().textureHeight = height;
return this;
}
public ModelPony getModel() {
return model;
}
public PlayerModel setArmor(ModelArmor armor) {
this.armor = armor;
return this;
}
public PlayerModel setURL(String url) {
this.url = url;
public PlayerModel setShadowsize(float shadowsize) {
this.shadowsize = shadowsize;
return this;
}
public PlayerModel setShadow(float size) {
this.shadowsize = size;
return this;
}
public PlayerModel setSize(float width, float height) {
this.width = width;
this.height = height;
return this;
}
public PlayerModel setOffset(float offset) {
this.yoffset = offset;
return this;
}
public PlayerModel setDistance(float distance) {
this.thirdpersondistance = distance;
return this;
}
public PlayerModel setScale(float scale) {
this.globalscale = scale;
return this;
}
public boolean hasArmor() {
return this.armor != null && this.armor.base != null && this.armor.path != null;
}
public String getSize(DecimalFormat df) {
return df.format(this.width) + " * " + df.format(this.height) + " * " + df.format(this.width);
public float getShadowsize() {
return shadowsize;
}
public void init() {
model.init(0, 0);
armor.modelArmorChestplate.init(0.0F, 1.0F);
armor.modelArmor.init(0.0F, 0.5F);
getModel().init(0, 0);
getArmor().modelArmorChestplate.init(0.0F, 1.0F);
getArmor().modelArmor.init(0.0F, 0.5F);
}
public ModelArmor getArmor() {
return armor;
}
public void apply(PonyData meta) {
model.metadata = meta;
armor.apply(meta);
}
}

View file

@ -13,8 +13,7 @@ public class pm_newPonyArmor extends pm_newPonyAdv {
public ModelRenderer[] extHead;
public ModelRenderer[] extLegs;
public pm_newPonyArmor(String texture) {
super(texture);
public pm_newPonyArmor() {
this.isArmour = true;
this.textureHeight = 32;
}
@ -24,7 +23,7 @@ public class pm_newPonyArmor extends pm_newPonyAdv {
this.checkRainboom(aniparams.swing);
this.rotateHead(aniparams.horz, aniparams.vert);
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && !this.isUnicorn) {
if (this.swingProgress > -9990.0F && !this.metadata.getRace().hasHorn()) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}

View file

@ -5,9 +5,6 @@ import com.brohoof.minelittlepony.model.pony.armor.pm_newPonyArmor;
import net.minecraft.util.MathHelper;
public class pm_skeletonPonyArmor extends pm_newPonyArmor {
public pm_skeletonPonyArmor(String texture) {
super(texture);
}
@Override
protected void rotateLegs(float move, float swing, float tick) {
@ -17,7 +14,7 @@ public class pm_skeletonPonyArmor extends pm_newPonyArmor {
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.isPegasus) {
if (this.isFlying && this.metadata.getRace().hasWings()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
@ -70,7 +67,7 @@ public class pm_skeletonPonyArmor extends pm_newPonyArmor {
if (this.heldItemRight != 0) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * 3.1415927F);
if (this.glowColor == 0) {
if (this.metadata.getGlowColor() == 0) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
@ -92,7 +89,7 @@ public class pm_skeletonPonyArmor extends pm_newPonyArmor {
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.heldItemRight != 0 && this.glowColor == 0) {
if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) {
this.setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F);
}

View file

@ -5,9 +5,6 @@ import com.brohoof.minelittlepony.model.pony.armor.pm_newPonyArmor;
import net.minecraft.util.MathHelper;
public class pm_zombiePonyArmor extends pm_newPonyArmor {
public pm_zombiePonyArmor(String texture) {
super(texture);
}
@Override
protected void rotateLegs(float move, float swing, float tick) {
@ -17,7 +14,7 @@ public class pm_zombiePonyArmor extends pm_newPonyArmor {
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.isPegasus) {
if (this.isFlying && this.metadata.getRace().hasWings()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;

View file

@ -5,10 +5,9 @@ import com.brohoof.minelittlepony.model.pony.pm_Human;
public class pma_Human extends ModelArmor {
public pma_Human(String path) {
super(path);
this.modelArmorChestplate = new pm_Human(path);
this.modelArmor = new pm_Human(path);
public pma_Human() {
this.modelArmorChestplate = new pm_Human();
this.modelArmor = new pm_Human();
}
}

View file

@ -3,9 +3,9 @@ package com.brohoof.minelittlepony.model.pony.armor;
import com.brohoof.minelittlepony.model.ModelArmor;
public class pma_newPony extends ModelArmor {
public pma_newPony(String path) {
super(path);
this.modelArmorChestplate = new pm_newPonyArmor(path);
this.modelArmor = new pm_newPonyArmor(path);
public pma_newPony() {
this.modelArmorChestplate = new pm_newPonyArmor();
this.modelArmor = new pm_newPonyArmor();
}
}

View file

@ -4,9 +4,8 @@ import com.brohoof.minelittlepony.model.ModelArmor;
public class pma_skeletonPony extends ModelArmor {
public pma_skeletonPony(String path) {
super(path);
this.modelArmorChestplate = new pm_skeletonPonyArmor(path);
this.modelArmor = new pm_skeletonPonyArmor(path);
public pma_skeletonPony() {
this.modelArmorChestplate = new pm_skeletonPonyArmor();
this.modelArmor = new pm_skeletonPonyArmor();
}
}

View file

@ -4,9 +4,8 @@ import com.brohoof.minelittlepony.model.ModelArmor;
public class pma_zombiePony extends ModelArmor {
public pma_zombiePony(String path) {
super(path);
this.modelArmorChestplate = new pm_zombiePonyArmor(path);
this.modelArmor = new pm_zombiePonyArmor(path);
public pma_zombiePony() {
this.modelArmorChestplate = new pm_zombiePonyArmor();
this.modelArmor = new pm_zombiePonyArmor();
}
}

View file

@ -9,10 +9,6 @@ public class pm_Human extends ModelPony {
public ModelRenderer bipedEars;
public ModelRenderer cloak;
public pm_Human(String texture) {
super(texture);
}
@Override
protected boolean doCancelRender() {
return true;

View file

@ -14,6 +14,8 @@ import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.PonyGender;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.ModelPony;
import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.CompressiveRendering;
@ -104,10 +106,6 @@ public class pm_newPonyAdv extends ModelPony {
public CompressiveRendering CompressiveLeftWing;
public CompressiveRendering CompressiveRightWing;
public pm_newPonyAdv(String texture) {
super(texture);
}
@Override
public void init(float yOffset, float stretch) {
this.initTextures();
@ -120,7 +118,7 @@ public class pm_newPonyAdv extends ModelPony {
this.rotateHead(aniparams.horz, aniparams.vert);
this.swingTailZ(aniparams.move, aniparams.swing);
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && (!this.isUnicorn || this.glowColor == 0)) {
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}
@ -155,7 +153,7 @@ public class pm_newPonyAdv extends ModelPony {
}
this.tailstop = 0;
this.tailstop = this.Tail.length - this.wantTail * 5;
this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (this.tailstop <= 1) {
this.tailstop = 0;
}
@ -175,7 +173,7 @@ public class pm_newPonyAdv extends ModelPony {
this.sneakTail();
} else {
this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
if (this.isPegasus) {
if (this.metadata.getRace().hasWings()) {
this.animatePegasusWingsNotSneaking(aniparams.tick);
}
@ -184,7 +182,7 @@ public class pm_newPonyAdv extends ModelPony {
this.swingArms(aniparams.tick);
this.setHead(0.0F, 0.0F, 0.0F);
this.tailstop = 0;
this.tailstop = this.Tail.length - this.wantTail * 5;
this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (this.tailstop <= 1) {
this.tailstop = 0;
}
@ -205,7 +203,7 @@ public class pm_newPonyAdv extends ModelPony {
if (this.rainboom) {
this.tailstop = 0;
this.tailstop = this.Tail.length - this.wantTail * 5;
this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (this.tailstop <= 1) {
this.tailstop = 0;
}
@ -239,7 +237,7 @@ public class pm_newPonyAdv extends ModelPony {
}
protected void checkRainboom(float swing) {
if (this.isPegasus && this.isFlying && swing >= 0.9999F) {
if (this.metadata.getRace().hasWings() && this.isFlying && swing >= 0.9999F) {
this.rainboom = true;
} else {
this.rainboom = false;
@ -260,7 +258,7 @@ public class pm_newPonyAdv extends ModelPony {
this.setRotationPoint(this.hornglow[j6], posX, posY, posZ);
}
if (this.isMale) {
if (this.metadata.getGender() == PonyGender.STALLION) {
for (j6 = 0; j6 < this.MuzzleMale.length; ++j6) {
this.setRotationPoint(this.MuzzleMale[j6], posX, posY, posZ);
}
@ -294,7 +292,7 @@ public class pm_newPonyAdv extends ModelPony {
this.bipedHead.rotateAngleY = headRotateAngleY;
this.bipedHead.rotateAngleX = headRotateAngleX;
int i;
if (this.isMale) {
if (this.metadata.getGender() == PonyGender.STALLION) {
for (i = 0; i < this.MuzzleMale.length; ++i) {
this.MuzzleMale[i].rotateAngleY = headRotateAngleY;
this.MuzzleMale[i].rotateAngleX = headRotateAngleX;
@ -336,7 +334,7 @@ public class pm_newPonyAdv extends ModelPony {
float leftArmRotateAngleX;
float rightLegRotateAngleX;
float leftLegRotateAngleX;
if (this.isFlying && this.isPegasus) {
if (this.isFlying && this.metadata.getRace().hasWings()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
@ -429,7 +427,7 @@ public class pm_newPonyAdv extends ModelPony {
protected void swingTailZ(float move, float swing) {
this.tailstop = 0;
this.tailstop = this.Tail.length - this.wantTail * 5;
this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (this.tailstop <= 1) {
this.tailstop = 0;
}
@ -447,7 +445,7 @@ public class pm_newPonyAdv extends ModelPony {
protected void swingTailX(float tick) {
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
this.tailstop = 0;
this.tailstop = this.Tail.length - this.wantTail * 5;
this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (this.tailstop <= 1) {
this.tailstop = 0;
}
@ -459,7 +457,7 @@ public class pm_newPonyAdv extends ModelPony {
}
protected void holdItem() {
if (this.heldItemRight != 0 && !this.rainboom && (!this.isUnicorn || this.glowColor == 0)) {
if (this.heldItemRight != 0 && !this.rainboom && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) {
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.3141593F;
this.SteveArm.rotateAngleX = this.SteveArm.rotateAngleX * 0.5F - 0.3141593F;
}
@ -474,7 +472,7 @@ public class pm_newPonyAdv extends ModelPony {
float f22 = MathHelper.sin(f16 * 3.1415927F);
float f28 = MathHelper.sin(swingProgress * 3.1415927F);
float f33 = f28 * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
if (this.isUnicorn && this.glowColor != 0 && this.heldItemRight != 0) {
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0 && this.heldItemRight != 0) {
this.unicornarm.rotateAngleX = (float) (this.unicornarm.rotateAngleX
- (f22 * 1.2D + f33));
this.unicornarm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
@ -498,7 +496,7 @@ public class pm_newPonyAdv extends ModelPony {
if (this.heldItemRight != 0 && !this.isSleeping) {
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
if (this.isUnicorn && this.glowColor != 0) {
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0) {
this.unicornarm.rotateAngleZ += cosTickFactor;
this.unicornarm.rotateAngleX += sinTickFactor;
} else {
@ -564,7 +562,7 @@ public class pm_newPonyAdv extends ModelPony {
protected void sneakTail() {
this.tailstop = 0;
this.tailstop = this.Tail.length - this.wantTail * 5;
this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (this.tailstop <= 1) {
this.tailstop = 0;
}
@ -602,7 +600,7 @@ public class pm_newPonyAdv extends ModelPony {
}
protected void aimBow(float tick) {
if (this.isUnicorn && this.glowColor != 0) {
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0) {
this.aimBowUnicorn(tick);
} else {
this.aimBowPony(tick);
@ -749,7 +747,7 @@ public class pm_newPonyAdv extends ModelPony {
rotate(180.0F, 0.0F, 1.0F, 0.0F);
}
if (this.size == 0) {
if (this.metadata.getSize() == PonySize.FOAL) {
if (this.issneak && !this.isFlying && !this.isArmour) {
translate(0.0F, -0.12F, 0.0F);
}
@ -790,7 +788,7 @@ public class pm_newPonyAdv extends ModelPony {
this.renderLegs();
popMatrix();
} else if (this.size == 2) {
} else if (this.metadata.getSize() == PonySize.LARGE) {
if (this.isSleeping && !this.isArmour) {
translate(0.0F, -0.47F, 0.2F);
}
@ -829,7 +827,7 @@ public class pm_newPonyAdv extends ModelPony {
scale(1.15F, 1.12F, 1.15F);
this.renderLegs();
popMatrix();
} else if (this.size == 3) {
} else if (this.metadata.getSize() == PonySize.PRINCESS) {
if (this.isSleeping && !this.isArmour) {
translate(0.0F, -0.43F, 0.25F);
}
@ -886,7 +884,7 @@ public class pm_newPonyAdv extends ModelPony {
this.headpiece[1].render(this.scale);
if (MineLittlePony.getConfig().getSnuzzles().get()) {
int red;
if (this.isMale) {
if (this.metadata.getGender() == PonyGender.STALLION) {
for (red = 0; red < this.MuzzleMale.length; ++red) {
this.MuzzleMale[red].render(this.scale);
}
@ -898,16 +896,16 @@ public class pm_newPonyAdv extends ModelPony {
}
this.bipedHeadwear.render(this.scale);
if (this.isUnicorn) {
if (this.metadata.getRace().hasHorn()) {
this.headpiece[2].render(this.scale);
if (this.heldItemRight != 0 && this.glowColor != 0) {
if (this.heldItemRight != 0 && this.metadata.getGlowColor() != 0) {
GL11.glPushAttrib(24577);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
float var4 = (this.glowColor >> 16 & 255) / 255.0F;
float green = (this.glowColor >> 8 & 255) / 255.0F;
float blue = (this.glowColor & 255) / 255.0F;
float var4 = (this.metadata.getGlowColor() >> 16 & 255) / 255.0F;
float green = (this.metadata.getGlowColor() >> 8 & 255) / 255.0F;
float blue = (this.metadata.getGlowColor() & 255) / 255.0F;
blendFunc(GL11.GL_SRC_ALPHA, 1);
color(var4, green, blue, 0.4F);
this.hornglow[0].render(this.scale);
@ -936,19 +934,22 @@ public class pm_newPonyAdv extends ModelPony {
this.Bodypiece[k1].render(this.scale);
}
if (this.isVillager) {
if (this.villagerProfession < 2) {
for (k1 = 0; k1 < this.VillagerBagPiece.length; ++k1) {
this.VillagerBagPiece[k1].render(this.scale);
}
} else if (this.villagerProfession == 2) {
this.VillagerTrinket.render(this.scale);
} else if (this.villagerProfession > 2) {
this.VillagerApron.render(this.scale);
}
}
// TODO: villager data
//@formatter:off
// if (this.metadata.isVillager()) {
// if (this.metadata.getVillagerProfession() < 2) {
// for (k1 = 0; k1 < this.VillagerBagPiece.length; ++k1) {
// this.VillagerBagPiece[k1].render(this.scale);
// }
// } else if (this.metadata.getVillagerProfession() == 2) {
// this.VillagerTrinket.render(this.scale);
// } else if (this.metadata.getVillagerProfession() > 2) {
// this.VillagerApron.render(this.scale);
// }
// }
//@formatter:on
if (this.isPegasus) {
if (this.metadata.getRace().hasWings()) {
if (!this.isFlying && !this.issneak) {
this.setExtendingWings(true);
@ -975,7 +976,7 @@ public class pm_newPonyAdv extends ModelPony {
}
protected void renderTail() {
int var3 = this.Tail.length - this.wantTail * 5;
int var3 = this.Tail.length - this.metadata.getTail().getSize() * 5;
if (var3 <= 1) {
var3 = 0;
}

View file

@ -1,15 +1,18 @@
package com.brohoof.minelittlepony.model.pony;
import static net.minecraft.client.renderer.GlStateManager.*;
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
import static net.minecraft.client.renderer.GlStateManager.scale;
import static net.minecraft.client.renderer.GlStateManager.translate;
import net.minecraft.util.MathHelper;
public class pm_skeletonPony extends pm_newPonyAdv {
public pm_skeletonPony(String texture) {
super(texture);
public pm_skeletonPony() {
metadata.setGlowColor(0xff6666dd);
}
@Override
protected void rotateLegs(float move, float swing, float tick) {
float rightArmRotateAngleX;
@ -18,7 +21,7 @@ public class pm_skeletonPony extends pm_newPonyAdv {
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.isPegasus) {
if (this.isFlying && this.metadata.getRace().hasWings()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;
@ -71,7 +74,7 @@ public class pm_skeletonPony extends pm_newPonyAdv {
if (this.heldItemRight != 0) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
var9 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * 3.1415927F);
if (this.glowColor == 0) {
if (this.metadata.getGlowColor() == 0) {
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.1F - var8 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
@ -95,7 +98,7 @@ public class pm_skeletonPony extends pm_newPonyAdv {
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.heldItemRight != 0 && this.glowColor == 0) {
if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) {
this.setRotationPoint(this.bipedRightArm, -1.5F, 9.5F, 4.0F);
}
@ -110,7 +113,7 @@ public class pm_skeletonPony extends pm_newPonyAdv {
popMatrix();
pushMatrix();
if (this.heldItemRight != 0 && this.glowColor == 0) {
if (this.heldItemRight != 0 && this.metadata.getGlowColor() == 0) {
translate(-0.1F, 0.3F, 0.1F);
scale(0.5F, 0.5F, 1.2F);
} else {

View file

@ -6,10 +6,6 @@ import net.minecraft.util.MathHelper;
public class pm_zombiePony extends pm_newPonyAdv {
public pm_zombiePony(String texture) {
super(texture);
}
@Override
protected void rotateLegs(float move, float swing, float tick) {
float rightArmRotateAngleX;
@ -18,7 +14,7 @@ public class pm_zombiePony extends pm_newPonyAdv {
float leftLegRotateAngleX;
float var8;
float var9;
if (this.isFlying && this.isPegasus) {
if (this.isFlying && this.metadata.getRace().hasWings()) {
if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270;

View file

@ -4,15 +4,14 @@ import static net.minecraft.client.renderer.GlStateManager.scale;
import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.Pony;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.model.pony.pm_Human;
import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv;
import com.brohoof.minelittlepony.renderer.layer.LayerHeldPonyItem;
import com.brohoof.minelittlepony.renderer.layer.LayerPonyArmor;
import com.brohoof.minelittlepony.renderer.layer.LayerPonyCape;
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkull;
import com.brohoof.minelittlepony.util.MineLPPrivateFields;
import com.mumfrey.liteloader.transformers.AppendInsns;
import com.mumfrey.liteloader.transformers.Obfuscated;
@ -31,6 +30,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
@SuppressWarnings("unused")
private static RenderPlayer __TARGET;
private PlayerModel playerModel;
private Pony thePony;
private RenderPony(RenderManager renderManager) {
super(renderManager, null, 0.5F);
@ -40,8 +40,8 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
@AppendInsns("<init>")
private void init(RenderManager renderManager, boolean useSmallArms) {
this.playerModel = PMAPI.newPonyAdv;
this.mainModel = this.playerModel.model;
this.shadowSize = this.playerModel.shadowsize;
this.mainModel = this.playerModel.getModel();
this.shadowSize = this.playerModel.getShadowsize();
this.layerRenderers.clear();
this.addLayer(new LayerPonyArmor(this));
@ -54,46 +54,42 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
@Obfuscated({ "a", "func_180596_a" })
public void doRender(AbstractClientPlayer player, double x, double y, double z, float yaw, float partialTicks) {
ItemStack currentItemStack = player.inventory.getCurrentItem();
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
thePony.checkSkin();
this.playerModel = this.getModel(player);
this.mainModel = this.playerModel.model;
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = currentItemStack == null
? 0 : 1;
this.mainModel = this.playerModel.getModel();
this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel
.getModel().heldItemRight = currentItemStack == null ? 0 : 1;
this.playerModel.apply(thePony.metadata);
if (currentItemStack != null && player.getItemInUseCount() > 0) {
EnumAction yOrigin = currentItemStack.getItemUseAction();
if (yOrigin == EnumAction.BLOCK) {
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = 3;
this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel
.getModel().heldItemRight = 3;
} else if (yOrigin == EnumAction.BOW) {
this.playerModel.armor.modelArmorChestplate.aimedBow = this.playerModel.armor.modelArmor.aimedBow = this.playerModel.model.aimedBow = true;
this.playerModel.getArmor().modelArmorChestplate.aimedBow = this.playerModel.getArmor().modelArmor.aimedBow = this.playerModel
.getModel().aimedBow = true;
}
}
this.playerModel.armor.modelArmorChestplate.issneak = this.playerModel.armor.modelArmor.issneak = this.playerModel.model.issneak = player.isSneaking();
this.playerModel.armor.modelArmorChestplate.isFlying = this.playerModel.armor.modelArmor.isFlying = this.playerModel.model.isFlying = thePony.isFlying = thePony
.isPegasusFlying(player.posX, player.posY, player.posZ, player.fallDistance,
MineLPPrivateFields.isJumping.get(player).booleanValue(), player.onGround, this.renderManager.worldObj);
this.playerModel.armor.modelArmorChestplate.isPegasus = this.playerModel.armor.modelArmor.isPegasus = this.playerModel.model.isPegasus = thePony
.isPegasus();
if (this.playerModel.model instanceof pm_newPonyAdv) {
((pm_newPonyAdv) this.playerModel.model).setHasWings_Compression(thePony.isPegasus());
}
this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = player
.isSneaking();
this.playerModel
.getArmor().modelArmorChestplate.isFlying = this.playerModel.getArmor().modelArmor.isFlying = this.playerModel.getModel().isFlying = thePony
.isPegasusFlying(player);
// , this.renderManager.worldObj);
this.playerModel.armor.modelArmorChestplate.isUnicorn = this.playerModel.armor.modelArmor.isUnicorn = this.playerModel.model.isUnicorn = thePony.isUnicorn();
this.playerModel.armor.modelArmorChestplate.isMale = this.playerModel.armor.modelArmor.isMale = this.playerModel.model.isMale = thePony.isMale();
this.playerModel.armor.modelArmorChestplate.size = this.playerModel.armor.modelArmor.size = this.playerModel.model.size = thePony.size();
if (MineLittlePony.getConfig().getShowScale().get()) {
if (this.playerModel != PMAPI.human) {
if (thePony.size() == 0) {
PonySize size = thePony.metadata.getSize();
if (size == PonySize.FOAL)
this.shadowSize = 0.25F;
} else if (thePony.size() == 1) {
else if (size == PonySize.NORMAL)
this.shadowSize = 0.4F;
} else if (thePony.size() == 2) {
else if (size == PonySize.PRINCESS)
this.shadowSize = 0.45F;
} else if (thePony.size() == 3) {
else
this.shadowSize = 0.5F;
} else {
this.shadowSize = 0.5F;
}
} else {
this.shadowSize = 0.5F;
}
@ -106,27 +102,32 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
yOrigin1 -= 0.125D;
}
this.playerModel.model.glowColor = thePony.glowColor();
this.playerModel.armor.modelArmorChestplate.isSleeping = this.playerModel.armor.modelArmor.isSleeping = this.playerModel.model.isSleeping = player.isPlayerSleeping();
this.playerModel.armor.modelArmorChestplate.swingProgress = this.playerModel.armor.modelArmor.swingProgress = this.playerModel.model.swingProgress;
this.playerModel.model.wantTail = thePony.wantTail();
this.playerModel.armor.modelArmorChestplate.isVillager = this.playerModel.armor.modelArmor.isVillager = this.playerModel.model.isVillager = false;
this.playerModel.getArmor().modelArmorChestplate.isSleeping = this.playerModel.getArmor().modelArmor.isSleeping = this.playerModel
.getModel().isSleeping = player.isPlayerSleeping();
this.playerModel.getArmor().modelArmorChestplate.swingProgress = this.playerModel.getArmor().modelArmor.swingProgress = this.playerModel
.getModel().swingProgress;
this.playerModel.getArmor().modelArmorChestplate.isVillager = this.playerModel.getArmor().modelArmor.isVillager = this.playerModel
.getModel().isVillager = false;
super.doRender(player, x, yOrigin1, z, yaw, partialTicks);
this.playerModel.armor.modelArmorChestplate.aimedBow = this.playerModel.armor.modelArmor.aimedBow = this.playerModel.model.aimedBow = false;
this.playerModel.armor.modelArmorChestplate.issneak = this.playerModel.armor.modelArmor.issneak = this.playerModel.model.issneak = false;
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = 0;
this.playerModel
.getArmor().modelArmorChestplate.aimedBow = this.playerModel.getArmor().modelArmor.aimedBow = this.playerModel.getModel().aimedBow = false;
this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = false;
this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel
.getModel().heldItemRight = 0;
}
@AppendInsns("renderLivingAt")
@Obfuscated({ "a", "func_77039_a" })
public void setupPlayerScale(AbstractClientPlayer player, double xPosition, double yPosition, double zPosition) {
if (MineLittlePony.getConfig().getShowScale().get() && !(playerModel.model instanceof pm_Human)) {
if (this.playerModel.model.size == 2) {
if (MineLittlePony.getConfig().getShowScale().get() && !(playerModel.getModel() instanceof pm_Human)) {
PonySize size = thePony.metadata.getSize();
if (size == PonySize.LARGE)
scale(0.9F, 0.9F, 0.9F);
} else if (this.playerModel.model.size == 1 || this.playerModel.model.size == 0) {
else if (size == PonySize.NORMAL || size == PonySize.FOAL)
scale(0.8F, 0.8F, 0.8F);
}
}
}

View file

@ -1,6 +1,9 @@
package com.brohoof.minelittlepony.renderer;
import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.PonyGender;
import com.brohoof.minelittlepony.PonyRace;
import com.brohoof.minelittlepony.TailLengths;
import com.brohoof.minelittlepony.model.ModelPony;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv;
@ -23,8 +26,8 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
protected PlayerModel playerModel;
public RenderPonyMob(RenderManager renderManager, PlayerModel playerModel) {
super(renderManager, playerModel.model, playerModel.shadowsize);
this.mobModel = playerModel.model;
super(renderManager, playerModel.getModel(), playerModel.getShadowsize());
this.mobModel = playerModel.getModel();
this.playerModel = playerModel;
this.addLayer(new LayerPonyArmor(this));
@ -37,50 +40,46 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
public void doRender(EntityLiving entity, double xPosition, double yPosition, double zPosition, float yaw,
float partialTicks) {
ItemStack heldItem = entity.getHeldItem();
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = heldItem == null
? 0 : 1;
if (entity.isChild()) {
this.playerModel.armor.modelArmorChestplate.size = this.playerModel.armor.modelArmor.size = this.playerModel.model.size = 0;
} else {
this.playerModel.armor.modelArmorChestplate.size = this.playerModel.armor.modelArmor.size = this.playerModel.model.size = 1;
}
this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel
.getModel().heldItemRight = heldItem == null
? 0 : 1;
this.playerModel.armor.modelArmorChestplate.issneak = this.playerModel.armor.modelArmor.issneak = this.playerModel.model.issneak = false;
this.playerModel.armor.modelArmorChestplate.isFlying = this.playerModel.armor.modelArmor.isFlying = this.playerModel.model.isFlying = false;
this.playerModel.armor.modelArmorChestplate.isPegasus = this.playerModel.armor.modelArmor.isPegasus = this.playerModel.model.isPegasus = false;
if (this.playerModel.model instanceof pm_newPonyAdv) {
((pm_newPonyAdv) this.playerModel.model).setHasWings_Compression(false);
this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = false;
this.playerModel
.getArmor().modelArmorChestplate.isFlying = this.playerModel.getArmor().modelArmor.isFlying = this.playerModel.getModel().isFlying = false;
if (this.playerModel.getModel() instanceof pm_newPonyAdv) {
((pm_newPonyAdv) this.playerModel.getModel()).setHasWings_Compression(false);
}
if (entity instanceof EntitySkeleton) {
this.playerModel.armor.modelArmorChestplate.glowColor = this.playerModel.armor.modelArmor.glowColor = this.playerModel.model.glowColor = 0;
switch (entity.getEntityId() % 3) {
case 0:
this.playerModel.armor.modelArmorChestplate.glowColor = this.playerModel.armor.modelArmor.glowColor = this.playerModel.model.glowColor = -10066211;
case 1:
this.playerModel.armor.modelArmorChestplate.isUnicorn = this.playerModel.armor.modelArmor.isUnicorn = this.playerModel.model.isUnicorn = true;
this.playerModel.getArmor().modelArmor.metadata.setRace(PonyRace.UNICORN);
break;
case 2:
this.playerModel.armor.modelArmorChestplate.isUnicorn = this.playerModel.armor.modelArmor.isUnicorn = this.playerModel.model.isUnicorn = false;
this.playerModel.getArmor().modelArmor.metadata.setRace(PonyRace.EARTH);
}
} else {
this.playerModel.armor.modelArmorChestplate.isUnicorn = this.playerModel.armor.modelArmor.isUnicorn = this.playerModel.model.isUnicorn = false;
this.playerModel.getArmor().modelArmor.metadata.setRace(PonyRace.EARTH);
}
if (entity instanceof EntityPigZombie) {
this.playerModel.armor.modelArmorChestplate.isMale = this.playerModel.armor.modelArmor.isMale = this.playerModel.model.isMale = true;
this.playerModel.getArmor().modelArmor.metadata.setGender(PonyGender.STALLION);
} else {
this.playerModel.armor.modelArmorChestplate.isMale = this.playerModel.armor.modelArmor.isMale = this.playerModel.model.isMale = false;
this.playerModel.getArmor().modelArmor.metadata.setGender(PonyGender.MARE);
}
if (entity instanceof EntitySkeleton) {
this.playerModel.model.wantTail = 4;
this.playerModel.getModel().metadata.setTail(TailLengths.FULL);
} else {
this.playerModel.model.wantTail = 0;
this.playerModel.getModel().metadata.setTail(TailLengths.STUB);
}
this.playerModel.armor.modelArmorChestplate.isSleeping = this.playerModel.armor.modelArmor.isSleeping = this.playerModel.model.isSleeping = false;
this.playerModel.model.isVillager = false;
this.playerModel.getArmor().modelArmorChestplate.isSleeping = this.playerModel.getArmor().modelArmor.isSleeping = this.playerModel
.getModel().isSleeping = false;
if (MineLittlePony.getConfig().getShowScale().get()) {
this.shadowSize = 0.4F;
}
@ -91,9 +90,11 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
}
super.doRender(entity, xPosition, yOrigin, zPosition, yaw, partialTicks);
this.playerModel.armor.modelArmorChestplate.aimedBow = this.playerModel.armor.modelArmor.aimedBow = this.playerModel.model.aimedBow = false;
this.playerModel.armor.modelArmorChestplate.issneak = this.playerModel.armor.modelArmor.issneak = this.playerModel.model.issneak = false;
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = 0;
this.playerModel
.getArmor().modelArmorChestplate.aimedBow = this.playerModel.getArmor().modelArmor.aimedBow = this.playerModel.getModel().aimedBow = false;
this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = false;
this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel
.getModel().heldItemRight = 0;
}
@SuppressWarnings("unchecked")
@ -119,13 +120,14 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
preRenderCallback((T) entitylivingbaseIn, partialTickTime);
}
protected void rotateCorpse(T entity, float xPosition, float yPosition, float zPosition) {}
protected void rotateCorpse(T entity, float xPosition, float yPosition, float zPosition) {
super.rotateCorpse(entity, xPosition, yPosition, zPosition);
}
@SuppressWarnings("unchecked")
@Override
protected void rotateCorpse(EntityLivingBase entity, float xPosition, float yPosition, float zPosition) {
this.rotateCorpse((T) entity, xPosition, yPosition, zPosition);
super.rotateCorpse(entity, xPosition, yPosition, zPosition);
}
@Override

View file

@ -17,8 +17,8 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
addLayer(new LayerBipedArmor(this) {
@Override
protected void initArmor() {
this.field_177189_c = PMAPI.skeletonPony.model;
this.field_177186_d = PMAPI.skeletonPony.model;
this.field_177189_c = PMAPI.skeletonPony.getModel();
this.field_177186_d = PMAPI.skeletonPony.getModel();
}
});
}
@ -37,7 +37,7 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
@Override
protected ResourceLocation getEntityTexture(EntitySkeleton skeleton) {
return skeleton.getSkeletonType() == 1 ? PonyManager.skeletonWitherPonyResource
: PonyManager.skeletonPonyResource;
return skeleton.getSkeletonType() == 1 ? PonyManager.WITHER_SKELETON
: PonyManager.SKELETON;
}
}

View file

@ -19,10 +19,8 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
@Override
protected void preRenderCallback(EntityVillager villager, float partialTicks) {
if (villager.getGrowingAge() < 0) {
this.mobModel.size = 0;
this.shadowSize = 0.25F;
} else {
this.mobModel.size = 1;
if (MineLittlePony.getConfig().getShowScale().get()) {
this.shadowSize = 0.4F;
} else {

View file

@ -23,9 +23,9 @@ public class RenderPonyZombie extends RenderPonyMob<EntityZombie> {
@Override
protected ResourceLocation getEntityTexture(EntityZombie zombie) {
return zombie instanceof EntityPigZombie ? PonyManager.zombiePigmanPonyResource
: (zombie.isVillager() ? PonyManager.zombieVillagerPonyResource
: PonyManager.zombiePonyResource);
return zombie instanceof EntityPigZombie ? PonyManager.PIGMAN
: (zombie.isVillager() ? PonyManager.ZOMBIE_VILLAGER
: PonyManager.ZOMBIE);
}
}

View file

@ -5,6 +5,7 @@ import static net.minecraft.client.renderer.GlStateManager.*;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv;
@ -48,20 +49,20 @@ public class LayerHeldPonyItem implements LayerRenderer {
return;
}
if (!pony.model.isSleeping) {
if (pony.model.isUnicorn && pony.model.glowColor != 0) {
pm_newPonyAdv model = (pm_newPonyAdv) pony.model;
if (pony.model.aimedBow) {
if (!pony.getModel().isSleeping) {
if (pony.getModel().metadata.getRace().hasHorn() && pony.getModel().metadata.getGlowColor() != 0) {
pm_newPonyAdv model = (pm_newPonyAdv) pony.getModel();
if (pony.getModel().aimedBow) {
renderDrop(pony, entity, model.unicornarm, 1.0F, 0.15F, 0.9375F, 0.0625F);
} else if (pony.model.size == 0) {
} else if (pony.getModel().metadata.getSize() == PonySize.FOAL) {
renderDrop(pony, entity, model.unicornarm, 1.0F, 0.35F, 0.5375F, -0.8F);
} else {
renderDrop(pony, entity, model.unicornarm, 1.0F, 0.35F, 0.5375F, -0.45F);
}
} else if (pony.model.size == 0) {
renderDrop(pony, entity, pony.model.bipedRightArm, 1.0F, 0.08F, 0.8375F, 0.0625F);
} else if (pony.getModel().metadata.getSize() == PonySize.FOAL) {
renderDrop(pony, entity, pony.getModel().bipedRightArm, 1.0F, 0.08F, 0.8375F, 0.0625F);
} else {
renderDrop(pony, entity, pony.model.bipedRightArm, 1.0F, -0.0625F, 0.8375F, 0.0625F);
renderDrop(pony, entity, pony.getModel().bipedRightArm, 1.0F, -0.0625F, 0.8375F, 0.0625F);
}
}
}
@ -117,8 +118,8 @@ public class LayerHeldPonyItem implements LayerRenderer {
color(var19, g, b, 1.0F);
Minecraft.getMinecraft().getItemRenderer().renderItem(entity, drop, TransformType.THIRD_PERSON);
if (pony.model.isUnicorn && pony.model.glowColor != 0) {
this.renderItemGlow(entity, drop, pony.model.glowColor);
if (pony.getModel().metadata.getRace().hasHorn() && pony.getModel().metadata.getGlowColor() != 0) {
this.renderItemGlow(entity, drop, pony.getModel().metadata.getGlowColor());
}
popMatrix();

View file

@ -46,7 +46,7 @@ public class LayerPonyArmor implements LayerRenderer {
public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_, float ticks,
float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
pony = ((IRenderPony) renderer).getPony();
if (pony.model instanceof pm_Human) {
if (pony.getModel() instanceof pm_Human) {
humanArmor.doRenderLayer(entity, p_177141_2_, p_177141_3_, ticks, p_177141_5_, p_177141_6_, p_177141_7_,
scale);
} else {
@ -64,7 +64,7 @@ public class LayerPonyArmor implements LayerRenderer {
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
boolean isLegs = armorSlot == 3;
ModelPony modelbase = isLegs ? pony.armor.modelArmorChestplate : pony.armor.modelArmor;
ModelPony modelbase = isLegs ? pony.getArmor().modelArmorChestplate : pony.getArmor().modelArmor;
modelbase.setModelAttributes(this.renderer.getMainModel());
modelbase.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks);
modelbase = getArmorModel(entitylivingbaseIn, itemstack, armorSlot, modelbase);

View file

@ -2,6 +2,7 @@ package com.brohoof.minelittlepony.renderer.layer;
import static net.minecraft.client.renderer.GlStateManager.*;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.renderer.IRenderPony;
@ -41,24 +42,24 @@ public class LayerPonyCape implements LayerRenderer {
pushMatrix();
translate(0.0F, 0.24F, 0.0F);
if (model.model.size == 0) {
if (model.getModel().metadata.getSize() == PonySize.FOAL) {
translate(0.0F, 0.67F, -0.04F);
scale(0.6F, 0.6F, 0.6F);
} else if (model.model.size == 2) {
} else if (model.getModel().metadata.getSize() == PonySize.LARGE) {
translate(0.0F, -0.14F, -0.1F);
scale(1.15F, 1.2F, 1.2F);
if (model.model.issneak && !model.model.isFlying) {
if (model.getModel().issneak && !model.getModel().isFlying) {
translate(0.0F, 0.03F, 0.0F);
}
} else if (model.model.size == 3) {
} else if (model.getModel().metadata.getSize() == PonySize.PRINCESS) {
translate(0.0F, -0.09F, 0.0F);
scale(1.0F, 1.0F, 1.0F);
if (model.model.issneak && !model.model.isFlying) {
if (model.getModel().issneak && !model.getModel().isFlying) {
translate(0.0F, 0.03F, 0.0F);
}
}
if (model.model.issneak && !model.model.isFlying) {
if (model.getModel().issneak && !model.getModel().isFlying) {
translate(0.0F, 0.4F, -0.12F);
}
double d = clientPlayer.prevChasingPosX + (clientPlayer.chasingPosX - clientPlayer.prevChasingPosX) * scale
@ -100,7 +101,7 @@ public class LayerPonyCape implements LayerRenderer {
rotate(180.0F, 0.0F, 0.0F, 1.0F);
rotate(90.0F, 1.0F, 0.0F, 0.0F);
this.renderer.bindTexture(clientPlayer.getLocationCape());
model.model.renderCape(0.0625F);
model.getModel().renderCape(0.0625F);
popMatrix();
}
}

View file

@ -2,6 +2,7 @@ package com.brohoof.minelittlepony.renderer.layer;
import static net.minecraft.client.renderer.GlStateManager.*;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.ModelPony;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv;
@ -38,7 +39,7 @@ public class LayerPonySkull implements LayerRenderer {
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
ItemStack itemstack = entity.getCurrentArmor(3);
if (itemstack != null && itemstack.getItem() != null) {
ModelPony model = getModel().model;
ModelPony model = getModel().getModel();
Item item = itemstack.getItem();
pushMatrix();
@ -48,7 +49,7 @@ public class LayerPonySkull implements LayerRenderer {
scale(0.7, 0.7, 0.7);
}
if (model instanceof pm_newPonyAdv) {
if (model.size == 0) {
if (model.metadata.getSize() == PonySize.FOAL) {
translate(0.0F, 0.76F, 0.0F);
scale(0.9, 0.9, 0.9);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB