Finish up metadata overrides.

+ Bug fixes
This commit is contained in:
Matthew Messinger 2016-05-20 16:22:07 -04:00
parent d1662e8dc4
commit f9ebdd8867
17 changed files with 269 additions and 69 deletions

View file

@ -0,0 +1,8 @@
package com.voxelmodpack.hdskins;
import com.google.common.base.Optional;
public interface IMetaHandler {
Optional<String> get(String key);
}

View file

@ -9,6 +9,7 @@ import javax.imageio.ImageIO;
import com.google.common.collect.Iterables;
import com.mojang.authlib.GameProfile;
import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.IMetaHandler;
import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
import com.voxelmodpack.hdskins.PreviewTexture;
@ -34,6 +35,7 @@ public class EntityPlayerModel extends EntityLivingBase {
public boolean isSwinging = false;
protected boolean remoteSkin = false;
protected boolean hasLocalTexture = false;
public IMetaHandler metaHandler;
public EntityPlayerModel(GameProfile profile) {
super((World) null);
@ -132,6 +134,11 @@ public class EntityPlayerModel extends EntityLivingBase {
this.swingProgress = this.swingProgressInt / 8.0F;
}
public void updateMeta(IMetaHandler guiMetaHandler) {
this.metaHandler = guiMetaHandler;
}
@Override
public EnumHandSide getPrimaryHand() {
return Minecraft.getMinecraft().gameSettings.mainHand;

View file

@ -1,5 +1,7 @@
package com.voxelmodpack.hdskins.gui;
import static net.minecraft.client.renderer.GlStateManager.*;
import java.awt.Color;
import java.io.IOException;
import java.util.List;
@ -22,24 +24,32 @@ import com.mumfrey.liteloader.client.gui.GuiCheckbox;
import com.mumfrey.webprefs.WebPreferencesManager;
import com.mumfrey.webprefs.interfaces.IWebPreferences;
import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.IMetaHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSlider;
import net.minecraft.client.gui.GuiSlider.FormatHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
public class MetaHandler extends GuiScreen {
public class GuiMetaHandler extends GuiScreen implements IMetaHandler {
private GuiScreen parent;
private List<Opt<?>> options = Lists.newArrayList();
protected int optionHeight = 5;
protected int optionPosX;
public MetaHandler(GuiScreen parent) {
private EntityPlayerModel model;
public GuiMetaHandler(GuiScreen parent, EntityPlayerModel localPlayer) {
this.parent = parent;
model = localPlayer;
}
public <E extends Enum<E>> void selection(String name, Class<E> options) {
@ -58,19 +68,36 @@ public class MetaHandler extends GuiScreen {
this.options.add(new Col(name));
}
@Override
public Optional<String> get(String key) {
for (Opt<?> opt : options) {
if (opt.name.equals(key)) {
if (opt.isEnabled()) {
return Optional.fromNullable(opt.toString());
}
}
}
return Optional.absent();
}
@Override
public void initGui() {
super.initGui();
optionHeight = 30;
optionPosX = this.width / 8;
this.buttonList.add(new GuiButton(0, width / 2 - 100, height - 40, 80, 20, "Cancel"));
this.buttonList.add(new GuiButton(1, width / 2 + 20, height - 40, 80, 20, "Apply"));
this.buttonList.add(new GuiButton(0, width / 2 - 100, height - 30, 80, 20, "Cancel"));
this.buttonList.add(new GuiButton(1, width / 2 + 20, height - 30, 80, 20, "Apply"));
for (Opt<?> opt : options) {
opt.init();
}
fetch();
}
@Override
public void onGuiClosed() {
this.model.updateMeta(null);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
switch (button.id) {
@ -90,18 +117,66 @@ public class MetaHandler extends GuiScreen {
}
}
private float updateCounter;
@Override
public void drawScreen(int mouseX, int mouseY, float ticks) {
public void drawScreen(int mouseX, int mouseY, float partialTick) {
// this.lastPartialTick = this.updateCounter + partialTick;
this.drawDefaultBackground();
super.drawScreen(mouseX, mouseY, ticks);
int top = 30;
int bottom = height - 40;
int mid = width / 2;
Gui.drawRect(mid + 10, top, width - 10, bottom, Integer.MIN_VALUE);
((GuiSkins) parent).enableClipping(30, height - 40);
enableBlend();
enableDepth();
mc.getTextureManager().bindTexture(EntityPlayerModel.NOSKIN);
renderPlayerModel(this.model, width * 0.75F, height * .75F, height * 0.25F, mouseX, mouseY, partialTick);
disableDepth();
disableBlend();
((GuiSkins) parent).disableClipping();
super.drawScreen(mouseX, mouseY, partialTick);
for (Opt<?> opt : options) {
opt.drawOption(mouseX, mouseY);
}
this.drawCenteredString(this.fontRendererObj, "Skin Overrides", width / 2, 10, -1);
}
public void renderPlayerModel(Entity thePlayer, float xPosition, float yPosition, float scale, float mouseX, float mouseY, float partialTick) {
enableColorMaterial();
pushMatrix();
translate(xPosition, yPosition, 300.0F);
scale(-scale, scale, scale);
rotate(180.0F, 0.0F, 0.0F, 1.0F);
rotate(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
rotate(-135.0F, 0.0F, 1.0F, 0.0F);
rotate(15.0F, 1.0F, 0.0F, 0.0F);
rotate((updateCounter + partialTick) * 2.5F, 0.0F, 1.0F, 0.0F);
thePlayer.rotationPitch = -((float) Math.atan(mouseY / 40.0F)) * 20.0F;
translate(0.0D, thePlayer.getYOffset(), 0.0D);
RenderManager rm = Minecraft.getMinecraft().getRenderManager();
rm.playerViewY = 180.0F;
rm.renderEntityStatic(thePlayer, 0, false);
popMatrix();
RenderHelper.disableStandardItemLighting();
disableColorMaterial();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
super.mouseClicked(mouseX, mouseY, button);
if (mouseX > width / 2)
this.model.swingArm();
for (Opt<?> opt : options) {
if (opt.mouseClicked(mouseX, mouseY))
break;
@ -109,6 +184,14 @@ public class MetaHandler extends GuiScreen {
}
}
@Override
public void updateScreen() {
this.model.updateMeta(this);
this.model.updateModel();
this.updateCounter++;
}
@Override
public void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
@ -146,8 +229,8 @@ public class MetaHandler extends GuiScreen {
for (Entry<String, String> e : data.entrySet()) {
for (Opt<?> opt : options) {
if (opt.name.equals(e.getKey())) {
opt.setEnabled(true);
opt.fromString(e.getValue());
opt.setEnabled(opt.value.isPresent());
break;
}
}
@ -258,6 +341,7 @@ public class MetaHandler extends GuiScreen {
super(name);
this.min = min;
this.max = max;
this.value = Optional.of(min);
}
@Override
@ -325,6 +409,7 @@ public class MetaHandler extends GuiScreen {
super(name);
this.type = enumType;
this.options = ImmutableList.copyOf(enumType.getEnumConstants());
this.value = Optional.of(this.get());
}
@Override
@ -391,6 +476,7 @@ public class MetaHandler extends GuiScreen {
public Col(String name) {
super(name);
value = Optional.of(Color.WHITE);
}
@Override

View file

@ -100,7 +100,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
private float lastPartialTick;
private JFrame fileDrop;
private MetaHandler metadata;
private GuiMetaHandler metadata;
// translations
private final String manager = I18n.format("hdskins.manager");
@ -132,9 +132,8 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.reloadRemoteSkin();
this.fetchingSkin = true;
this.panoramaRenderer = LiteModHDSkinsMod.getPanoramaRenderer(this);
this.metadata = new MetaHandler(this);
this.metadata = new GuiMetaHandler(this, this.remotePlayer);
this.setupMetaOverrides(this.metadata);
this.metadata.fetch();
}
protected EntityPlayerModel getModel(GameProfile profile) {
@ -230,7 +229,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.btnBrowse.enabled = !this.mc.isFullScreen();
}
protected void setupMetaOverrides(MetaHandler meta) {
protected void setupMetaOverrides(GuiMetaHandler meta) {
meta.bool("slim");
}
@ -574,6 +573,8 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
float xPos2 = this.width * 0.75F;
float scale = this.height * 0.25F;
mc.getTextureManager().bindTexture(EntityPlayerModel.NOSKIN);
this.renderPlayerModel(this.localPlayer, xPos1, yPos, scale, xPos1 - mouseX, yPos - scale * 1.8F - mouseY, partialTick);
this.renderPlayerModel(this.remotePlayer, xPos2, yPos, scale, xPos2 - mouseX, yPos - scale * 1.8F - mouseY, partialTick);

View file

@ -5,6 +5,7 @@ import static net.minecraft.client.renderer.GlStateManager.*;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderManager;
@ -12,8 +13,11 @@ import net.minecraft.util.ResourceLocation;
public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLivingBase<M> {
private static final ModelPlayer FAT = new ModelPlayer(0, false);
private static final ModelPlayer THIN = new ModelPlayer(0, true);
public RenderPlayerModel(RenderManager renderer) {
super(renderer, new ModelPlayer(0, false), 0.0F);
super(renderer, FAT, 0.0F);
}
@Override
@ -39,6 +43,13 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
@Override
public void doRender(M par1Entity, double par2, double par4, double par6, float par8, float par9) {
if (par1Entity.metaHandler != null && par1Entity.metaHandler.get("slim").isPresent()) {
boolean skinny = "true".equals(par1Entity.metaHandler.get("slim").get());
this.mainModel = skinny ? THIN : FAT;
} else {
this.mainModel = FAT;
}
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
super.doRender(par1Entity, par2, par4, par6, par8, par9);
popAttrib();

View file

@ -2,6 +2,7 @@ package com.brohoof.minelittlepony;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Map;
import javax.imageio.ImageIO;
@ -9,6 +10,12 @@ import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.util.MineLPLogger;
import com.brohoof.minelittlepony.util.PonyFields;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mojang.authlib.GameProfile;
import com.mumfrey.webprefs.WebPreferencesManager;
import com.mumfrey.webprefs.interfaces.IWebPreferences;
import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
@ -24,6 +31,7 @@ public class Pony {
private static int ponyCount = 0;
private final int ponyId = ponyCount++;
public GameProfile profile;
public ResourceLocation textureResourceLocation;
public PonyData metadata = new PonyData();
@ -31,16 +39,17 @@ public class Pony {
private boolean skinChecked;
public Pony(AbstractClientPlayer player) {
this.profile = player.getGameProfile();
this.textureResourceLocation = player.getLocationSkin();
MineLPLogger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId,
player.getName(), player.getUniqueID(), this.textureResourceLocation);
this.checkSkin(this.textureResourceLocation);
this.checkMeta(profile);
}
public Pony(ResourceLocation aTextureResourceLocation) {
this.textureResourceLocation = aTextureResourceLocation;
MineLPLogger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId,
this.textureResourceLocation);
MineLPLogger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, this.textureResourceLocation);
this.checkSkin(this.textureResourceLocation);
}
@ -51,6 +60,7 @@ public class Pony {
public void checkSkin() {
if (!this.skinChecked) {
this.checkSkin(this.textureResourceLocation);
this.checkMeta(this.profile);
}
}
@ -61,11 +71,29 @@ public class Pony {
}
}
private void checkMeta(GameProfile profile) {
if (profile == null)
return;
IWebPreferences prefs = WebPreferencesManager.getDefault().getPreferences(profile);
String json = prefs.get(HDSkinManager.METADATA_KEY, "{}");
Map<String, String> data = new Gson().fromJson(json, new TypeToken<Map<String, String>>() {}.getType());
if (data.containsKey("race"))
metadata.setRace(PonyRace.valueOf(data.get("race")));
if (data.containsKey("tail"))
metadata.setTail(TailLengths.valueOf(data.get("tail")));
if (data.containsKey("gender"))
metadata.setGender(PonyGender.valueOf(data.get("gender")));
if (data.containsKey("size"))
metadata.setSize(PonySize.valueOf(data.get("size")));
if (data.containsKey("magic"))
metadata.setGlowColor(Integer.parseInt(data.get("magic")));
}
public BufferedImage getBufferedImage(ResourceLocation textureResourceLocation) {
BufferedImage skinImage = null;
try {
skinImage = ImageIO.read(Minecraft.getMinecraft().getResourceManager()
.getResource(textureResourceLocation).getInputStream());
skinImage = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation).getInputStream());
MineLPLogger.debug("Obtained skin from resource location %s", textureResourceLocation);
// this.checkSkin(skinImage);
} catch (IOException var6) {
@ -128,4 +156,7 @@ public class Pony {
return this.textureResourceLocation;
}
public GameProfile getProfile() {
return profile;
}
}

View file

@ -1,9 +1,11 @@
package com.brohoof.minelittlepony.hdskins.gui;
import com.mojang.authlib.GameProfile;
import com.voxelmodpack.hdskins.IMetaHandler;
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
public class EntityPonyModel extends EntityPlayerModel {
public EntityPonyModel(GameProfile profile) {
super(profile);
}

View file

@ -11,7 +11,7 @@ import com.brohoof.minelittlepony.util.MineLPLogger;
import com.mojang.authlib.GameProfile;
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
import com.voxelmodpack.hdskins.gui.GuiSkins;
import com.voxelmodpack.hdskins.gui.MetaHandler;
import com.voxelmodpack.hdskins.gui.GuiMetaHandler;
public class GuiSkinsMineLP extends GuiSkins {
@ -22,7 +22,7 @@ public class GuiSkinsMineLP extends GuiSkins {
}
@Override
protected void setupMetaOverrides(MetaHandler meta) {
protected void setupMetaOverrides(GuiMetaHandler meta) {
super.setupMetaOverrides(meta);
meta.selection("race", PonyRace.class);
meta.selection("tail", TailLengths.class);

View file

@ -2,7 +2,12 @@ package com.brohoof.minelittlepony.hdskins.gui;
import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.Pony;
import com.brohoof.minelittlepony.PonyGender;
import com.brohoof.minelittlepony.PonyRace;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.TailLengths;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.google.common.base.Optional;
import com.voxelmodpack.hdskins.gui.RenderPlayerModel;
import net.minecraft.client.renderer.entity.RenderManager;
@ -17,7 +22,28 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
protected void renderModel(EntityPonyModel playermodel, float par2, float par3, float par4, float par5, float par6, float par7) {
this.bindEntityTexture(playermodel);
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(this.getEntityTexture(playermodel));
thePony.invalidateSkinCheck();
thePony.checkSkin();
if (playermodel.metaHandler != null) {
Optional<String> race = playermodel.metaHandler.get("race");
Optional<String> tail = playermodel.metaHandler.get("tail");
Optional<String> gender = playermodel.metaHandler.get("gender");
Optional<String> size = playermodel.metaHandler.get("size");
Optional<String> magicColor = playermodel.metaHandler.get("magic");
if (race.isPresent())
thePony.metadata.setRace(PonyRace.valueOf(race.get()));
if (tail.isPresent())
thePony.metadata.setTail(TailLengths.valueOf(tail.get()));
if (gender.isPresent())
thePony.metadata.setGender(PonyGender.valueOf(gender.get()));
if (size.isPresent())
thePony.metadata.setSize(PonySize.valueOf(size.get()));
if (magicColor.isPresent())
thePony.metadata.setGlowColor(Integer.parseInt(magicColor.get()));
}
// TODO small arms
PlayerModel pm = thePony.getModel(true, false);
this.mainModel = pm.getModel();

View file

@ -180,6 +180,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
private void updateModel(AbstractClientPlayer player) {
this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
thePony.invalidateSkinCheck();
thePony.checkSkin();
this.playerModel = this.getModel(player);
this.mainModel = this.playerModel.getModel();

View file

@ -27,7 +27,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
public PlaneRenderer[] Bodypiece;
public PlaneRenderer[] BodypieceNeck;
public ModelRenderer unicornarm;
public ModelRenderer unicornArmRight;
public ModelRenderer unicornArmLeft;
public PlaneRenderer[] Tail;
public ModelPlayerPony(boolean smallArms) {
@ -235,7 +236,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.unicornArmLeft.rotateAngleY = 0.0F;
this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
@ -245,7 +247,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.unicornArmRight.rotateAngleX = 0.0F;
this.unicornArmLeft.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
@ -253,7 +256,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmLeft.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
}
@ -326,7 +330,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
@SuppressWarnings("incomplete-switch")
protected void holdItem() {
if (!this.rainboom && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() != 0)) {
if (!this.rainboom && (!this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0)) {
switch (this.leftArmPose) {
case EMPTY:
@ -369,9 +373,12 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
boolean mainRight = mainSide == EnumHandSide.RIGHT;
ArmPose mainPose = mainRight ? this.rightArmPose : this.leftArmPose;
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0 && mainPose != ArmPose.EMPTY) {
this.unicornarm.rotateAngleX = (float) (this.unicornarm.rotateAngleX - (f22 * 1.2D + f33));
this.unicornarm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.unicornarm.rotateAngleZ = f28 * -0.4F;
ModelRenderer unicornarm = mainSide == EnumHandSide.LEFT ? this.unicornArmLeft : this.unicornArmRight;
unicornarm.rotateAngleX = (float) (this.unicornArmRight.rotateAngleX - (f22 * 1.2D + f33));
unicornarm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
unicornarm.rotateAngleZ = f28 * -0.4F;
} else {
ModelRenderer bipedArm = this.getArmForSide(mainSide);
ModelRenderer steveArm = mainRight ? this.steveRightArm : this.steveLeftArm;
@ -392,8 +399,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0) {
this.unicornarm.rotateAngleZ += cosTickFactor;
this.unicornarm.rotateAngleX += sinTickFactor;
this.unicornArmRight.rotateAngleZ += cosTickFactor;
this.unicornArmRight.rotateAngleX += sinTickFactor;
} else {
this.bipedRightArm.rotateAngleZ += cosTickFactor;
this.bipedRightArm.rotateAngleX += sinTickFactor;
@ -401,6 +408,19 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.steveRightArm.rotateAngleX += sinTickFactor;
}
}
if (this.leftArmPose != ArmPose.EMPTY && !this.isSleeping) {
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0) {
this.unicornArmLeft.rotateAngleZ += cosTickFactor;
this.unicornArmLeft.rotateAngleX += sinTickFactor;
} else {
this.bipedLeftArm.rotateAngleZ += cosTickFactor;
this.bipedLeftArm.rotateAngleX += sinTickFactor;
this.steveLeftArm.rotateAngleZ += cosTickFactor;
this.steveLeftArm.rotateAngleX += sinTickFactor;
}
}
}
@ -433,7 +453,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
protected void sneakLegs() {
this.steveRightArm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornarm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
@ -510,11 +531,11 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
}
protected void aimBowUnicorn(float tick) {
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
this.unicornarm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.unicornarm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornarm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
this.unicornArmRight.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
this.unicornArmRight.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmRight.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
}
protected void fixSpecialRotations() {
@ -664,10 +685,11 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedLeftArmwear = new ModelRenderer(this, 48, 48);
this.bipedLeftLegwear = new ModelRenderer(this, 0, 48);
this.unicornarm = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.unicornArmRight = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.unicornArmLeft = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.boxList.remove(this.steveRightArm);
this.boxList.remove(this.unicornarm);
this.boxList.remove(this.unicornArmRight);
}
protected void initTailTextures() {
@ -801,8 +823,11 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
if (this.bipedLeftLegwear != null) {
this.bipedLeftLegwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
}
this.unicornarm.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornarm.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
this.unicornArmRight.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornArmRight.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
this.unicornArmLeft.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornArmLeft.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
}
protected void initTailPositions(float yOffset, float stretch) {

View file

@ -53,7 +53,7 @@ public class ModelSkeletonPony extends ModelPlayerPony {
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.6F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
@ -61,13 +61,13 @@ public class ModelSkeletonPony extends ModelPlayerPony {
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = rightArmRotateAngleX;
this.unicornArmRight.rotateAngleX = rightArmRotateAngleX;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose != ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
@ -80,15 +80,15 @@ public class ModelSkeletonPony extends ModelPlayerPony {
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.unicornarm.rotationPointX = -7.0F;
this.unicornarm.rotationPointY = 12.0F;
this.unicornarm.rotationPointZ = -2.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornarm.rotateAngleX = -1.5707964F;
this.unicornarm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornarm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornarm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
this.unicornArmRight.rotationPointX = -7.0F;
this.unicornArmRight.rotationPointY = 12.0F;
this.unicornArmRight.rotationPointZ = -2.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornArmRight.rotateAngleX = -1.5707964F;
this.unicornArmRight.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornArmRight.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmRight.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}

View file

@ -51,7 +51,7 @@ public class ModelZombiePony extends ModelPlayerPony {
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
@ -59,13 +59,13 @@ public class ModelZombiePony extends ModelPlayerPony {
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.unicornArmRight.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose == ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * (float) Math.PI);

View file

@ -197,7 +197,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.steveRightArm = new ModelRenderer(this, 0, 16);
this.unicornarm = new ModelRenderer(this, 0, 16);
this.unicornArmRight = new ModelRenderer(this, 0, 16);
this.extLegs[0] = new ModelRenderer(this, 48, 8);
this.extLegs[1] = new ModelRenderer(this, 48, 8);
this.extLegs[1].mirror = true;

View file

@ -42,7 +42,7 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.6F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
@ -50,13 +50,13 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.unicornArmRight.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose != ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);
@ -69,12 +69,12 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
this.bipedRightArm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
} else {
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornarm.rotateAngleX = -1.5707964F;
this.unicornarm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornarm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornarm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleY = 0.1F - var8 * 0.6F;
this.unicornArmRight.rotateAngleX = -1.5707964F;
this.unicornArmRight.rotateAngleX -= var8 * 1.2F - var9 * 0.4F;
this.unicornArmRight.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
this.unicornArmRight.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
}
}

View file

@ -42,7 +42,7 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.unicornArmRight.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
@ -50,13 +50,13 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.unicornArmRight.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.unicornArmRight.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.rightArmPose == ArmPose.EMPTY) {
var8 = MathHelper.sin(this.swingProgress * 3.1415927F);

View file

@ -15,6 +15,7 @@ import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.IBakedModel;
@ -75,7 +76,8 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
boolean isUnicorn = metadata.getRace().hasHorn();
if (isUnicorn) {
ModelPlayerPony playerModel = (ModelPlayerPony) thePony;
playerModel.unicornarm.postRender(0.0625F);
ModelRenderer unicornarm = hand == EnumHandSide.LEFT ? playerModel.unicornArmLeft : playerModel.unicornArmRight;
unicornarm.postRender(0.0625F);
} else {
((ModelBiped) this.livingPonyEntity.getMainModel()).postRenderArm(0.0625F, hand);
}
@ -87,7 +89,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
boolean isLeft = hand == EnumHandSide.LEFT;
if (isUnicorn) {
GlStateManager.translate(isLeft ? -0.1F : 0.1F, 1, -.5);
GlStateManager.translate(isLeft ? -0.6F : 0.1F, 1, -.5);
} else {
GlStateManager.translate(0.0425F, 0.125F, -1.00F);
}