mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Fix meta detection
This commit is contained in:
parent
b04468266c
commit
c8bdab408c
4 changed files with 32 additions and 87 deletions
|
@ -101,56 +101,8 @@ public class Pony {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return player.capabilities.isFlying || !(player.onGround || player.isOnLadder() || player.isInWater());
|
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() {
|
public PlayerModel getModel() {
|
||||||
return getModel(false);
|
return getModel(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,22 @@ import com.google.common.collect.ImmutableBiMap;
|
||||||
public class PonyData {
|
public class PonyData {
|
||||||
|
|
||||||
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace> builder()
|
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace> builder()
|
||||||
.put(0xfff9b131, PonyRace.EARTH)
|
.put(0xf9b131, PonyRace.EARTH)
|
||||||
.put(0xffd19fe4, PonyRace.UNICORN)
|
.put(0xd19fe4, PonyRace.UNICORN)
|
||||||
.put(0xff88caf0, PonyRace.PEGASUS)
|
.put(0x88caf0, PonyRace.PEGASUS)
|
||||||
.put(0xfffef9fc, PonyRace.ALICORN)
|
.put(0xfef9fc, PonyRace.ALICORN)
|
||||||
.put(0xffd0cccf, PonyRace.ZEBRA)
|
.put(0xd0cccf, PonyRace.ZEBRA)
|
||||||
.put(0xff282b29, PonyRace.CHANGELING)
|
.put(0x282b29, PonyRace.CHANGELING)
|
||||||
.build();
|
.build();
|
||||||
private static final Map<Integer, TailLengths> TAIL_COLORS = ImmutableBiMap.<Integer, TailLengths> builder()
|
private static final Map<Integer, TailLengths> TAIL_COLORS = ImmutableBiMap.<Integer, TailLengths> builder()
|
||||||
.put(0xff425844, TailLengths.STUB)
|
.put(0x425844, TailLengths.STUB)
|
||||||
.put(0xffd19fe4, TailLengths.QUARTER)
|
.put(0xd19fe4, TailLengths.QUARTER)
|
||||||
.put(0xff534b76, TailLengths.HALF)
|
.put(0x534b76, TailLengths.HALF)
|
||||||
.put(0xff8a6b7f, TailLengths.THREE_QUARTERS).build();
|
.put(0x8a6b7f, TailLengths.THREE_QUARTERS).build();
|
||||||
private static final Map<Integer, PonySize> SIZE_COLORS = ImmutableBiMap.<Integer, PonySize> builder()
|
private static final Map<Integer, PonySize> SIZE_COLORS = ImmutableBiMap.<Integer, PonySize> builder()
|
||||||
.put(0xffffbe53, PonySize.FOAL)
|
.put(0xffbe53, PonySize.FOAL)
|
||||||
.put(0xffce3254, PonySize.LARGE)
|
.put(0xce3254, PonySize.LARGE)
|
||||||
.put(0xff534b76, PonySize.PRINCESS)
|
.put(0x534b76, PonySize.PRINCESS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private PonyRace race = PonyRace.EARTH;
|
private PonyRace race = PonyRace.EARTH;
|
||||||
|
@ -114,10 +114,10 @@ public class PonyData {
|
||||||
|
|
||||||
private enum TriggerPixels {
|
private enum TriggerPixels {
|
||||||
RACE(0, 0),
|
RACE(0, 0),
|
||||||
TAIL(0, 1),
|
TAIL(1, 0),
|
||||||
GENDER(0, 2),
|
GENDER(2, 0),
|
||||||
SIZE(0, 3),
|
SIZE(3, 0),
|
||||||
GLOW(1, 0);
|
GLOW(0, 1);
|
||||||
|
|
||||||
private int x, y;
|
private int x, y;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public class PonyData {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int readColor(BufferedImage image) {
|
private int readColor(BufferedImage image) {
|
||||||
return image.getRGB(x, y);
|
return image.getRGB(x, y) & 0xffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class PonyManager {
|
||||||
|
|
||||||
private ResourceLocation getBackgroundPonyResource(AbstractClientPlayer player) {
|
private ResourceLocation getBackgroundPonyResource(AbstractClientPlayer player) {
|
||||||
if (getNumberOfPonies() > 0) {
|
if (getNumberOfPonies() > 0) {
|
||||||
int backgroundIndex = player.getEntityId() % this.getNumberOfPonies();
|
int backgroundIndex = player.getUniqueID().hashCode() % this.getNumberOfPonies();
|
||||||
if (backgroundIndex < 0) {
|
if (backgroundIndex < 0) {
|
||||||
backgroundIndex += this.getNumberOfPonies();
|
backgroundIndex += this.getNumberOfPonies();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,7 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class LayerPonyArmor implements LayerRenderer {
|
public class LayerPonyArmor implements LayerRenderer {
|
||||||
|
|
||||||
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation(
|
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||||
"textures/misc/enchanted_item_glint.png");
|
|
||||||
|
|
||||||
private static final Map<String, ResourceLocation> HUMAN_ARMORS = Maps.newHashMap();
|
private static final Map<String, ResourceLocation> HUMAN_ARMORS = Maps.newHashMap();
|
||||||
private static final Map<ResourceLocation, ResourceLocation> PONY_ARMORS = Maps.newHashMap();
|
private static final Map<ResourceLocation, ResourceLocation> PONY_ARMORS = Maps.newHashMap();
|
||||||
|
@ -43,12 +42,11 @@ public class LayerPonyArmor implements LayerRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_, float ticks,
|
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_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
float p_177141_7_, float scale) {
|
||||||
pony = ((IRenderPony) renderer).getPony();
|
pony = ((IRenderPony) renderer).getPony();
|
||||||
if (pony.getModel() 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_,
|
humanArmor.doRenderLayer(entity, p_177141_2_, p_177141_3_, ticks, p_177141_5_, p_177141_6_, p_177141_7_, scale);
|
||||||
scale);
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 4; i > 0; i--) {
|
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);
|
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_,
|
private void renderArmor(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_,
|
||||||
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale, int armorSlot) {
|
float p_177141_6_, float p_177141_7_, float scale, int armorSlot) {
|
||||||
ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(armorSlot - 1);
|
ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(armorSlot - 1);
|
||||||
|
|
||||||
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
|
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
|
||||||
|
@ -77,17 +75,14 @@ public class LayerPonyArmor implements LayerRenderer {
|
||||||
float f8 = (j >> 8 & 255) / 255.0F;
|
float f8 = (j >> 8 & 255) / 255.0F;
|
||||||
float f9 = (j & 255) / 255.0F;
|
float f9 = (j & 255) / 255.0F;
|
||||||
GlStateManager.color(f7, f8, f9, 1);
|
GlStateManager.color(f7, f8, f9, 1);
|
||||||
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_,
|
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
|
||||||
scale);
|
|
||||||
this.renderer.bindTexture(getArmorTexture(entitylivingbaseIn, itemstack, isLegs ? 2 : 1, "overlay"));
|
this.renderer.bindTexture(getArmorTexture(entitylivingbaseIn, itemstack, isLegs ? 2 : 1, "overlay"));
|
||||||
}
|
}
|
||||||
GlStateManager.color(1, 1, 1, 1);
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_,
|
modelbase.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
|
||||||
scale);
|
|
||||||
|
|
||||||
if (itemstack.isItemEnchanted()) {
|
if (itemstack.isItemEnchanted()) {
|
||||||
this.renderEnchantment(entitylivingbaseIn, modelbase, p_177141_2_, p_177141_3_, partialTicks,
|
this.renderEnchantment(entitylivingbaseIn, modelbase, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale);
|
||||||
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_,
|
private void renderEnchantment(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_,
|
||||||
float p_177183_4_, float p_177183_5_, float p_177183_6_, float p_177183_7_, float p_177183_8_,
|
float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) {
|
||||||
float p_177183_9_) {
|
|
||||||
float f7 = entitylivingbaseIn.ticksExisted + p_177183_5_;
|
float f7 = entitylivingbaseIn.ticksExisted + p_177183_5_;
|
||||||
this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
||||||
GlStateManager.enableBlend();
|
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.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.translate(0.0F, f7 * (0.001F + i * 0.003F) * 20.0F, 0.0F);
|
||||||
GlStateManager.matrixMode(5888);
|
GlStateManager.matrixMode(5888);
|
||||||
modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_,
|
modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, p_177183_9_);
|
||||||
p_177183_9_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.matrixMode(5890);
|
GlStateManager.matrixMode(5890);
|
||||||
|
|
Loading…
Reference in a new issue