Fix meta detection

This commit is contained in:
Matthew Messinger 2015-12-11 23:17:04 -05:00
parent b04468266c
commit c8bdab408c
4 changed files with 32 additions and 87 deletions

View file

@ -101,55 +101,7 @@ public class Pony {
return false;
}
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;
// }
}
// 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);

View file

@ -8,22 +8,22 @@ 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)
.put(0xf9b131, PonyRace.EARTH)
.put(0xd19fe4, PonyRace.UNICORN)
.put(0x88caf0, PonyRace.PEGASUS)
.put(0xfef9fc, PonyRace.ALICORN)
.put(0xd0cccf, PonyRace.ZEBRA)
.put(0x282b29, 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();
.put(0x425844, TailLengths.STUB)
.put(0xd19fe4, TailLengths.QUARTER)
.put(0x534b76, TailLengths.HALF)
.put(0x8a6b7f, 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)
.put(0xffbe53, PonySize.FOAL)
.put(0xce3254, PonySize.LARGE)
.put(0x534b76, PonySize.PRINCESS)
.build();
private PonyRace race = PonyRace.EARTH;
@ -114,10 +114,10 @@ public class PonyData {
private enum TriggerPixels {
RACE(0, 0),
TAIL(0, 1),
GENDER(0, 2),
SIZE(0, 3),
GLOW(1, 0);
TAIL(1, 0),
GENDER(2, 0),
SIZE(3, 0),
GLOW(0, 1);
private int x, y;
@ -127,7 +127,7 @@ public class PonyData {
}
private int readColor(BufferedImage image) {
return image.getRGB(x, y);
return image.getRGB(x, y) & 0xffffff;
}
}
}

View file

@ -107,7 +107,7 @@ public class PonyManager {
private ResourceLocation getBackgroundPonyResource(AbstractClientPlayer player) {
if (getNumberOfPonies() > 0) {
int backgroundIndex = player.getEntityId() % this.getNumberOfPonies();
int backgroundIndex = player.getUniqueID().hashCode() % this.getNumberOfPonies();
if (backgroundIndex < 0) {
backgroundIndex += this.getNumberOfPonies();
}

View file

@ -27,8 +27,7 @@ import net.minecraft.util.ResourceLocation;
public class LayerPonyArmor implements LayerRenderer {
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation(
"textures/misc/enchanted_item_glint.png");
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("textures/misc/enchanted_item_glint.png");
private static final Map<String, ResourceLocation> HUMAN_ARMORS = Maps.newHashMap();
private static final Map<ResourceLocation, ResourceLocation> PONY_ARMORS = Maps.newHashMap();
@ -43,12 +42,11 @@ public class LayerPonyArmor implements LayerRenderer {
}
@Override
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) {
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.getModel() instanceof pm_Human) {
humanArmor.doRenderLayer(entity, p_177141_2_, p_177141_3_, ticks, p_177141_5_, p_177141_6_, p_177141_7_,
scale);
humanArmor.doRenderLayer(entity, p_177141_2_, p_177141_3_, ticks, p_177141_5_, p_177141_6_, p_177141_7_, scale);
} else {
for (int i = 4; i > 0; i--) {
renderArmor(entity, p_177141_2_, p_177141_3_, ticks, p_177141_5_, p_177141_6_, p_177141_7_, scale, i);
@ -56,8 +54,8 @@ public class LayerPonyArmor implements LayerRenderer {
}
}
private void renderArmor(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale, int armorSlot) {
private void renderArmor(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_,
float p_177141_6_, float p_177141_7_, float scale, int armorSlot) {
ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(armorSlot - 1);
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
@ -77,17 +75,14 @@ public class LayerPonyArmor implements LayerRenderer {
float f8 = (j >> 8 & 255) / 255.0F;
float f9 = (j & 255) / 255.0F;
GlStateManager.color(f7, f8, f9, 1);
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_,
scale);
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
this.renderer.bindTexture(getArmorTexture(entitylivingbaseIn, itemstack, isLegs ? 2 : 1, "overlay"));
}
GlStateManager.color(1, 1, 1, 1);
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_,
scale);
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
if (itemstack.isItemEnchanted()) {
this.renderEnchantment(entitylivingbaseIn, modelbase, p_177141_2_, p_177141_3_, partialTicks,
p_177141_5_, p_177141_6_, p_177141_7_, scale);
this.renderEnchantment(entitylivingbaseIn, modelbase, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale);
}
}
}
@ -156,9 +151,8 @@ public class LayerPonyArmor implements LayerRenderer {
}
}
private void renderEnchantment(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_,
float p_177183_4_, float p_177183_5_, float p_177183_6_, float p_177183_7_, float p_177183_8_,
float p_177183_9_) {
private void renderEnchantment(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_,
float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) {
float f7 = entitylivingbaseIn.ticksExisted + p_177183_5_;
this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES);
GlStateManager.enableBlend();
@ -179,8 +173,7 @@ public class LayerPonyArmor implements LayerRenderer {
GlStateManager.rotate(30.0F - i * 60.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, f7 * (0.001F + i * 0.003F) * 20.0F, 0.0F);
GlStateManager.matrixMode(5888);
modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_,
p_177183_9_);
modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, p_177183_9_);
}
GlStateManager.matrixMode(5890);