Update to 1.12

Changes:
 * Added a base layer class which can intelligently switch between pony and human.
 * Skins no longer are "converted" when they are already in the new format.
 * Illagers now use the existing model and texture format.
 * Metadata can now be read from the .mcmeta file (taken from old illagers)
 * Non-converted resources are no longer re-uploaded
 * (1.12) Parrots are rendered on the head instead of shoulders
This commit is contained in:
Matthew Messinger 2017-06-12 23:55:50 -04:00
parent 370e8e3af3
commit c9d7a394ad
49 changed files with 725 additions and 701 deletions

2
.gitignore vendored
View file

@ -10,4 +10,6 @@ run/
.factorypath .factorypath
logs/ logs/
.idea/ .idea/
*.iml
classes/ classes/
out/

View file

@ -11,7 +11,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
} }
} }
@ -20,34 +20,31 @@ apply plugin: 'net.minecraftforge.gradle.liteloader'
apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.spongepowered.mixin'
group = 'com.minelittlepony' group = 'com.minelittlepony'
version = '1.11.2.3' version = '1.12_0'
description = 'Mine Little Pony' description = 'Mine Little Pony'
targetCompatibility = 1.8 targetCompatibility = 1.8
sourceCompatibility = 1.8 sourceCompatibility = 1.8
minecraft { minecraft {
version = "1.11.2" version = "1.12"
mappings = 'snapshot_20161224' mappings = 'snapshot_20170611'
runDir = 'run' runDir = 'run'
replace '@VERSION@', project.version replace '@VERSION@', project.version
} }
sourceSets { sourceSets {
def deps = [
configurations.forgeGradleMcDeps,
configurations.forgeGradleMc,
configurations.compile,
]
hdskins { hdskins {
compileClasspath += files deps compileClasspath += main.compileClasspath
refMap = 'mixin.hdskins.refmap.json'
} }
main { main {
refMap = 'mixin.minelp.refmap.json'
compileClasspath += hdskins.output compileClasspath += hdskins.output
} }
}
mixin {
add sourceSets.main, 'mixin.minelp.refmap.json'
add sourceSets.hdskins, 'mixin.hdskins.refmap.json'
} }
litemod.json { litemod.json {

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Tue Mar 28 02:04:51 EDT 2017 #Tue Jun 13 01:29:43 EDT 2017
build.number=312 build.number=344

View file

@ -232,9 +232,10 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
skinModifiers.add(modifier); skinModifiers.add(modifier);
} }
@Nullable @Nonnull
public ResourceLocation getConvertedSkin(@Nullable ResourceLocation res) { public ResourceLocation getConvertedSkin(@Nullable ResourceLocation res) {
return resources.getConvertedResource(res); ResourceLocation loc = resources.getConvertedResource(res);
return loc == null ? res : loc;
} }
public void convertSkin(BufferedImage image, Graphics dest) { public void convertSkin(BufferedImage image, Graphics dest) {

View file

@ -91,6 +91,7 @@ public class EntityPlayerModel extends EntityLivingBase {
try { try {
BufferedImage image = ImageIO.read(skinTextureFile); BufferedImage image = ImageIO.read(skinTextureFile);
bufferedImage = new ImageBufferDownloadHD().parseUserSkin(image); bufferedImage = new ImageBufferDownloadHD().parseUserSkin(image);
assert bufferedImage != null;
} catch (IOException var4) { } catch (IOException var4) {
this.localSkinResource = NO_SKIN; this.localSkinResource = NO_SKIN;
var4.printStackTrace(); var4.printStackTrace();
@ -127,7 +128,7 @@ public class EntityPlayerModel extends EntityLivingBase {
return !this.remoteSkin && this.hasLocalTexture; return !this.remoteSkin && this.hasLocalTexture;
} }
@Override // @Override TODO
public float getBrightness(float par1) { public float getBrightness(float par1) {
return 1.0F; return 1.0F;
} }
@ -188,9 +189,9 @@ public class EntityPlayerModel extends EntityLivingBase {
return Minecraft.getMinecraft().gameSettings.mainHand; return Minecraft.getMinecraft().gameSettings.mainHand;
} }
@Override // @Override TODO
public int getBrightnessForRender(float partialTicks) { public int getBrightnessForRender(float partialTicks) {
return 15728880; return 0xf000f0;
} }

View file

@ -4,21 +4,20 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class GuiItemStackButton extends GuiButton { public class GuiItemStackButton extends GuiButton {
private ItemStack itemStack; private ItemStack itemStack;
public GuiItemStackButton(int buttonId, int x, int y, @Nonnull ItemStack itemStack) { public GuiItemStackButton(int buttonId, int x, int y, ItemStack itemStack) {
super(buttonId, x, y, 20, 20, ""); super(buttonId, x, y, 20, 20, "");
this.itemStack = itemStack; this.itemStack = itemStack;
} }
// drawButton
@Override @Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) { public void func_191745_a(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
super.drawButton(mc, mouseX, mouseY); super.func_191745_a(mc, mouseX, mouseY, partialTicks);
mc.getRenderItem().renderItemIntoGUI(itemStack, this.xPosition + 2, this.yPosition + 2); mc.getRenderItem().renderItemIntoGUI(itemStack, this.x + 2, this.y + 2);
} }
} }

View file

@ -7,18 +7,16 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mumfrey.liteloader.util.log.LiteLoaderLogger; import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
import com.voxelmodpack.hdskins.HDSkinManager; import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.upload.IUploadCompleteCallback;
import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload; import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload;
import com.voxelmodpack.hdskins.upload.awt.IOpenFileCallback;
import com.voxelmodpack.hdskins.upload.awt.ThreadOpenFilePNG; import com.voxelmodpack.hdskins.upload.awt.ThreadOpenFilePNG;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@ -392,7 +390,7 @@ public class GuiSkins extends GuiScreen {
blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
byte blendIterations = 8; byte blendIterations = 8;
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vb = tessellator.getBuffer(); BufferBuilder vb = tessellator.getBuffer();
for (int blendPass = 0; blendPass < blendIterations * blendIterations; ++blendPass) { for (int blendPass = 0; blendPass < blendIterations * blendIterations; ++blendPass) {
pushMatrix(); pushMatrix();
@ -456,7 +454,7 @@ public class GuiSkins extends GuiScreen {
blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
colorMask(true, true, true, false); colorMask(true, true, true, false);
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vb = tessellator.getBuffer(); BufferBuilder vb = tessellator.getBuffer();
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
byte blurPasses = 4; byte blurPasses = 4;
@ -485,7 +483,7 @@ public class GuiSkins extends GuiScreen {
viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vb = tessellator.getBuffer(); BufferBuilder vb = tessellator.getBuffer();
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
float aspect = this.width > this.height ? 120.0F / this.width : 120.0F / this.height; float aspect = this.width > this.height ? 120.0F / this.width : 120.0F / this.height;
float uSample = this.height * aspect / 256.0F; float uSample = this.height * aspect / 256.0F;
@ -540,10 +538,10 @@ public class GuiSkins extends GuiScreen {
this.disableClipping(); this.disableClipping();
this.drawCenteredString(this.fontRendererObj, I18n.format("hdskins.manager"), this.width / 2, 10, 0xffffff); this.drawCenteredString(this.fontRenderer, I18n.format("hdskins.manager"), this.width / 2, 10, 0xffffff);
this.fontRendererObj.drawStringWithShadow(I18n.format("hdskins.local"), 34, 34, 0xffffff); this.fontRenderer.drawStringWithShadow(I18n.format("hdskins.local"), 34, 34, 0xffffff);
this.fontRendererObj.drawStringWithShadow(I18n.format("hdskins.server"), this.width / 2 + 34, 34, 0xffffff); this.fontRenderer.drawStringWithShadow(I18n.format("hdskins.server"), this.width / 2 + 34, 34, 0xffffff);
disableDepth(); disableDepth();
enableBlend(); enableBlend();
@ -556,19 +554,19 @@ public class GuiSkins extends GuiScreen {
int labelwidth = (this.width / 2 - 80) / 2; int labelwidth = (this.width / 2 - 80) / 2;
if (!this.localPlayer.isUsingLocalTexture()) { if (!this.localPlayer.isUsingLocalTexture()) {
int opacity = this.fontRendererObj.getStringWidth(this.skinMessage) / 2; int opacity = this.fontRenderer.getStringWidth(this.skinMessage) / 2;
Gui.drawRect(40, this.height / 2 - 12, this.width / 2 - 40, this.height / 2 + 12, 0xB0000000); Gui.drawRect(40, this.height / 2 - 12, this.width / 2 - 40, this.height / 2 + 12, 0xB0000000);
this.fontRendererObj.drawStringWithShadow(this.skinMessage, (int) (xPos1 - opacity), this.height / 2 - 4, 0xffffff); this.fontRenderer.drawStringWithShadow(this.skinMessage, (int) (xPos1 - opacity), this.height / 2 - 4, 0xffffff);
} }
if (this.btnModeSkin.isMouseOver() || this.btnModeElytra.isMouseOver()) { if (this.btnModeSkin.isMouseOver() || this.btnModeElytra.isMouseOver()) {
int y = Math.max(mouseY, 16); int y = Math.max(mouseY, 16);
String text; String text;
if (this.btnModeSkin.isMouseOver()) { if (this.btnModeSkin.isMouseOver()) {
text = "hdskins.mode.skin"; text = "hdskins.mode.skin";
} else{ } else {
text = "hdskins.mode.elytra"; text = "hdskins.mode.elytra";
} }
this.drawCreativeTabHoveringText(I18n.format(text), mouseX, y); this.drawHoveringText(I18n.format(text), mouseX, y);
} }
if (this.fetchingSkin) { if (this.fetchingSkin) {
@ -576,18 +574,18 @@ public class GuiSkins extends GuiScreen {
if (this.throttledByMojang) { if (this.throttledByMojang) {
opacity1 = TextFormatting.RED + I18n.format("hdskins.error.mojang"); opacity1 = TextFormatting.RED + I18n.format("hdskins.error.mojang");
String stringWidth = I18n.format("hdskins.error.mojang.wait"); String stringWidth = I18n.format("hdskins.error.mojang.wait");
int stringWidth1 = this.fontRendererObj.getStringWidth(opacity1) / 2; int stringWidth1 = this.fontRenderer.getStringWidth(opacity1) / 2;
int stringWidth2 = this.fontRendererObj.getStringWidth(stringWidth) / 2; int stringWidth2 = this.fontRenderer.getStringWidth(stringWidth) / 2;
Gui.drawRect((int) (xPos2 - labelwidth), this.height / 2 - 16, this.width - 40, this.height / 2 + 16, 0xB0000000); Gui.drawRect((int) (xPos2 - labelwidth), this.height / 2 - 16, this.width - 40, this.height / 2 + 16, 0xB0000000);
this.fontRendererObj.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), this.height / 2 - 10, 0xffffff); this.fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), this.height / 2 - 10, 0xffffff);
this.fontRendererObj.drawStringWithShadow(stringWidth, (int) (xPos2 - stringWidth2), this.height / 2 + 2, 0xffffff); this.fontRenderer.drawStringWithShadow(stringWidth, (int) (xPos2 - stringWidth2), this.height / 2 + 2, 0xffffff);
} else { } else {
opacity1 = I18n.format("hdskins.fetch"); opacity1 = I18n.format("hdskins.fetch");
int stringWidth1 = this.fontRendererObj.getStringWidth(opacity1) / 2; int stringWidth1 = this.fontRenderer.getStringWidth(opacity1) / 2;
Gui.drawRect((int) (xPos2 - labelwidth), this.height / 2 - 12, this.width - 40, this.height / 2 + 12, 0xB0000000); Gui.drawRect((int) (xPos2 - labelwidth), this.height / 2 - 12, this.width - 40, this.height / 2 + 12, 0xB0000000);
this.fontRendererObj.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), this.height / 2 - 4, 0xffffff); this.fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), this.height / 2 - 4, 0xffffff);
} }
} }
@ -606,15 +604,15 @@ public class GuiSkins extends GuiScreen {
if (this.uploadOpacity > 0.0F) { if (this.uploadOpacity > 0.0F) {
Gui.drawRect(0, 0, this.width, this.height, opacity << 24); Gui.drawRect(0, 0, this.width, this.height, opacity << 24);
if (this.uploadingSkin) { if (this.uploadingSkin) {
this.drawCenteredString(this.fontRendererObj, this.skinUploadMessage, this.width / 2, this.height / 2, opacity << 24 | 0xffffff); this.drawCenteredString(this.fontRenderer, this.skinUploadMessage, this.width / 2, this.height / 2, opacity << 24 | 0xffffff);
} }
} }
} }
if (this.uploadError != null) { if (this.uploadError != null) {
Gui.drawRect(0, 0, this.width, this.height, 0xB0000000); Gui.drawRect(0, 0, this.width, this.height, 0xB0000000);
this.drawCenteredString(this.fontRendererObj, I18n.format("hdskins.failed"), this.width / 2, this.height / 2 - 10, 0xFFFFFF55); this.drawCenteredString(this.fontRenderer, I18n.format("hdskins.failed"), this.width / 2, this.height / 2 - 10, 0xFFFFFF55);
this.drawCenteredString(this.fontRendererObj, this.uploadError, this.width / 2, this.height / 2 + 2, 0xFFFF5555); this.drawCenteredString(this.fontRenderer, this.uploadError, this.width / 2, this.height / 2 + 2, 0xFFFF5555);
} }
depthMask(true); depthMask(true);
@ -672,7 +670,7 @@ public class GuiSkins extends GuiScreen {
public static boolean isPowerOfTwo(int number) { public static boolean isPowerOfTwo(int number) {
return number != 0 && (number & number - 1) == 0; return number != 0 && (number & number - 1) == 0;
} }
private void clearUploadedSkin(Session session) { private void clearUploadedSkin(Session session) {
if (this.registerServerConnection(session, skinServerId)) { if (this.registerServerConnection(session, skinServerId)) {
Map<String, ?> sourceData = getClearData(session); Map<String, ?> sourceData = getClearData(session);

View file

@ -18,7 +18,8 @@ public class HDSkinsConfigPanel implements ConfigPanel {
@Override @Override
public void drawPanel(ConfigPanelHost host, int mouseX, int mouseY, float partialTicks) { public void drawPanel(ConfigPanelHost host, int mouseX, int mouseY, float partialTicks) {
this.button.drawButton(Minecraft.getMinecraft(), mouseX, mouseY); // TODO drawButton
this.button.func_191745_a(Minecraft.getMinecraft(), mouseX, mouseY, partialTicks);
} }
@Override @Override

View file

@ -1,6 +1,5 @@
package com.voxelmodpack.hdskins.resource; package com.voxelmodpack.hdskins.resource;
import com.google.common.base.Throwables;
import com.voxelmodpack.hdskins.DynamicTextureImage; import com.voxelmodpack.hdskins.DynamicTextureImage;
import com.voxelmodpack.hdskins.ImageBufferDownloadHD; import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -12,9 +11,9 @@ import javax.annotation.Nullable;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.concurrent.Callable; import java.util.function.Supplier;
public class ImageLoader implements Callable<ResourceLocation> { public class ImageLoader implements Supplier<ResourceLocation> {
private Minecraft mc = Minecraft.getMinecraft(); private Minecraft mc = Minecraft.getMinecraft();
@ -25,11 +24,17 @@ public class ImageLoader implements Callable<ResourceLocation> {
} }
@Override @Override
public ResourceLocation call() throws Exception { @Nullable
public ResourceLocation get() {
BufferedImage image = getImage(original); BufferedImage image = getImage(original);
final BufferedImage updated = new ImageBufferDownloadHD().parseUserSkin(image); final BufferedImage updated = new ImageBufferDownloadHD().parseUserSkin(image);
if (updated == null) if (updated == null) {
return null; return null;
}
if (updated == image) {
// don't load a new image
return this.original;
}
return this.mc.addScheduledTask(() -> loadSkin(updated)).get(); return this.mc.addScheduledTask(() -> loadSkin(updated)).get();
} }
@ -43,16 +48,16 @@ public class ImageLoader implements Callable<ResourceLocation> {
IOUtils.closeQuietly(in); IOUtils.closeQuietly(in);
} }
} catch (IOException e) { } catch (IOException e) {
Throwables.propagate(e); return null;
} }
return null;
} }
@Nullable
private ResourceLocation loadSkin(BufferedImage image) { private ResourceLocation loadSkin(BufferedImage image) {
ResourceLocation conv = new ResourceLocation(original.getResourceDomain() + "-converted", original.getResourcePath()); ResourceLocation conv = new ResourceLocation(original.getResourceDomain() + "-converted", original.getResourcePath());
this.mc.getTextureManager().loadTexture(conv, new DynamicTextureImage(image)); boolean success= this.mc.getTextureManager().loadTexture(conv, new DynamicTextureImage(image));
return conv; return success ? conv : null;
} }
} }

View file

@ -1,15 +1,11 @@
package com.voxelmodpack.hdskins.resource; package com.voxelmodpack.hdskins.resource;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mumfrey.liteloader.util.log.LiteLoaderLogger; import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.IResourceManagerReloadListener;
@ -23,12 +19,14 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
public class SkinResourceManager implements IResourceManagerReloadListener { public class SkinResourceManager implements IResourceManagerReloadListener {
private ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()); private ExecutorService executor = Executors.newSingleThreadExecutor();
private Map<UUID, Skin> uuidSkins = Maps.newHashMap(); private Map<UUID, Skin> uuidSkins = Maps.newHashMap();
private Map<String, Skin> namedSkins = Maps.newHashMap(); private Map<String, Skin> namedSkins = Maps.newHashMap();
@ -39,13 +37,8 @@ public class SkinResourceManager implements IResourceManagerReloadListener {
public void onResourceManagerReload(IResourceManager resourceManager) { public void onResourceManagerReload(IResourceManager resourceManager) {
uuidSkins.clear(); uuidSkins.clear();
namedSkins.clear(); namedSkins.clear();
for (Future<ResourceLocation> loc : inProgress.values()) { executor.shutdownNow();
loc.cancel(true);
}
inProgress.clear(); inProgress.clear();
for (ResourceLocation res : converted.values()) {
Minecraft.getMinecraft().getTextureManager().deleteTexture(res);
}
converted.clear(); converted.clear();
for (String domain : resourceManager.getResourceDomains()) { for (String domain : resourceManager.getResourceDomains()) {
try { try {
@ -107,21 +100,20 @@ public class SkinResourceManager implements IResourceManagerReloadListener {
private void loadSkinResource(@Nullable final ResourceLocation res) { private void loadSkinResource(@Nullable final ResourceLocation res) {
if (res != null) { if (res != null) {
if (this.inProgress.get(res) == null) { // read and convert in a new thread
// read and convert in a new thread this.inProgress.computeIfAbsent(res, r -> CompletableFuture.supplyAsync(new ImageLoader(r), executor)
final ListenableFuture<ResourceLocation> conv = executor.submit(new ImageLoader(res)); .whenComplete((loc, t) -> {
conv.addListener(() -> { if (loc != null)
try { converted.put(res, loc);
if (!conv.isCancelled()) else {
converted.put(res, conv.get()); LogManager.getLogger().warn("Errored while processing {}. Using original.", res, t);
} catch (Exception e) { converted.put(res, res);
LogManager.getLogger().warn("Errored while processing " + res + ". Using original.", e); }
converted.put(res, res); }));
}
}, executor);
this.inProgress.put(res, conv);
}
} }
} }
@Nullable @Nullable

View file

@ -6,6 +6,7 @@ import com.minelittlepony.hdskins.gui.EntityPonyModel;
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP; import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
import com.minelittlepony.hdskins.gui.RenderPonyModel; import com.minelittlepony.hdskins.gui.RenderPonyModel;
import com.minelittlepony.renderer.RenderPonyEvoker; import com.minelittlepony.renderer.RenderPonyEvoker;
import com.minelittlepony.renderer.RenderPonyIllusionIllager;
import com.minelittlepony.renderer.RenderPonyPigman; import com.minelittlepony.renderer.RenderPonyPigman;
import com.minelittlepony.renderer.RenderPonySkeleton; import com.minelittlepony.renderer.RenderPonySkeleton;
import com.minelittlepony.renderer.RenderPonyVex; import com.minelittlepony.renderer.RenderPonyVex;
@ -26,6 +27,7 @@ import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEvoker; import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntityHusk; import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityIllusionIllager;
import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityStray; import net.minecraft.entity.monster.EntityStray;
@ -96,21 +98,26 @@ public class MineLittlePony {
private void saveCurrentRenderers(RenderManager rm) { private void saveCurrentRenderers(RenderManager rm) {
// villagers // villagers
this.renderMap.put(EntityVillager.class, rm.getEntityClassRenderObject(EntityVillager.class)); saveRenderer(rm, EntityVillager.class);
this.renderMap.put(EntityZombieVillager.class, rm.getEntityClassRenderObject(EntityZombieVillager.class)); saveRenderer(rm, EntityZombieVillager.class);
// zombies // zombies
this.renderMap.put(EntityZombie.class, rm.getEntityClassRenderObject(EntityZombie.class)); saveRenderer(rm, EntityZombie.class);
this.renderMap.put(EntityHusk.class, rm.getEntityClassRenderObject(EntityHusk.class)); saveRenderer(rm, EntityHusk.class);
// pig zombie // pig zombie
this.renderMap.put(EntityPigZombie.class, rm.getEntityClassRenderObject(EntityPigZombie.class)); saveRenderer(rm, EntityPigZombie.class);
// skeletons // skeletons
this.renderMap.put(EntitySkeleton.class, rm.getEntityClassRenderObject(EntitySkeleton.class)); saveRenderer(rm, EntitySkeleton.class);
this.renderMap.put(EntityStray.class, rm.getEntityClassRenderObject(EntityStray.class)); saveRenderer(rm, EntityStray.class);
this.renderMap.put(EntityWitherSkeleton.class, rm.getEntityClassRenderObject(EntityWitherSkeleton.class)); saveRenderer(rm, EntityWitherSkeleton.class);
// illagers // illagers
this.renderMap.put(EntityVex.class, rm.getEntityClassRenderObject(EntityVex.class)); saveRenderer(rm, EntityVex.class);
this.renderMap.put(EntityEvoker.class, rm.getEntityClassRenderObject(EntityEvoker.class)); saveRenderer(rm, EntityEvoker.class);
this.renderMap.put(EntityVindicator.class, rm.getEntityClassRenderObject(EntityVindicator.class)); saveRenderer(rm, EntityVindicator.class);
saveRenderer(rm, EntityIllusionIllager.class);
}
private void saveRenderer(RenderManager rm, Class<? extends Entity> cl) {
this.renderMap.put(cl, rm.getEntityClassRenderObject(cl));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -162,11 +169,13 @@ public class MineLittlePony {
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm)); ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm)); ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm)); ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
ModUtilities.addRenderer(EntityIllusionIllager.class, new RenderPonyIllusionIllager(rm));
logger.info("Illagers are now ponies."); logger.info("Illagers are now ponies.");
} else { } else {
ModUtilities.addRenderer(EntityVex.class, getRenderer(EntityVex.class)); ModUtilities.addRenderer(EntityVex.class, getRenderer(EntityVex.class));
ModUtilities.addRenderer(EntityEvoker.class, getRenderer(EntityEvoker.class)); ModUtilities.addRenderer(EntityEvoker.class, getRenderer(EntityEvoker.class));
ModUtilities.addRenderer(EntityVindicator.class, getRenderer(EntityVindicator.class)); ModUtilities.addRenderer(EntityVindicator.class, getRenderer(EntityVindicator.class));
ModUtilities.addRenderer(EntityIllusionIllager.class, getRenderer(EntityIllusionIllager.class));
} }
} }

View file

@ -15,32 +15,32 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
public class Pony { public class Pony {
private static PonyConfig config = MineLittlePony.getConfig(); private static final AtomicInteger ponyCount = new AtomicInteger();
private final int ponyId = ponyCount.getAndIncrement();
private static int ponyCount = 0; private ResourceLocation textureResourceLocation;
private final int ponyId = ponyCount++;
public ResourceLocation textureResourceLocation;
public PonyData metadata = new PonyData(); public PonyData metadata = new PonyData();
private int skinCheckCount; private int skinCheckCount;
private boolean skinChecked; private boolean skinChecked;
public Pony(@Nonnull AbstractClientPlayer player) { public Pony(AbstractClientPlayer player) {
this.textureResourceLocation = player.getLocationSkin(); this.textureResourceLocation = player.getLocationSkin();
MineLittlePony.logger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId, MineLittlePony.logger.debug("+ Initialising new pony #{} for player {} ({}) with resource location {}.", this.ponyId,
player.getName(), player.getUniqueID(), this.textureResourceLocation); player.getName(), player.getUniqueID(), this.textureResourceLocation);
this.checkSkin(this.textureResourceLocation); this.checkSkin(this.textureResourceLocation);
} }
public Pony(@Nonnull ResourceLocation aTextureResourceLocation) { public Pony(ResourceLocation aTextureResourceLocation) {
this.textureResourceLocation = aTextureResourceLocation; this.textureResourceLocation = aTextureResourceLocation;
MineLittlePony.logger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, this.textureResourceLocation); MineLittlePony.logger.debug("+ Initialising new pony #{} with resource location {}.", this.ponyId, this.textureResourceLocation);
this.checkSkin(this.textureResourceLocation); this.checkSkin(this.textureResourceLocation);
} }
@ -55,19 +55,39 @@ public class Pony {
} }
} }
public void checkSkin(ResourceLocation textureResourceLocation) { private void checkSkin(ResourceLocation textureResourceLocation) {
BufferedImage skinImage = this.getBufferedImage(textureResourceLocation); if(!checkPonyMeta(textureResourceLocation)) {
if (skinImage != null) { BufferedImage skinImage = this.getBufferedImage(textureResourceLocation);
this.checkSkin(skinImage); if (skinImage != null) {
this.checkSkin(skinImage);
}
} }
} }
public BufferedImage getBufferedImage(@Nonnull ResourceLocation textureResourceLocation) { private boolean checkPonyMeta(ResourceLocation location) {
try {
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(location);
if (res.hasMetadata()) {
PonyData data = res.getMetadata(PonyDataSerialzier.NAME);
if (data != null) {
metadata = data;
this.skinChecked = true;
}
return true;
}
} catch (IOException e) {
MineLittlePony.logger.warn("Unable to read {} metadata", location, e);
}
return false;
}
@Nullable
private BufferedImage getBufferedImage(@Nonnull ResourceLocation textureResourceLocation) {
BufferedImage skinImage = null; BufferedImage skinImage = null;
try { try {
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation); IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation);
skinImage = TextureUtil.readBufferedImage(skin.getInputStream()); skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
MineLittlePony.logger.debug("Obtained skin from resource location %s", textureResourceLocation); MineLittlePony.logger.debug("Obtained skin from resource location {}", textureResourceLocation);
// this.checkSkin(skinImage); // this.checkSkin(skinImage);
} catch (IOException e) { } catch (IOException e) {
@ -94,14 +114,14 @@ public class Pony {
} }
public void checkSkin(BufferedImage bufferedimage) { public void checkSkin(BufferedImage bufferedimage) {
MineLittlePony.logger.debug("\tStart skin check #%d for pony #%d with image %s.", ++this.skinCheckCount, this.ponyId); MineLittlePony.logger.debug("\tStart skin check #{} for pony #{} with image {}.", ++this.skinCheckCount, this.ponyId, bufferedimage);
metadata = PonyData.parse(bufferedimage); metadata = PonyData.parse(bufferedimage);
this.skinChecked = true; this.skinChecked = true;
} }
public boolean isPegasusFlying(EntityPlayer player) { public boolean isPegasusFlying(EntityPlayer player) {
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
if (this.metadata.getRace() == null || !this.metadata.getRace().hasWings()) { if (!this.metadata.getRace().hasWings()) {
return false; return false;
} }
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying()); return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying());
@ -109,12 +129,12 @@ public class Pony {
public PlayerModel getModel(boolean ignorePony, boolean smallArms) { public PlayerModel getModel(boolean ignorePony, boolean smallArms) {
boolean is_a_pony = false; boolean is_a_pony = false;
switch (ignorePony ? PonyLevel.BOTH : config.getPonyLevel()) { switch (ignorePony ? PonyLevel.BOTH : MineLittlePony.getConfig().getPonyLevel()) {
case HUMANS: case HUMANS:
is_a_pony = false; is_a_pony = false;
break; break;
case BOTH: case BOTH:
is_a_pony = metadata.getRace() != null; is_a_pony = metadata.getRace() != PonyRace.HUMAN;
break; break;
case PONIES: case PONIES:
is_a_pony = true; is_a_pony = true;

View file

@ -10,11 +10,10 @@ import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.apache.commons.compress.utils.IOUtils;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -26,6 +25,9 @@ public class PonyManager implements IResourceManagerReloadListener {
public static final ResourceLocation ALEX = new ResourceLocation("minelittlepony", "textures/entity/alex_pony.png"); public static final ResourceLocation ALEX = new ResourceLocation("minelittlepony", "textures/entity/alex_pony.png");
private static final ResourceLocation BGPONIES_JSON = new ResourceLocation("minelittlepony", "textures/entity/pony/bgponies.json"); private static final ResourceLocation BGPONIES_JSON = new ResourceLocation("minelittlepony", "textures/entity/pony/bgponies.json");
private static final Gson GSON = new Gson();
private List<ResourceLocation> backgroundPonyList = Lists.newArrayList(); private List<ResourceLocation> backgroundPonyList = Lists.newArrayList();
private PonyConfig config; private PonyConfig config;
@ -44,37 +46,22 @@ public class PonyManager implements IResourceManagerReloadListener {
MineLittlePony.logger.info("Done initializing models."); MineLittlePony.logger.info("Done initializing models.");
} }
private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) {
Pony myLittlePony;
if (!this.poniesCache.containsKey(skinResourceLocation)) {
if (player != null) {
myLittlePony = new Pony(player);
} else {
myLittlePony = new Pony(skinResourceLocation);
}
this.poniesCache.put(skinResourceLocation, myLittlePony);
} else {
myLittlePony = this.poniesCache.get(skinResourceLocation);
}
return myLittlePony;
}
public Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation) { public Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation) {
return this.getPonyFromResourceRegistry(skinResourceLocation, null); return this.poniesCache.computeIfAbsent(skinResourceLocation, Pony::new);
} }
public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) { public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) {
Pony myLittlePony = this.getPonyFromResourceRegistry(player.getLocationSkin(), player);
if (config.getPonyLevel() == PonyLevel.PONIES && myLittlePony.metadata.getRace() == null) { Pony myLittlePony = this.poniesCache.computeIfAbsent(player.getLocationSkin(), res -> new Pony(player));
if (config.getPonyLevel() == PonyLevel.PONIES && myLittlePony.metadata.getRace() == PonyRace.HUMAN) {
myLittlePony = this.getPonyFromBackgroundResourceRegistry(player); myLittlePony = this.getPonyFromBackgroundResourceRegistry(player);
} }
return myLittlePony; return myLittlePony;
} }
public ResourceLocation getBackgroundPonyResource(UUID id) { private ResourceLocation getBackgroundPonyResource(UUID id) {
if (getNumberOfPonies() > 0) { if (getNumberOfPonies() > 0) {
int backgroundIndex = id.hashCode() % this.getNumberOfPonies(); int backgroundIndex = id.hashCode() % this.getNumberOfPonies();
if (backgroundIndex < 0) { if (backgroundIndex < 0) {
@ -86,7 +73,7 @@ public class PonyManager implements IResourceManagerReloadListener {
return STEVE; return STEVE;
} }
public Pony getPonyFromBackgroundResourceRegistry(AbstractClientPlayer player) { private Pony getPonyFromBackgroundResourceRegistry(AbstractClientPlayer player) {
ResourceLocation textureResourceLocation; ResourceLocation textureResourceLocation;
if (player.isUser()) { if (player.isUser()) {
textureResourceLocation = getDefaultSkin(player.getUniqueID()); textureResourceLocation = getDefaultSkin(player.getUniqueID());
@ -107,13 +94,13 @@ public class PonyManager implements IResourceManagerReloadListener {
@Override @Override
public void onResourceManagerReload(IResourceManager resourceManager) { public void onResourceManagerReload(IResourceManager resourceManager) {
// TODO Auto-generated method stub this.poniesCache.clear();
this.backgroudPoniesCache.clear(); this.backgroudPoniesCache.clear();
this.backgroundPonyList.clear(); this.backgroundPonyList.clear();
try { try {
for (IResource res : resourceManager.getAllResources(BGPONIES_JSON)) { for (IResource res : resourceManager.getAllResources(BGPONIES_JSON)) {
try { try (Reader reader = new InputStreamReader((res.getInputStream()))) {
BackgroundPonies ponies = getBackgroundPonies(res.getInputStream()); BackgroundPonies ponies = GSON.fromJson(reader, BackgroundPonies.class);
if (ponies.override) { if (ponies.override) {
this.backgroundPonyList.clear(); this.backgroundPonyList.clear();
} }
@ -128,14 +115,6 @@ public class PonyManager implements IResourceManagerReloadListener {
MineLittlePony.logger.info("Detected {} background ponies installed.", getNumberOfPonies()); MineLittlePony.logger.info("Detected {} background ponies installed.", getNumberOfPonies());
} }
private BackgroundPonies getBackgroundPonies(InputStream stream) {
try {
return new Gson().fromJson(new InputStreamReader(stream), BackgroundPonies.class);
} finally {
IOUtils.closeQuietly(stream);
}
}
private ResourceLocation getDefaultSkin(UUID uuid) { private ResourceLocation getDefaultSkin(UUID uuid) {
return (uuid.hashCode() & 1) == 0 ? STEVE : ALEX; return (uuid.hashCode() & 1) == 0 ? STEVE : ALEX;
} }

View file

@ -108,11 +108,11 @@ public class PonySettingPanel extends GuiScreen {
public void drawScreen(int mouseX, int mouseY, float partialTicks) { public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground(); this.drawDefaultBackground();
this.drawCenteredString(mc.fontRendererObj, I18n.format(TITLE), width / 2, 12, -1); this.drawCenteredString(mc.fontRenderer, I18n.format(TITLE), width / 2, 12, -1);
this.drawString(mc.fontRendererObj, I18n.format(MOB_TITLE), width - width / 3 - 16, 32, -1); this.drawString(mc.fontRenderer, I18n.format(MOB_TITLE), width - width / 3 - 16, 32, -1);
this.drawString(mc.fontRendererObj, I18n.format(PONY_LEVEL), width / 10, 32, -1); this.drawString(mc.fontRenderer, I18n.format(PONY_LEVEL), width / 10, 32, -1);
this.drawString(mc.fontRendererObj, I18n.format(OPTIONS), width / 10, 94, -1); this.drawString(mc.fontRenderer, I18n.format(OPTIONS), width / 10, 94, -1);
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);
} }

View file

@ -6,7 +6,7 @@ import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.ModelPonyElytra; import com.minelittlepony.model.ModelPonyElytra;
import com.minelittlepony.model.PlayerModel; import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.pony.ModelHumanPlayer; import com.minelittlepony.renderer.layer.AbstractPonyLayer;
import com.voxelmodpack.hdskins.gui.RenderPlayerModel; import com.voxelmodpack.hdskins.gui.RenderPlayerModel;
import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@ -40,14 +40,11 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
protected LayerRenderer<EntityLivingBase> getElytraLayer() { protected LayerRenderer<EntityLivingBase> getElytraLayer() {
final LayerRenderer<EntityLivingBase> elytra = super.getElytraLayer(); final LayerRenderer<EntityLivingBase> elytra = super.getElytraLayer();
final ModelPonyElytra modelElytra = new ModelPonyElytra(); final ModelPonyElytra modelElytra = new ModelPonyElytra();
return new LayerRenderer<EntityLivingBase>() { return new AbstractPonyLayer<EntityLivingBase>(this, elytra) {
@Override @Override
public void doRenderLayer(EntityLivingBase entityBase, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) { public void doPonyRender(EntityLivingBase entityBase, float swing, float swingAmount, float ticks, float age, float yaw, float head,
if (mainModel instanceof ModelHumanPlayer) { float scale) {
elytra.doRenderLayer(entityBase, swing, swingAmount, ticks, age, yaw, head, scale);
return;
}
EntityPonyModel entity = (EntityPonyModel) entityBase; EntityPonyModel entity = (EntityPonyModel) entityBase;
@ -60,8 +57,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.25F, 0.125F); GlStateManager.translate(0.0F, 0.25F, 0.125F);
if (mainModel instanceof AbstractPonyModel) ((AbstractPonyModel) mainModel).transform(BodyPart.BODY);
((AbstractPonyModel) mainModel).transform(BodyPart.BODY);
modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity); modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale); modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);
@ -71,11 +67,6 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
} }
} }
@Override
public boolean shouldCombineTextures() {
return false;
}
}; };
} }
} }

View file

@ -9,7 +9,12 @@ import com.minelittlepony.model.PMAPI;
import com.minelittlepony.model.PlayerModel; import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.pony.ModelHumanPlayer; import com.minelittlepony.model.pony.ModelHumanPlayer;
import com.minelittlepony.model.pony.ModelPlayerPony; import com.minelittlepony.model.pony.ModelPlayerPony;
import com.minelittlepony.renderer.layer.*; import com.minelittlepony.renderer.layer.LayerEntityOnPonyShoulder;
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
import com.minelittlepony.renderer.layer.LayerPonyArmor;
import com.minelittlepony.renderer.layer.LayerPonyCape;
import com.minelittlepony.renderer.layer.LayerPonyCustomHead;
import com.minelittlepony.renderer.layer.LayerPonyElytra;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
@ -30,6 +35,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@Mixin(RenderPlayer.class) @Mixin(RenderPlayer.class)
public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony { public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony {
@ -57,7 +63,9 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
this.addLayer(new LayerArrow(this)); this.addLayer(new LayerArrow(this));
this.addLayer(new LayerPonyCape(this)); this.addLayer(new LayerPonyCape(this));
this.addLayer(new LayerPonyCustomHead(this)); this.addLayer(new LayerPonyCustomHead(this));
this.addLayer(new LayerPonyElytra((RenderPlayer) (Object) this)); this.addLayer(new LayerPonyElytra(this));
this.addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
} }
@Inject( @Inject(

View file

@ -4,7 +4,9 @@ import com.minelittlepony.renderer.HornGlowRenderer;
import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.PositionTextureVertex; import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad; import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.BufferBuilder;
import javax.annotation.Nonnull;
public class ModelHornGlow extends ModelBox { public class ModelHornGlow extends ModelBox {
@ -70,7 +72,7 @@ public class ModelHornGlow extends ModelBox {
} }
@Override @Override
public void render(VertexBuffer buffer, float par2) { public void render(@Nonnull BufferBuilder buffer, float par2) {
TexturedQuad[] var3 = this.quadList; TexturedQuad[] var3 = this.quadList;
for (TexturedQuad var6 : var3) { for (TexturedQuad var6 : var3) {
var6.draw(buffer, par2); var6.draw(buffer, par2);

View file

@ -4,7 +4,9 @@ import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.PositionTextureVertex; import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad; import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.BufferBuilder;
import javax.annotation.Nonnull;
public class ModelPlane extends ModelBox { public class ModelPlane extends ModelBox {
@ -102,7 +104,7 @@ public class ModelPlane extends ModelBox {
} }
@Override @Override
public void render(VertexBuffer renderer, float scale) { public void render(@Nonnull BufferBuilder renderer, float scale) {
this.quadList[this.face.ordinal()].draw(renderer, scale); this.quadList[this.face.ordinal()].draw(renderer, scale);
} }

View file

@ -41,7 +41,7 @@ public class ModelPonyElytra extends ModelBase {
if (entityIn.motionY < 0.0D) { if (entityIn.motionY < 0.0D) {
Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize(); Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize();
f4 = 1.0F - (float) Math.pow(-vec3d.yCoord, 1.5D); f4 = 1.0F - (float) Math.pow(-vec3d.y, 1.5D);
} }
rotateX = f4 * PI * (2 / 3F) + (1.0F - f4) * rotateX; rotateX = f4 * PI * (2 / 3F) + (1.0F - f4) * rotateX;

View file

@ -1,6 +1,7 @@
package com.minelittlepony.model; package com.minelittlepony.model;
import com.minelittlepony.model.pony.ModelHumanPlayer; import com.minelittlepony.model.pony.ModelHumanPlayer;
import com.minelittlepony.model.pony.ModelIllagerPony;
import com.minelittlepony.model.pony.ModelPlayerPony; import com.minelittlepony.model.pony.ModelPlayerPony;
import com.minelittlepony.model.pony.ModelSkeletonPony; import com.minelittlepony.model.pony.ModelSkeletonPony;
import com.minelittlepony.model.pony.ModelVillagerPony; import com.minelittlepony.model.pony.ModelVillagerPony;
@ -19,6 +20,7 @@ public final class PMAPI {
public static final PlayerModel zombie = new PlayerModel(new ModelZombiePony()).setArmor(new ZombiePonyArmors()); public static final PlayerModel zombie = new PlayerModel(new ModelZombiePony()).setArmor(new ZombiePonyArmors());
public static final PlayerModel skeleton = new PlayerModel(new ModelSkeletonPony()).setArmor(new SkeletonPonyArmors()); public static final PlayerModel skeleton = new PlayerModel(new ModelSkeletonPony()).setArmor(new SkeletonPonyArmors());
public static final PlayerModel villager = new PlayerModel(new ModelVillagerPony()).setArmor(new PonyArmors()); public static final PlayerModel villager = new PlayerModel(new ModelVillagerPony()).setArmor(new PonyArmors());
public static final PlayerModel illager = new PlayerModel(new ModelIllagerPony()).setArmor(new PonyArmors());
public static final PlayerModel human = new PlayerModel(new ModelHumanPlayer(false)).setArmor(new HumanArmors()); public static final PlayerModel human = new PlayerModel(new ModelHumanPlayer(false)).setArmor(new HumanArmors());
public static final PlayerModel humanSmall = new PlayerModel(new ModelHumanPlayer(true)).setArmor(new HumanArmors()); public static final PlayerModel humanSmall = new PlayerModel(new ModelHumanPlayer(true)).setArmor(new HumanArmors());

View file

@ -1,8 +1,6 @@
package com.minelittlepony.model; package com.minelittlepony.model;
import com.minelittlepony.PonyGender; import com.minelittlepony.PonyGender;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.renderer.PlaneRenderer; import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -18,27 +16,27 @@ public class PonySnout extends ModelBase implements PonyModelConstants {
mare = new PlaneRenderer(pony); mare = new PlaneRenderer(pony);
mare.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); mare.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
mare.setTextureOffset(10, 14).addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 2, 0, stretch); mare.setTextureOffset(10, 14).addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 2, stretch);
mare.setTextureOffset(11, 13).addBackPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, 0, stretch); mare.setTextureOffset(11, 13).addBackPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(9, 14).addTopPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch); mare.setTextureOffset(9, 14).addTopPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
mare.setTextureOffset(14, 14).addTopPlane(1.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch); mare.setTextureOffset(14, 14).addTopPlane(1.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
mare.setTextureOffset(11, 12).addTopPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 0, 1, stretch); mare.setTextureOffset(11, 12).addTopPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); mare.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 1, stretch);
mare.setTextureOffset(9, 14).addWestPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); mare.setTextureOffset(9, 14).addWestPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(14, 14).addEastPlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); mare.setTextureOffset(14, 14).addEastPlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, stretch);
mare.setTextureOffset(11, 12).addWestPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); mare.setTextureOffset(11, 12).addWestPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
mare.setTextureOffset(12, 12).addEastPlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); mare.setTextureOffset(12, 12).addEastPlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 1, stretch);
pony.bipedHead.addChild(mare); pony.bipedHead.addChild(mare);
stallion = new PlaneRenderer(pony); stallion = new PlaneRenderer(pony);
stallion.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); stallion.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
stallion.setTextureOffset(10, 13).addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 3, 0, stretch); stallion.setTextureOffset(10, 13).addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 3, stretch);
stallion.setTextureOffset(10, 13).addTopPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); stallion.setTextureOffset(10, 13).addTopPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 1, stretch);
stallion.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); stallion.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 1, stretch);
stallion.setTextureOffset(10, 13).addWestPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); stallion.setTextureOffset(10, 13).addWestPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 3, 1, stretch);
stallion.setTextureOffset(13, 13).addEastPlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); stallion.setTextureOffset(13, 13).addEastPlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 3, 1, stretch);
pony.bipedHead.addChild(stallion); pony.bipedHead.addChild(stallion);
} }

View file

@ -3,7 +3,6 @@ package com.minelittlepony.model;
import com.minelittlepony.PonyData; import com.minelittlepony.PonyData;
import com.minelittlepony.renderer.HornGlowRenderer; import com.minelittlepony.renderer.HornGlowRenderer;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped.ArmPose;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -16,6 +15,8 @@ public class UnicornHorn extends ModelBase implements PonyModelConstants {
private ModelRenderer horn; private ModelRenderer horn;
private HornGlowRenderer[] hornglow; private HornGlowRenderer[] hornglow;
private boolean usingMagic;
public UnicornHorn(AbstractPonyModel pony, float yOffset, float stretch) { public UnicornHorn(AbstractPonyModel pony, float yOffset, float stretch) {
this.pony = pony; this.pony = pony;
@ -40,7 +41,7 @@ public class UnicornHorn extends ModelBase implements PonyModelConstants {
if (data.getRace().hasHorn()) { if (data.getRace().hasHorn()) {
this.horn.render(scale); this.horn.render(scale);
if ((pony.leftArmPose != ArmPose.EMPTY || pony.rightArmPose != ArmPose.EMPTY) && data.hasMagic()) { if (usingMagic && data.hasMagic()) {
GL11.glPushAttrib(24577); GL11.glPushAttrib(24577);
disableTexture2D(); disableTexture2D();
disableLighting(); disableLighting();
@ -66,4 +67,7 @@ public class UnicornHorn extends ModelBase implements PonyModelConstants {
} }
} }
public void setUsingMagic(boolean usingMagic) {
this.usingMagic = usingMagic;
}
} }

View file

@ -1,55 +0,0 @@
package com.minelittlepony.model.pony;
import com.minelittlepony.renderer.HornGlowRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEvoker;
import org.lwjgl.opengl.GL11;
import static net.minecraft.client.renderer.GlStateManager.*;
public class ModelEvokerPony extends ModelIllagerPony {
private HornGlowRenderer[] hornglow;
public ModelEvokerPony() {
hornglow = new HornGlowRenderer[2];
for (int i = 0; i < hornglow.length; i++) {
hornglow[i] = new HornGlowRenderer(this, 60, 3);
hornglow[i].setRotationPoint(0F, 1F, -5F);
}
hornglow[0].addBox(-0.5F, -12.0F, 3F, 1, 4, 1, 0.5F);
hornglow[1].addBox(-0.5F, -12.0F, 3F, 1, 3, 1, 0.8F);
}
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
EntityEvoker evoker = (EntityEvoker) entityIn;
if (isUnicorn && evoker.isCastingSpell()) {
GL11.glPushAttrib(24577);
disableTexture2D();
disableLighting();
enableBlend();
float red = (glowColor >> 16 & 255) / 255.0F;
float green = (glowColor >> 8 & 255) / 255.0F;
float blue = (glowColor & 255) / 255.0F;
blendFunc(GL11.GL_SRC_ALPHA, 1);
this.illagerHead.postRender(scale);
this.horn.postRender(scale);
color(red, green, blue, 0.4F);
this.hornglow[0].render(scale);
color(red, green, blue, 0.2F);
this.hornglow[1].render(scale);
enableTexture2D();
enableLighting();
disableBlend();
popAttrib();
}
}
}

View file

@ -1,171 +1,76 @@
package com.minelittlepony.model.pony; package com.minelittlepony.model.pony;
import com.minelittlepony.model.PonyModelConstants;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.AbstractIllager;
import net.minecraft.util.EnumHandSide; import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
public abstract class ModelIllagerPony extends ModelBase { public class ModelIllagerPony extends ModelPlayerPony {
public boolean isUnicorn;
public int glowColor;
public ModelRenderer illagerHead;
public ModelRenderer illagerBody;
public ModelRenderer leftForeLeg;
public ModelRenderer rightForeLeg;
public ModelRenderer leftHindLeg;
public ModelRenderer rightHindLeg;
public ModelRenderer tail;
public ModelRenderer horn;
ModelIllagerPony() {
textureWidth = 64;
textureHeight = 64;
this.setTextureOffset("head.ear1", 24, 4);
this.setTextureOffset("head.ear2", 0, 4);
this.setTextureOffset("head.snuzzle.mare1", 48, 21);
this.setTextureOffset("head.snuzzle.mare2", 49, 20);
this.setTextureOffset("head.snuzzle.stallion", 48, 16);
illagerHead = new ModelRenderer(this, "head");
illagerHead.setRotationPoint(0F, 1F, -5F);
illagerHead.setTextureOffset(0, 0).addBox(-4F, -6F, -5F, 8, 8, 8);
// headwear
illagerHead.setTextureOffset(32, 0).addBox(-4F, -6F, -5F, 8, 8, 8, 0.5F);
illagerHead.addBox("ear1", 2F, -8F, 0F, 2, 2, 2);
illagerHead.addBox("ear2", -4F, -8F, 0F, 2, 2, 2);
illagerHead.addBox("snuzzle.mare1", -2F, -0F, -6F, 4, 2, 1);
illagerHead.addBox("snuzzle.mare2", -1F, -1F, -6F, 2, 1, 1);
illagerHead.addBox("snuzzle.stallion", -2F, -1F, -6F, 4, 3, 1);
horn = new ModelRenderer(this, 60, 3);
horn.addBox(-0.5F, -11.0F, -2F, 1, 4, 1);
horn.rotateAngleX = 0.5F;
this.illagerHead.addChild(horn);
ModelRenderer illagerNeck = new ModelRenderer(this, 0, 40);
illagerNeck.addBox(-2F, 0F, -6F, 4, 4, 4);
illagerNeck.rotateAngleX = PonyModelConstants.NECK_ROT_X;
illagerBody = new ModelRenderer(this);
illagerBody.setTextureOffset(0, 16).addBox(-4F, 4F, -5F, 8, 8, 16);
illagerBody.addChild(illagerNeck);
leftForeLeg = new ModelRenderer(this, 32, 16);
leftForeLeg.addBox(0F, 0F, -2F, 4, 12, 4).setRotationPoint(0F, 12F, -3F);
rightForeLeg = new ModelRenderer(this, 32, 48);
rightForeLeg.addBox(-2F, 0F, -2F, 4, 12, 4).setRotationPoint(-2F, 12F, -3F);
leftHindLeg = new ModelRenderer(this, 0, 16);
leftHindLeg.addBox(-2F, 0F, -2F, 4, 12, 4).setRotationPoint(2F, 12F, 8F);
rightHindLeg = new ModelRenderer(this, 0, 48);
rightHindLeg.addBox(-2F, 0F, -2F, 4, 12, 4).setRotationPoint(-2F, 12F, 8F);
ModelRenderer tailStub = new ModelRenderer(this, 52, 24);
tailStub.addBox(-0.5F, -1F, -0.5F, 2, 4, 2).setRotationPoint(0F, 0F, 2F);
tailStub.rotateAngleX = (float) Math.PI / -3;
this.setTextureOffset("tail.1qtr", 48, 24);
this.setTextureOffset("tail.half", 48, 32);
this.setTextureOffset("tail.3qtr", 48, 40);
this.setTextureOffset("tail.full", 48, 48);
tail = new ModelRenderer(this, "tail");
tail.setRotationPoint(0F, 4F, 11F);
tail.addBox("1qtr", -1.5F, -2F, 2F, 4, 4, 4);
tail.addBox("half", -1.5F, 2F, 2F, 4, 4, 4);
tail.addBox("3qtr", -1.5F, 6F, 2F, 4, 4, 4);
tail.addBox("full", -1.5F, 10F, 2F, 4, 4, 4);
tail.addChild(tailStub);
public ModelIllagerPony() {
super(false);
} }
@Override @Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void setRotationAngles(float swing, float move, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);
illagerHead.render(scale); super.setRotationAngles(swing, move, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
illagerBody.render(scale); AbstractIllager illager = (AbstractIllager) entityIn;
leftForeLeg.render(scale); AbstractIllager.IllagerArmPose pose = illager.func_193077_p();
rightForeLeg.render(scale);
leftHindLeg.render(scale);
rightHindLeg.render(scale);
tail.render(scale);
// mr.render(scale); boolean rightHanded = illager.getPrimaryHand() == EnumHandSide.RIGHT;
}
@Override if (pose == AbstractIllager.IllagerArmPose.ATTACKING) {
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { // vindicator attacking
float f = MathHelper.sin(this.swingProgress * (float) Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = 0.15707964F;
this.bipedLeftArm.rotateAngleY = -0.15707964F;
final float PI = (float) Math.PI; if (rightHanded) {
this.bipedRightArm.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
this.bipedRightArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
} else {
this.bipedLeftArm.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
this.bipedLeftArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
}
float headRotateAngleY = netHeadYaw * PI / 180; this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
float headRotateAngleX = headPitch * PI / 180; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
} else if (pose == AbstractIllager.IllagerArmPose.SPELLCASTING) {
if (this.metadata.hasMagic()) {
this.horn.setUsingMagic(true);
}
// waving arms!
if (rightHanded) {
// this.bipedRightArm.rotationPointZ = 0.0F;
// this.bipedRightArm.rotationPointX = -5.0F;
this.bipedRightArm.rotateAngleX = (float) (-.75F * Math.PI);
this.bipedRightArm.rotateAngleZ = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
this.bipedRightArm.rotateAngleY = 1.1F;
} else {
// this.bipedLeftArm.rotationPointZ = 0.0F;
// this.bipedLeftArm.rotationPointX = 5.0F;
this.bipedLeftArm.rotateAngleX = (float) (-.75F * Math.PI);
this.bipedLeftArm.rotateAngleZ = -MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
this.bipedLeftArm.rotateAngleY = -1.1F;
}
final float max = 0.5f; } else if (pose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) {
final float min = -1.25f; if (rightHanded) {
headRotateAngleX = Math.min(headRotateAngleX, max); aimBow(ArmPose.EMPTY, ArmPose.BOW_AND_ARROW, ageInTicks);
headRotateAngleX = Math.max(headRotateAngleX, min); } else {
this.illagerHead.rotateAngleY = headRotateAngleY; aimBow(ArmPose.BOW_AND_ARROW, ArmPose.EMPTY, ageInTicks);
this.illagerHead.rotateAngleX = headRotateAngleX; }
this.tail.rotateAngleZ = MathHelper.cos(limbSwing * 0.8F) * 0.2F * limbSwingAmount;
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * PI * 2.0F) * 0.2F;
} }
this.illagerBody.rotateAngleY = bodySwingRotation * 0.2F;
this.illagerBody.rotateAngleY = bodySwingRotation * 0.2F;
this.tail.rotateAngleY = bodySwingRotation;
this.setLegs(limbSwing, limbSwingAmount);
this.tail.rotateAngleX = 0.5F * limbSwingAmount;
this.tail.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
} }
private void setLegs(float move, float swing) { public ModelRenderer getArmForSide(EnumHandSide side) {
this.rotateLegs(move, swing); return super.getArmForSide(side);
// this.adjustLegs();
}
private void rotateLegs(float move, float swing) {
final float PI = (float) Math.PI;
float swag = (float) Math.pow(swing, 16.0D);
float raQuad = PI * swag * 0.5F;
float laQuad = PI * swag;
float rlQuad = PI * swag * 0.2F;
float llQuad = PI * swag * -0.4F;
this.rightForeLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + (float) Math.PI + raQuad) * 0.45F * swing;
this.leftForeLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;
this.rightHindLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
this.leftHindLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + PI + llQuad) * 0.45F * swing;
this.rightForeLeg.rotateAngleZ = 0.0F;
this.leftForeLeg.rotateAngleZ = 0.0F;
}
public ModelRenderer getArm(EnumHandSide side) {
return side == EnumHandSide.LEFT ? this.leftForeLeg : this.rightForeLeg;
} }
} }

View file

@ -1,6 +1,11 @@
package com.minelittlepony.model.pony; package com.minelittlepony.model.pony;
import com.minelittlepony.model.*; import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.PegasusWings;
import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.model.PonySnout;
import com.minelittlepony.model.UnicornHorn;
import com.minelittlepony.renderer.PlaneRenderer; import com.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@ -24,9 +29,9 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
public ModelRenderer unicornArmRight; public ModelRenderer unicornArmRight;
public ModelRenderer unicornArmLeft; public ModelRenderer unicornArmLeft;
public PlaneRenderer[] Tail; public PlaneRenderer[] Tail;
private PonySnout snout; public PonySnout snout;
private UnicornHorn horn; public UnicornHorn horn;
private PegasusWings wings; public PegasusWings wings;
public ModelPlayerPony(boolean smallArms) { public ModelPlayerPony(boolean smallArms) {
super(smallArms); super(smallArms);
@ -41,7 +46,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
@Override @Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor,
Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
this.checkRainboom(entityIn, limbSwingAmount); this.checkRainboom(entityIn, limbSwingAmount);
@ -165,7 +171,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
protected void checkRainboom(Entity entity, float swing) { protected void checkRainboom(Entity entity, float swing) {
boolean flying = this.metadata.getRace() != null && this.metadata.getRace().hasWings() && this.isFlying boolean flying = this.metadata.getRace().hasWings() && this.isFlying
|| entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying(); || entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying();
this.rainboom = flying && swing >= 0.9999F; this.rainboom = flying && swing >= 0.9999F;
@ -207,7 +213,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
float leftArmRotateAngleX; float leftArmRotateAngleX;
float rightLegRotateAngleX; float rightLegRotateAngleX;
float leftLegRotateAngleX; float leftLegRotateAngleX;
if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) { if (this.isFlying && this.metadata.getRace().hasWings() || entity instanceof EntityLivingBase && ((EntityLivingBase) entity)
.isElytraFlying()) {
if (this.rainboom) { if (this.rainboom) {
rightArmRotateAngleX = ROTATE_270; rightArmRotateAngleX = ROTATE_270;
leftArmRotateAngleX = ROTATE_270; leftArmRotateAngleX = ROTATE_270;
@ -381,6 +388,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.unicornArmRight.rotateAngleX = this.unicornArmRight.rotateAngleX * 0.5F - 0.9424779F; this.unicornArmRight.rotateAngleX = this.unicornArmRight.rotateAngleX * 0.5F - 0.9424779F;
} }
} }
this.horn.setUsingMagic(this.leftArmPose != ArmPose.EMPTY || this.rightArmPose != ArmPose.EMPTY);
} }
protected void swingItem(Entity entity, float swingProgress) { protected void swingItem(Entity entity, float swingProgress) {
@ -596,7 +605,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
popMatrix(); popMatrix();
} }
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch,
float scale) {
this.bipedHead.render(this.scale); this.bipedHead.render(this.scale);
this.bipedHeadwear.render(this.scale); this.bipedHeadwear.render(this.scale);
this.bipedHead.postRender(scale); this.bipedHead.postRender(scale);
@ -611,7 +621,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
} }
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch,
float scale) {
this.bipedBody.render(this.scale); this.bipedBody.render(this.scale);
if (this.textureHeight == 64) { if (this.textureHeight == 64) {
this.bipedBodyWear.render(this.scale); this.bipedBodyWear.render(this.scale);
@ -631,7 +642,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
var3 = 0; var3 = 0;
} }
// this.bipedBody.postRender(this.scale); // this.bipedBody.postRender(this.scale);
for (int k = 0; k < var3; ++k) { for (int k = 0; k < var3; ++k) {
this.Tail[k].render(this.scale); this.Tail[k].render(this.scale);
@ -640,8 +651,9 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
protected void renderLegs() { protected void renderLegs() {
if (!this.isSneak) if (!this.isSneak) {
this.bipedBody.postRender(this.scale); this.bipedBody.postRender(this.scale);
}
this.bipedLeftArm.render(this.scale); this.bipedLeftArm.render(this.scale);
this.bipedRightArm.render(this.scale); this.bipedRightArm.render(this.scale);
@ -778,42 +790,42 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedBodyWear.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch + 0.25F); this.bipedBodyWear.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch + 0.25F);
this.bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[0].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); this.Bodypiece[0].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[1].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); this.Bodypiece[1].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 12, stretch); this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 12, stretch);
this.Bodypiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 8, stretch); this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[4].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); this.Bodypiece[4].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[5].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); this.Bodypiece[5].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch); this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[7].addBackPlane(-4.0F + BODY_CENTRE_X, 0.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch); this.Bodypiece[7].addBackPlane(-4.0F + BODY_CENTRE_X, 0.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[8].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 0, 4, stretch); this.Bodypiece[8].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[9].addTopPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch); this.Bodypiece[9].addTopPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch); this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[11].addWestPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); this.Bodypiece[11].addWestPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[12].addEastPlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); this.Bodypiece[12].addEastPlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[12].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[12].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, 0, stretch); this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, stretch);
this.Bodypiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[0].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); this.BodypieceNeck[0].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[2].addWestPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); this.BodypieceNeck[2].addWestPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[3].addEastPlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); this.BodypieceNeck[3].addEastPlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[0].rotateAngleX = NECK_ROT_X; this.BodypieceNeck[0].rotateAngleX = NECK_ROT_X;
this.BodypieceNeck[1].rotateAngleX = NECK_ROT_X; this.BodypieceNeck[1].rotateAngleX = NECK_ROT_X;
@ -826,26 +838,30 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch); this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch);
this.bipedRightArm.setRotationPoint(-2.0F, 8.5F + yOffset, 0.0F); this.bipedRightArm.setRotationPoint(-2.0F, 8.5F + yOffset, 0.0F);
if (bipedRightArmwear != null) { if (bipedRightArmwear != null) {
this.bipedRightArmwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f); this.bipedRightArmwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f);
this.bipedRightArmwear.setRotationPoint(-3.0F, 8.5F + yOffset, 0.0F); this.bipedRightArmwear.setRotationPoint(-3.0F, 8.5F + yOffset, 0.0F);
} }
this.bipedLeftArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch); this.bipedLeftArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch);
this.bipedLeftArm.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F); this.bipedLeftArm.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F);
if (this.bipedLeftArmwear != null) { if (this.bipedLeftArmwear != null) {
this.bipedLeftArmwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f); this.bipedLeftArmwear
.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f);
this.bipedLeftArmwear.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F); this.bipedLeftArmwear.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F);
} }
} else { } else {
this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedRightArm.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F); this.bipedRightArm.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F);
if (bipedRightArmwear != null) { if (bipedRightArmwear != null) {
this.bipedRightArmwear.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.bipedRightArmwear
.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.bipedRightArmwear.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F); this.bipedRightArmwear.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F);
} }
this.bipedLeftArm.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); this.bipedLeftArm.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedLeftArm.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F); this.bipedLeftArm.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F);
if (this.bipedLeftArmwear != null) { if (this.bipedLeftArmwear != null) {
this.bipedLeftArmwear.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f); this.bipedLeftArmwear
.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
this.bipedLeftArmwear.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F); this.bipedLeftArmwear.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F);
} }
} }
@ -853,14 +869,16 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightLeg.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F); this.bipedRightLeg.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
if (bipedRightLegwear != null) { if (bipedRightLegwear != null) {
this.bipedRightLegwear.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.bipedRightLegwear
.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.bipedRightLegwear.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F); this.bipedRightLegwear.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
} }
this.bipedLeftLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); this.bipedLeftLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
if (this.bipedLeftLegwear != null) { 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.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.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.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.unicornArmRight.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
@ -870,47 +888,47 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
protected void initTailPositions(float yOffset, float stretch) { protected void initTailPositions(float yOffset, float stretch) {
this.Tail[0].addTopPlane(-2.0F, 1.0F, 2.0F, 4, 0, 4, stretch); this.Tail[0].addTopPlane(-2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[0].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[0].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[1].addWestPlane(-2.0F, 1.0F, 2.0F, 0, 4, 4, stretch); this.Tail[1].addWestPlane(-2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[1].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[1].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[2].addBackPlane(-2.0F, 1.0F, 2.0F, 4, 4, 0, stretch); this.Tail[2].addBackPlane(-2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[2].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[2].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[3].addEastPlane(2.0F, 1.0F, 2.0F, 0, 4, 4, stretch); this.Tail[3].addEastPlane(2.0F, 1.0F, 2.0F, 4, 4, stretch);
this.Tail[3].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[3].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[4].addBackPlane(-2.0F, 1.0F, 6.0F, 4, 4, 0, stretch); this.Tail[4].addBackPlane(-2.0F, 1.0F, 6.0F, 4, 4, stretch);
this.Tail[4].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[4].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[5].addTopPlane(-2.0F, 5.0F, 2.0F, 4, 0, 4, stretch); this.Tail[5].addTopPlane(-2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[5].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[5].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[6].addWestPlane(-2.0F, 5.0F, 2.0F, 0, 4, 4, stretch); this.Tail[6].addWestPlane(-2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[6].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[6].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[7].addBackPlane(-2.0F, 5.0F, 2.0F, 4, 4, 0, stretch); this.Tail[7].addBackPlane(-2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[7].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[7].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[8].addEastPlane(2.0F, 5.0F, 2.0F, 0, 4, 4, stretch); this.Tail[8].addEastPlane(2.0F, 5.0F, 2.0F, 4, 4, stretch);
this.Tail[8].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[8].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[9].addBackPlane(-2.0F, 5.0F, 6.0F, 4, 4, 0, stretch); this.Tail[9].addBackPlane(-2.0F, 5.0F, 6.0F, 4, 4, stretch);
this.Tail[9].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[9].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[10].addTopPlane(-2.0F, 9.0F, 2.0F, 4, 0, 4, stretch); this.Tail[10].addTopPlane(-2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[10].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[10].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[11].addWestPlane(-2.0F, 9.0F, 2.0F, 0, 4, 4, stretch); this.Tail[11].addWestPlane(-2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[11].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[11].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[12].addBackPlane(-2.0F, 9.0F, 2.0F, 4, 4, 0, stretch); this.Tail[12].addBackPlane(-2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[12].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[12].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[13].addEastPlane(2.0F, 9.0F, 2.0F, 0, 4, 4, stretch); this.Tail[13].addEastPlane(2.0F, 9.0F, 2.0F, 4, 4, stretch);
this.Tail[13].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[13].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[14].addBackPlane(-2.0F, 9.0F, 6.0F, 4, 4, 0, stretch); this.Tail[14].addBackPlane(-2.0F, 9.0F, 6.0F, 4, 4, stretch);
this.Tail[14].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[14].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[15].addTopPlane(-2.0F, 13.0F, 2.0F, 4, 0, 4, stretch); this.Tail[15].addTopPlane(-2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[15].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[15].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[16].addWestPlane(-2.0F, 13.0F, 2.0F, 0, 4, 4, stretch); this.Tail[16].addWestPlane(-2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[16].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[16].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[17].addBackPlane(-2.0F, 13.0F, 2.0F, 4, 4, 0, stretch); this.Tail[17].addBackPlane(-2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[17].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[17].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[18].addEastPlane(2.0F, 13.0F, 2.0F, 0, 4, 4, stretch); this.Tail[18].addEastPlane(2.0F, 13.0F, 2.0F, 4, 4, stretch);
this.Tail[18].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[18].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[19].addBackPlane(-2.0F, 13.0F, 6.0F, 4, 4, 0, stretch); this.Tail[19].addBackPlane(-2.0F, 13.0F, 6.0F, 4, 4, stretch);
this.Tail[19].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[19].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[20].addTopPlane(-2.0F, 17.0F, 2.0F, 4, 0, 4, stretch); this.Tail[20].addTopPlane(-2.0F, 17.0F, 2.0F, 4, 4, stretch);
this.Tail[20].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[20].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
} }

View file

@ -77,37 +77,37 @@ public class ModelVillagerPony extends ModelPlayerPony {
@Override @Override
protected void initPositions(float yOffset, float stretch) { protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch); super.initPositions(yOffset, stretch);
this.VillagerBagPiece[0].addWestPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[0].addWestPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[1].addWestPlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[1].addWestPlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[2].addWestPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[2].addWestPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[3].addWestPlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[3].addWestPlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 6, 8, stretch);
this.VillagerBagPiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[5].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[5].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[6].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[6].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[7].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[7].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 3, stretch);
this.VillagerBagPiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[8].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[8].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[9].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[9].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[10].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[10].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[11].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[11].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, stretch);
this.VillagerBagPiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[12].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, -1.0F + BODY_CENTRE_Z, 8, 0, 1, stretch); this.VillagerBagPiece[12].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, -1.0F + BODY_CENTRE_Z, 8, 1, stretch);
this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[13].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, 0.0F + BODY_CENTRE_Z, 8, 0, 1, stretch); this.VillagerBagPiece[13].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, 0.0F + BODY_CENTRE_Z, 8, 1, stretch);
this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerApron.addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 8, 10, 0, stretch); this.VillagerApron.addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 8, 10, stretch);
this.VillagerApron.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerApron.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerTrinket.addBackPlane(-2.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 4, 5, 0, stretch); this.VillagerTrinket.addBackPlane(-2.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 4, 5, stretch);
this.VillagerTrinket.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerTrinket.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
} }
} }

View file

@ -1,41 +0,0 @@
package com.minelittlepony.model.pony;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
public class ModelVindicatorPony extends ModelIllagerPony {
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
EntityVindicator vindicator = (EntityVindicator) entityIn;
if (vindicator.isAggressive()) {
float f = MathHelper.sin(this.swingProgress * (float) Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
this.rightForeLeg.rotateAngleZ = 0.0F;
this.leftForeLeg.rotateAngleZ = 0.0F;
if (((EntityLivingBase) entityIn).getPrimaryHand() == EnumHandSide.RIGHT) {
this.rightForeLeg.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
// this.leftForeLeg.rotateAngleX = -0.0F + MathHelper.cos(ageInTicks * 0.19F) * 0.5F;
this.rightForeLeg.rotateAngleX += f * 2.2F - f1 * 0.4F;
// this.leftForeLeg.rotateAngleX += f * 1.2F - f1 * 0.4F;
} else {
// this.rightForeLeg.rotateAngleX = -0.0F + MathHelper.cos(ageInTicks * 0.19F) * 0.5F;
this.leftForeLeg.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
// this.rightForeLeg.rotateAngleX += f * 1.2F - f1 * 0.4F;
this.leftForeLeg.rotateAngleX += f * 2.2F - f1 * 0.4F;
}
this.rightForeLeg.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.leftForeLeg.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.rightForeLeg.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.leftForeLeg.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
}
}
}

View file

@ -39,13 +39,9 @@ public class ModelZombiePony extends ModelPlayerPony {
this.bipedLeftLeg.rotateAngleY = 0.2F; this.bipedLeftLeg.rotateAngleY = 0.2F;
} else { } else {
var8 = (float) Math.pow(swing, 16.0D); var8 = (float) Math.pow(swing, 16.0D);
this.getClass();
var9 = 3.1415927F * var8 * 0.5F; var9 = 3.1415927F * var8 * 0.5F;
this.getClass();
float laQuad = 3.1415927F * var8; float laQuad = 3.1415927F * var8;
this.getClass();
float rlQuad = 3.1415927F * var8 * 0.2F; float rlQuad = 3.1415927F * var8 * 0.2F;
this.getClass();
float llQuad = 3.1415927F * var8 * -0.4F; float llQuad = 3.1415927F * var8 * -0.4F;
rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + var9) * 0.45F * swing; rightArmRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + var9) * 0.45F * swing;
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing; leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;

View file

@ -264,9 +264,8 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.syncLegs(); this.syncLegs();
} }
@Override public void setVisible(boolean invisible) {
public void setInvisible(boolean invisible) { super.setVisible(invisible);
super.setInvisible(invisible);
this.Bodypiece.showModel = invisible; this.Bodypiece.showModel = invisible;
extBody.showModel = invisible; extBody.showModel = invisible;
for (ModelRenderer m : extHead) { for (ModelRenderer m : extHead) {

View file

@ -14,10 +14,6 @@ public class PlaneRenderer extends ModelRenderer {
private int textureOffsetX; private int textureOffsetX;
private int textureOffsetY; private int textureOffsetY;
// public PlaneRenderer(ModelBase model, String boxNameIn) {
// super(model, boxNameIn);
// }
public PlaneRenderer(ModelBase model) { public PlaneRenderer(ModelBase model) {
super(model); super(model);
} }
@ -38,27 +34,27 @@ public class PlaneRenderer extends ModelRenderer {
this.cubeList.add(new ModelPlane(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, scale, face)); this.cubeList.add(new ModelPlane(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, scale, face));
} }
public void addTopPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) { public void addTopPlane(float offX, float offY, float offZ, int width, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.UP); this.addPlane(offX, offY, offZ, width, 0, depth, scale, Face.UP);
} }
public void addBottomPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) { public void addBottomPlane(float offX, float offY, float offZ, int width, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.DOWN); this.addPlane(offX, offY, offZ, width, 0, depth, scale, Face.DOWN);
} }
public void addWestPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) { public void addWestPlane(float offX, float offY, float offZ, int height, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.WEST); this.addPlane(offX, offY, offZ, 0, height, depth, scale, Face.WEST);
} }
public void addEastPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) { public void addEastPlane(float offX, float offY, float offZ, int height, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.EAST); this.addPlane(offX, offY, offZ, 0, height, depth, scale, Face.EAST);
} }
public void addFrontPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) { public void addFrontPlane(float offX, float offY, float offZ, int width, int height, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.NORTH); this.addPlane(offX, offY, offZ, width, height, 0, scale, Face.NORTH);
} }
public void addBackPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) { public void addBackPlane(float offX, float offY, float offZ, int width, int height, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.SOUTH); this.addPlane(offX, offY, offZ, width, height, 0, scale, Face.SOUTH);
} }
} }

View file

@ -1,53 +1,41 @@
package com.minelittlepony.renderer; package com.minelittlepony.renderer;
import com.minelittlepony.PonyData; import com.minelittlepony.model.PMAPI;
import com.minelittlepony.PonyDataSerialzier;
import com.minelittlepony.model.pony.ModelEvokerPony;
import com.minelittlepony.model.pony.ModelIllagerPony; import com.minelittlepony.model.pony.ModelIllagerPony;
import net.minecraft.client.Minecraft; import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.IResource; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.monster.EntityEvoker; import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntitySpellcasterIllager;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import java.io.IOException; public class RenderPonyEvoker extends RenderPonyMob<EntityEvoker> {
public class RenderPonyEvoker extends RenderLiving<EntityEvoker> {
private static final ResourceLocation EVOKER = new ResourceLocation("minelittlepony", "textures/entity/illager/evoker_pony.png"); private static final ResourceLocation EVOKER = new ResourceLocation("minelittlepony", "textures/entity/illager/evoker_pony.png");
public RenderPonyEvoker(RenderManager rendermanagerIn) { public RenderPonyEvoker(RenderManager rendermanagerIn) {
super(rendermanagerIn, new ModelEvokerPony(), 0.5F); super(rendermanagerIn, PMAPI.illager);
} }
@Override @Override
public void doRender(EntityEvoker entity, double x, double y, double z, float entityYaw, float partialTicks) { protected void addLayers() {
ModelIllagerPony model = (ModelIllagerPony) this.getMainModel(); this.addLayer(new LayerHeldPonyItem(this) {
public void doPonyRender(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
IResourceManager resources = Minecraft.getMinecraft().getResourceManager(); if (((EntitySpellcasterIllager) entitylivingbaseIn).func_193082_dl()) {
try { super.doPonyRender(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
model.glowColor = 0x4444aa;
model.isUnicorn = false;
IResource resource = resources.getResource(EVOKER);
if (resource.hasMetadata()) {
PonyData meta = resource.getMetadata(PonyDataSerialzier.NAME);
if (meta != null) {
model.isUnicorn = meta.hasMagic();
model.glowColor = meta.getGlowColor();
} }
} }
} catch (IOException e) {
e.printStackTrace();
}
super.doRender(entity, x, y, z, entityYaw, partialTicks); protected void translateToHand(EnumHandSide p_191361_1_) {
((ModelIllagerPony) this.getRenderer().getMainModel()).getArmForSide(p_191361_1_).postRender(0.0625F);
}
});
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityEvoker entity) { protected ResourceLocation getTexture(EntityEvoker entity) {
return EVOKER; return EVOKER;
} }

View file

@ -0,0 +1,65 @@
package com.minelittlepony.renderer;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.model.pony.ModelIllagerPony;
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityIllusionIllager;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
public class RenderPonyIllusionIllager extends RenderPonyMob<EntityIllusionIllager> {
private static final ResourceLocation TEXTURE = new ResourceLocation("minelittlepony", "textures/entity/illager/illusionist_pony.png");
public RenderPonyIllusionIllager(RenderManager renderManager) {
super(renderManager, PMAPI.illager);
}
@Override
protected void addLayers() {
this.addLayer(new LayerHeldPonyItem(this) {
public void doPonyRender(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks,
float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (((EntityIllusionIllager) entitylivingbaseIn).func_193082_dl() || ((EntityIllusionIllager) entitylivingbaseIn).func_193096_dj()) {
super.doPonyRender(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
protected void translateToHand(EnumHandSide p_191361_1_) {
((ModelIllagerPony) this.getRenderer().getMainModel()).getArmForSide(p_191361_1_).postRender(0.0625F);
}
});
}
@Override
protected ResourceLocation getTexture(EntityIllusionIllager entity) {
return TEXTURE;
}
@Override
public void doRender(EntityIllusionIllager entity, double x, double y, double z, float yaw, float partialTicks) {
if (entity.isInvisible()) {
Vec3d[] avec3d = entity.func_193098_a(partialTicks);
float f = this.handleRotationFloat(entity, partialTicks);
for (int i = 0; i < avec3d.length; ++i) {
super.doRender(entity,
x + avec3d[i].x + (double) MathHelper.cos((float) i + f * 0.5F) * 0.025D,
y + avec3d[i].y + (double) MathHelper.cos((float) i + f * 0.75F) * 0.0125D,
z + avec3d[i].z + (double) MathHelper.cos((float) i + f * 0.7F) * 0.025D,
yaw, partialTicks);
}
} else {
super.doRender(entity, x, y, z, yaw, partialTicks);
}
}
protected boolean func_193115_c(EntityIllusionIllager p_193115_1_) {
return true;
}
}

View file

@ -1,21 +1,20 @@
package com.minelittlepony.renderer; package com.minelittlepony.renderer;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.PonyGender;
import com.minelittlepony.PonyRace;
import com.minelittlepony.TailLengths;
import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.PlayerModel; import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.renderer.layer.LayerHeldPonyItem; import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
import com.minelittlepony.renderer.layer.LayerPonyArmor; import com.minelittlepony.renderer.layer.LayerPonyArmor;
import com.minelittlepony.renderer.layer.LayerPonyElytra;
import com.minelittlepony.renderer.layer.LayerPonyCustomHead; import com.minelittlepony.renderer.layer.LayerPonyCustomHead;
import com.minelittlepony.renderer.layer.LayerPonyElytra;
import com.voxelmodpack.hdskins.HDSkinManager; import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony { public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
protected PlayerModel playerModel; protected PlayerModel playerModel;
@ -24,6 +23,11 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
super(renderManager, playerModel.getModel(), 0.5F); super(renderManager, playerModel.getModel(), 0.5F);
this.playerModel = playerModel; this.playerModel = playerModel;
addLayers();
}
protected void addLayers() {
this.addLayer(new LayerPonyArmor(this)); this.addLayer(new LayerPonyArmor(this));
this.addLayer(new LayerHeldPonyItem(this)); this.addLayer(new LayerHeldPonyItem(this));
// this.addLayer(new LayerArrow(this)); // this.addLayer(new LayerArrow(this));
@ -33,7 +37,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
@Override @Override
public void doRender(T entity, double xPosition, double yPosition, double zPosition, float yaw, public void doRender(T entity, double xPosition, double yPosition, double zPosition, float yaw,
float partialTicks) { float partialTicks) {
double yOrigin = yPosition; double yOrigin = yPosition;
if (entity.isSneaking()) { if (entity.isSneaking()) {
yOrigin -= 0.125D; yOrigin -= 0.125D;
@ -47,12 +51,15 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
this.playerModel.getModel().isFlying = false; this.playerModel.getModel().isFlying = false;
this.playerModel.getModel().isSleeping = false; this.playerModel.getModel().isSleeping = false;
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH); ResourceLocation loc = getEntityTexture(entity);
this.playerModel.getModel().metadata.setGender(PonyGender.MARE); if (loc != null) {
this.playerModel.getModel().metadata.setTail(TailLengths.FULL); this.playerModel.apply(MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(loc).metadata);
}
if (MineLittlePony.getConfig().showscale) { if (MineLittlePony.getConfig().showscale) {
this.shadowSize = 0.4F; this.shadowSize = 0.4F;
} else {
this.shadowSize = 0.5F;
} }
} }
@ -61,7 +68,11 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
return playerModel; return playerModel;
} }
protected ResourceLocation getTexture(ResourceLocation res) { @Override
return HDSkinManager.INSTANCE.getConvertedSkin(res); @Nonnull
protected final ResourceLocation getEntityTexture(T entity) {
return HDSkinManager.INSTANCE.getConvertedSkin(getTexture(entity));
} }
protected abstract ResourceLocation getTexture(T entity);
} }

View file

@ -14,8 +14,8 @@ public class RenderPonyPigman extends RenderPonyMob<EntityPigZombie> {
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityPigZombie entity) { protected ResourceLocation getTexture(EntityPigZombie entity) {
return getTexture(PIGMAN); return PIGMAN;
} }
} }

View file

@ -58,8 +58,8 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
} }
@Override @Override
protected ResourceLocation getEntityTexture(Skeleton entity) { protected ResourceLocation getTexture(Skeleton entity) {
return getTexture(SKELETON); return SKELETON;
} }
public static class Stray extends RenderPonySkeleton<EntityStray> { public static class Stray extends RenderPonySkeleton<EntityStray> {
@ -70,8 +70,8 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityStray entity) { protected ResourceLocation getTexture(EntityStray entity) {
return getTexture(STRAY); return STRAY;
} }
} }
@ -82,8 +82,8 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityWitherSkeleton entity) { protected ResourceLocation getTexture(EntityWitherSkeleton entity) {
return getTexture(WITHER); return WITHER;
} }
@Override @Override

View file

@ -39,12 +39,12 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityVillager villager) { protected ResourceLocation getTexture(EntityVillager villager) {
return getTexture(getTextureForVillager(villager)); return getTextureForVillager(villager.getProfession());
} }
private ResourceLocation getTextureForVillager(EntityVillager villager) { private ResourceLocation getTextureForVillager(int profession) {
switch (villager.getProfession()) { switch (profession) {
case Villagers.FARMER: case Villagers.FARMER:
return FARMER; return FARMER;
case Villagers.LIBRARIAN: case Villagers.LIBRARIAN:

View file

@ -1,41 +1,45 @@
package com.minelittlepony.renderer; package com.minelittlepony.renderer;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.model.pony.ModelIllagerPony; import com.minelittlepony.model.pony.ModelIllagerPony;
import com.minelittlepony.model.pony.ModelVindicatorPony;
import com.minelittlepony.renderer.layer.LayerHeldPonyItem; import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityVindicator; import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.util.EnumHandSide; import net.minecraft.util.EnumHandSide;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class RenderPonyVindicator extends RenderLiving<EntityVindicator> { public class RenderPonyVindicator extends RenderPonyMob<EntityVindicator> {
private static final ResourceLocation VINDICATOR = new ResourceLocation("minelittlepony", "textures/entity/illager/vindicator_pony.png"); private static final ResourceLocation VINDICATOR = new ResourceLocation("minelittlepony", "textures/entity/illager/vindicator_pony.png");
public RenderPonyVindicator(RenderManager renderManager) { public RenderPonyVindicator(RenderManager renderManager) {
super(renderManager, new ModelVindicatorPony(), 0.5F); super(renderManager, PMAPI.illager);
}
@Override
protected void addLayers() {
this.addLayer(new LayerHeldPonyItem(this) { this.addLayer(new LayerHeldPonyItem(this) {
@Override @Override
public void doRenderLayer(EntityLivingBase vindicator, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void doPonyRender(EntityLivingBase vindicator, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks,
float netHeadYaw, float headPitch, float scale) {
if (((EntityVindicator) vindicator).isAggressive()) { if (((EntityVindicator) vindicator).isAggressive()) {
super.doRenderLayer(vindicator, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); super.doPonyRender(vindicator, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
} }
} }
@Override @Override
protected void translateToHand(EnumHandSide side) { protected void translateToHand(EnumHandSide side) {
((ModelIllagerPony) this.livingPonyEntity.getMainModel()).getArm(side).postRender(0.0625F); ((ModelIllagerPony) this.getRenderer().getMainModel()).getArmForSide(side).postRender(0.0625F);
} }
}); });
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityVindicator entity) { protected ResourceLocation getTexture(EntityVindicator entity) {
return VINDICATOR; return VINDICATOR;
} }

View file

@ -67,8 +67,8 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
} }
@Override @Override
protected ResourceLocation getEntityTexture(Zombie zombie) { protected ResourceLocation getTexture(Zombie zombie) {
return getTexture(ZOMBIE); return ZOMBIE;
} }
public static class Husk extends RenderPonyZombie<EntityHusk> { public static class Husk extends RenderPonyZombie<EntityHusk> {
@ -84,8 +84,8 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityHusk zombie) { protected ResourceLocation getTexture(EntityHusk zombie) {
return getTexture(HUSK); return HUSK;
} }
} }

View file

@ -20,12 +20,12 @@ public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager
} }
@Override @Override
protected ResourceLocation getEntityTexture(EntityZombieVillager villager) { protected ResourceLocation getTexture(EntityZombieVillager villager) {
return getTexture(getTextureForVillager(villager)); return getTextureForVillager(villager.getProfession());
} }
private ResourceLocation getTextureForVillager(EntityZombieVillager villager) { private ResourceLocation getTextureForVillager(int profession) {
switch (villager.getProfession()) { // getProfession switch (profession) { // getProfession
case Villagers.FARMER: case Villagers.FARMER:
return FARMER; // applejack return FARMER; // applejack
case Villagers.LIBRARIAN: case Villagers.LIBRARIAN:

View file

@ -0,0 +1,42 @@
package com.minelittlepony.renderer.layer;
import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase;
public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements LayerRenderer<T> {
private final RenderLivingBase<? extends T> renderer;
private LayerRenderer<T> layer;
public AbstractPonyLayer(RenderLivingBase<? extends T> renderer, LayerRenderer<T> humanLayer) {
this.renderer = renderer;
this.layer = humanLayer;
}
public final void doRenderLayer(T entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks,
float netHeadYaw, float headPitch, float scale) {
PlayerModel model = ((IRenderPony) renderer).getPony();
if (model.getModel() instanceof ModelHumanPlayer) {
// render the human layer
layer.doRenderLayer(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale);
} else {
// render the pony layer
doPonyRender(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
protected abstract void doPonyRender(T entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale);
protected RenderLivingBase<? extends T> getRenderer() {
return renderer;
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View file

@ -0,0 +1,124 @@
package com.minelittlepony.renderer.layer;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.pony.ModelPlayerPony;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelParrot;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderParrot;
import net.minecraft.client.renderer.entity.layers.LayerEntityOnShoulder;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityParrot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nullable;
import java.util.UUID;
public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<EntityPlayer> {
private final RenderManager rm;
private ShoulderEntity leftEntity;
private ShoulderEntity rightEntity;
public LayerEntityOnPonyShoulder(RenderManager rm, RenderLivingBase<AbstractClientPlayer> renderer) {
super(renderer, new LayerEntityOnShoulder(rm));
this.rm = rm;
}
public void doPonyRender(EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw,
float headPitch, float scale) {
GlStateManager.enableRescaleNormal();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
NBTTagCompound leftTag = player.func_192023_dk();
if (!leftTag.hasNoTags()) {
this.leftEntity = this.renderShoulderEntity(player, leftTag, this.leftEntity,
limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, true);
}
NBTTagCompound rightTag = player.func_192025_dl();
if (!rightTag.hasNoTags()) {
this.rightEntity =
this.renderShoulderEntity(player, rightTag, this.rightEntity,
limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, false);
}
GlStateManager.disableRescaleNormal();
}
@Nullable
private ShoulderEntity renderShoulderEntity(EntityPlayer player, NBTTagCompound tag, @Nullable ShoulderEntity shoulder,
float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale,
boolean left) {
if (shoulder == null || !shoulder.uuid.equals(tag.getUniqueId("UUID"))) {
UUID uuid = tag.getUniqueId("UUID");
Class<?> clazz = EntityList.func_192839_a(tag.getString("id"));
// this wan't an entity
if (uuid == null || clazz == null) {
return null;
}
if (clazz == EntityParrot.class) {
RenderLiving<?> renderer = new RenderParrot(this.rm);
ModelBase model = new ModelParrot();
ResourceLocation resource = RenderParrot.field_192862_a[tag.getInteger("Variant")];
shoulder = new ShoulderEntity(uuid, renderer, model, resource, clazz);
} else {
// not supported? TODO experiment with other mobs, probably will be changed by forge
return null;
}
}
shoulder.renderer.bindTexture(shoulder.resource);
GlStateManager.pushMatrix();
float f = -1.8F;
float f1 = left ? 0.2F : -0.2F;
ModelPlayerPony model = ((ModelPlayerPony)getRenderer().getMainModel());
model.transform(BodyPart.HEAD);
model.bipedHead.postRender(scale);
GlStateManager.translate(f1, f, -0.2F);
if (shoulder.clazz == EntityParrot.class) {
ageInTicks = 0.0F;
netHeadYaw = 0;
}
shoulder.model.setLivingAnimations(player, limbSwing, limbSwingAmount, partialTicks);
shoulder.model.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, player);
shoulder.model.render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.popMatrix();
return shoulder;
}
private class ShoulderEntity {
public UUID uuid;
public RenderLivingBase<? extends EntityLivingBase> renderer;
public ModelBase model;
public ResourceLocation resource;
public Class<?> clazz;
public ShoulderEntity(UUID uuid, RenderLivingBase<? extends EntityLivingBase> renderer,
ModelBase model, ResourceLocation res, Class<?> clazz) {
this.uuid = uuid;
this.renderer = renderer;
this.model = model;
this.resource = res;
this.clazz = clazz;
}
}
}

View file

@ -5,7 +5,6 @@ import com.minelittlepony.ducks.IRenderItem;
import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import com.minelittlepony.model.pony.ModelPlayerPony; import com.minelittlepony.model.pony.ModelPlayerPony;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
@ -16,33 +15,26 @@ import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerHeldItem; import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHandSide; import net.minecraft.util.EnumHandSide;
import org.lwjgl.opengl.GL14; import org.lwjgl.opengl.GL14;
import javax.annotation.Nullable;
import static net.minecraft.client.renderer.GlStateManager.*; import static net.minecraft.client.renderer.GlStateManager.*;
public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> { public class LayerHeldPonyItem extends AbstractPonyLayer<EntityLivingBase> {
protected final RenderLivingBase<? extends EntityLivingBase> livingPonyEntity;
private LayerHeldItem held;
public LayerHeldPonyItem(RenderLivingBase<? extends EntityLivingBase> livingPony) { public LayerHeldPonyItem(RenderLivingBase<? extends EntityLivingBase> livingPony) {
this.livingPonyEntity = livingPony; super(livingPony, new LayerHeldItem(livingPony));
this.held = new LayerHeldItem(livingPony);
} }
@Override @Override
public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_, public void doPonyRender(EntityLivingBase entity, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
ModelBase model = livingPonyEntity.getMainModel(); ModelBase model = getRenderer().getMainModel();
if (model instanceof ModelHumanPlayer) {
held.doRenderLayer(entity, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_,
p_177141_7_, scale);
return;
}
boolean mainRight = entity.getPrimaryHand() == EnumHandSide.RIGHT; boolean mainRight = entity.getPrimaryHand() == EnumHandSide.RIGHT;
ItemStack itemMain = entity.getHeldItemMainhand(); ItemStack itemMain = entity.getHeldItemMainhand();
ItemStack itemOff = entity.getHeldItemOffhand(); ItemStack itemOff = entity.getHeldItemOffhand();
@ -55,7 +47,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
((AbstractPonyModel) model).transform(BodyPart.LEGS); ((AbstractPonyModel) model).transform(BodyPart.LEGS);
} }
if (this.livingPonyEntity.getMainModel().isChild) { if (model.isChild) {
translate(0, 0.625, 0); translate(0, 0.625, 0);
rotate(-20, -1, 0, 0); rotate(-20, -1, 0, 0);
scale(.5, .5, .5); scale(.5, .5, .5);
@ -79,7 +71,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
boolean isUnicorn = isUnicorn(this.livingPonyEntity.getMainModel()); boolean isUnicorn = isUnicorn(this.getRenderer().getMainModel());
boolean isLeft = hand == EnumHandSide.LEFT; boolean isLeft = hand == EnumHandSide.LEFT;
if (isUnicorn) { if (isUnicorn) {
GlStateManager.translate(isLeft ? -0.6F : 0.1F, 1, -.5); GlStateManager.translate(isLeft ? -0.6F : 0.1F, 1, -.5);
@ -89,7 +81,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft); Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft);
if (isUnicorn) { if (isUnicorn) {
PonyData metadata = ((AbstractPonyModel) this.livingPonyEntity.getMainModel()).metadata; PonyData metadata = ((AbstractPonyModel) this.getRenderer().getMainModel()).metadata;
this.renderItemGlow(entity, drop, transform, hand, metadata.getGlowColor()); this.renderItemGlow(entity, drop, transform, hand, metadata.getGlowColor());
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();
@ -101,23 +93,24 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
} }
protected void translateToHand(EnumHandSide hand) { protected void translateToHand(EnumHandSide hand) {
AbstractPonyModel thePony = ((IRenderPony) this.livingPonyEntity).getPony().getModel(); AbstractPonyModel thePony = ((IRenderPony) this.getRenderer()).getPony().getModel();
if (thePony.metadata.hasMagic()) { if (thePony.metadata.hasMagic()) {
ModelPlayerPony playerModel = (ModelPlayerPony) thePony; ModelPlayerPony playerModel = (ModelPlayerPony) thePony;
ModelRenderer unicornarm = hand == EnumHandSide.LEFT ? playerModel.unicornArmLeft : playerModel.unicornArmRight; ModelRenderer unicornarm = hand == EnumHandSide.LEFT ? playerModel.unicornArmLeft : playerModel.unicornArmRight;
unicornarm.postRender(0.0625F); unicornarm.postRender(0.0625F);
} else { } else {
((ModelBiped) this.livingPonyEntity.getMainModel()).postRenderArm(0.0625F, hand); ((ModelBiped) this.getRenderer().getMainModel()).postRenderArm(0.0625F, hand);
} }
} }
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand, int glowColor) { public void renderItemGlow(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand,
int glowColor) {
// enchantments mess up the rendering // enchantments mess up the rendering
ItemStack drop2 = drop.copy(); ItemStack drop2 = drop.copy();
if (drop2.hasEffect()) if (drop2.hasEffect()) {
drop2.setTagInfo("ench", null); removeEnch(drop2.getTagCompound());
}
float red = (glowColor >> 16 & 255) / 255.0F; float red = (glowColor >> 16 & 255) / 255.0F;
float green = (glowColor >> 8 & 255) / 255.0F; float green = (glowColor >> 8 & 255) / 255.0F;
float blue = (glowColor & 255) / 255.0F; float blue = (glowColor & 255) / 255.0F;
@ -129,7 +122,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
GL14.glBlendColor(red, green, blue, alpha); GL14.glBlendColor(red, green, blue, alpha);
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
((IRenderItem)renderItem).useTransparency(true); ((IRenderItem) renderItem).useTransparency(true);
scale(1.1, 1.1, 1.1); scale(1.1, 1.1, 1.1);
@ -138,13 +131,19 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
translate(.01, -.01, -.02); translate(.01, -.01, -.02);
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT); renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
((IRenderItem)renderItem).useTransparency(false); ((IRenderItem) renderItem).useTransparency(false);
enableLighting(); enableLighting();
popMatrix(); popMatrix();
// I hate rendering // I hate rendering
} }
private void removeEnch(@Nullable NBTTagCompound tag) {
if (tag != null) {
tag.removeTag("ench");
}
}
@Override @Override
public boolean shouldCombineTextures() { public boolean shouldCombineTextures() {
return false; return false;

View file

@ -5,7 +5,6 @@ import com.minelittlepony.ForgeProxy;
import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.PlayerModel; import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import com.minelittlepony.model.pony.armor.ModelPonyArmor; import com.minelittlepony.model.pony.armor.ModelPonyArmor;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
@ -13,7 +12,6 @@ import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.client.resources.ResourcePackRepository; import net.minecraft.client.resources.ResourcePackRepository;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.EntityEquipmentSlot;
@ -23,41 +21,34 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> { public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
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<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();
private RenderLivingBase<? extends EntityLivingBase> renderer;
private LayerBipedArmor humanArmor;
private PlayerModel pony; private PlayerModel pony;
public LayerPonyArmor(RenderLivingBase<? extends EntityLivingBase> entity) { public LayerPonyArmor(RenderLivingBase<? extends EntityLivingBase> renderer) {
this.renderer = entity; super(renderer, new LayerBipedArmor(renderer));
this.humanArmor = new LayerBipedArmor(entity);
} }
@Override @Override
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void doPonyRender(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
pony = ((IRenderPony) renderer).getPony(); pony = ((IRenderPony) getRenderer()).getPony();
if (pony.getModel() instanceof ModelHumanPlayer) { renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.FEET);
humanArmor.doRenderLayer(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale); renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.LEGS);
} else { renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.CHEST);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.FEET); renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.HEAD);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.LEGS);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.CHEST);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.HEAD);
}
} }
private void renderArmor(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, private void renderArmor(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot) {
EntityEquipmentSlot armorSlot) {
ItemStack itemstack = entity.getItemStackFromSlot(armorSlot); ItemStack itemstack = entity.getItemStackFromSlot(armorSlot);
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) { if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) {
@ -77,16 +68,16 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
Tuple<ResourceLocation, Boolean> armors = getArmorTexture(entity, itemstack, armorSlot, null); Tuple<ResourceLocation, Boolean> armors = getArmorTexture(entity, itemstack, armorSlot, null);
prepareToRender((ModelPonyArmor) modelbase, armorSlot, armors.getSecond()); prepareToRender((ModelPonyArmor) modelbase, armorSlot, armors.getSecond());
this.renderer.bindTexture(armors.getFirst()); this.getRenderer().bindTexture(armors.getFirst());
if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) { if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) {
int j = itemarmor.getColor(itemstack); int color = itemarmor.getColor(itemstack);
float f7 = (j >> 16 & 255) / 255.0F; float r = (color >> 16 & 255) / 255.0F;
float f8 = (j >> 8 & 255) / 255.0F; float g = (color >> 8 & 255) / 255.0F;
float f9 = (j & 255) / 255.0F; float b = (color & 255) / 255.0F;
GlStateManager.color(f7, f8, f9, 1); GlStateManager.color(r, g, b, 1);
modelbase.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); modelbase.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
armors = getArmorTexture(entity, itemstack, armorSlot, "overlay"); armors = getArmorTexture(entity, itemstack, armorSlot, "overlay");
this.renderer.bindTexture(armors.getFirst()); this.getRenderer().bindTexture(armors.getFirst());
} }
GlStateManager.color(1, 1, 1, 1); GlStateManager.color(1, 1, 1, 1);
modelbase.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); modelbase.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
@ -97,7 +88,7 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
} }
} }
private Tuple<ResourceLocation, Boolean> getArmorTexture(EntityLivingBase entity, ItemStack itemstack, EntityEquipmentSlot slot, String type) { private Tuple<ResourceLocation, Boolean> getArmorTexture(EntityLivingBase entity, ItemStack itemstack, EntityEquipmentSlot slot, @Nullable String type) {
ItemArmor item = (ItemArmor) itemstack.getItem(); ItemArmor item = (ItemArmor) itemstack.getItem();
String texture = item.getArmorMaterial().getName(); String texture = item.getArmorMaterial().getName();
String domain = "minecraft"; String domain = "minecraft";
@ -133,7 +124,7 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
@SuppressWarnings("incomplete-switch") @SuppressWarnings("incomplete-switch")
private void prepareToRender(ModelPonyArmor model, EntityEquipmentSlot slot, boolean isPony) { private void prepareToRender(ModelPonyArmor model, EntityEquipmentSlot slot, boolean isPony) {
model.setInvisible(false); model.setVisible(false);
switch (slot) { switch (slot) {
// feet // feet
@ -177,7 +168,7 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
private void renderEnchantment(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_, 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 p_177183_6_, float p_177183_7_, float p_177183_8_, 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.getRenderer().bindTexture(ENCHANTED_ITEM_GLINT_RES);
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.depthFunc(514); GlStateManager.depthFunc(514);
GlStateManager.depthMask(false); GlStateManager.depthMask(false);
@ -208,11 +199,6 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
GlStateManager.disableBlend(); GlStateManager.disableBlend();
} }
@Override
public boolean shouldCombineTextures() {
return false;
}
private static ResourceLocation getHumanResource(String s1) { private static ResourceLocation getHumanResource(String s1) {
return HUMAN_ARMORS.computeIfAbsent(s1, ResourceLocation::new); return HUMAN_ARMORS.computeIfAbsent(s1, ResourceLocation::new);
} }
@ -233,7 +219,7 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
return pony; return pony;
} }
private static String getArmorTexture(EntityLivingBase entity, ItemStack item, String def, EntityEquipmentSlot slot, String type) { private static String getArmorTexture(EntityLivingBase entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
return ForgeProxy.getArmorTexture(entity, item, def, slot, type); return ForgeProxy.getArmorTexture(entity, item, def, slot, type);
} }

View file

@ -3,12 +3,10 @@ package com.minelittlepony.renderer.layer;
import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.PlayerModel; import com.minelittlepony.model.PlayerModel;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerCape; import net.minecraft.client.renderer.entity.layers.LayerCape;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.EntityEquipmentSlot;
@ -18,22 +16,16 @@ import javax.annotation.Nonnull;
import static net.minecraft.client.renderer.GlStateManager.*; import static net.minecraft.client.renderer.GlStateManager.*;
public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> { public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
private RenderLivingBase<? extends AbstractClientPlayer> renderer;
private LayerCape cape;
public LayerPonyCape(RenderLivingBase<? extends AbstractClientPlayer> entity) { public LayerPonyCape(RenderLivingBase<? extends AbstractClientPlayer> entity) {
renderer = entity; super(entity, new LayerCape((RenderPlayer) entity));
this.cape = new LayerCape((RenderPlayer) entity);
} }
@Override @Override
public void doRenderLayer(@Nonnull AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6, float p7, float scale) { public void doPonyRender(@Nonnull AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6, float p7, float scale) {
PlayerModel model = ((IRenderPony) renderer).getPony(); PlayerModel model = ((IRenderPony) getRenderer()).getPony();
if (model.getModel() instanceof ModelHumanPlayer) { if (clientPlayer.hasPlayerInfo() && !clientPlayer.isInvisible()
cape.doRenderLayer(clientPlayer, p2, p3, ticks, p5, p6, p7, scale);
} else if (clientPlayer.hasPlayerInfo() && !clientPlayer.isInvisible()
&& clientPlayer.isWearing(EnumPlayerModelParts.CAPE) && clientPlayer.getLocationCape() != null && clientPlayer.isWearing(EnumPlayerModelParts.CAPE) && clientPlayer.getLocationCape() != null
&& clientPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() != Items.ELYTRA) { && clientPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() != Items.ELYTRA) {
pushMatrix(); pushMatrix();
@ -70,7 +62,7 @@ public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
rotate(-f14 / 2.0F, 0.0F, 1.0F, 0.0F); rotate(-f14 / 2.0F, 0.0F, 1.0F, 0.0F);
rotate(180.0F, 0.0F, 0.0F, 1.0F); rotate(180.0F, 0.0F, 0.0F, 1.0F);
rotate(90.0F, 1.0F, 0.0F, 0.0F); rotate(90.0F, 1.0F, 0.0F, 0.0F);
this.renderer.bindTexture(clientPlayer.getLocationCape()); this.getRenderer().bindTexture(clientPlayer.getLocationCape());
model.getModel().renderCape(0.0625F); model.getModel().renderCape(0.0625F);
popMatrix(); popMatrix();
} }

View file

@ -4,13 +4,11 @@ import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.ModelPonyElytra; import com.minelittlepony.model.ModelPonyElytra;
import com.minelittlepony.model.pony.ModelHumanPlayer;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerArmorBase; import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
import net.minecraft.client.renderer.entity.layers.LayerElytra; import net.minecraft.client.renderer.entity.layers.LayerElytra;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -20,27 +18,19 @@ import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class LayerPonyElytra implements LayerRenderer<EntityLivingBase> { public class LayerPonyElytra extends AbstractPonyLayer<EntityLivingBase> {
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png"); private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");
private RenderLivingBase<?> renderPlayer;
private ModelPonyElytra modelElytra = new ModelPonyElytra(); private ModelPonyElytra modelElytra = new ModelPonyElytra();
private LayerElytra elytra;
public LayerPonyElytra(RenderLivingBase<?> rp) { public LayerPonyElytra(RenderLivingBase<?> rp) {
this.renderPlayer = rp; super(rp, new LayerElytra(rp));
this.elytra = new LayerElytra(rp);
} }
@Override @Override
public void doRenderLayer(@Nonnull EntityLivingBase entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) { public void doPonyRender(@Nonnull EntityLivingBase entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) {
AbstractPonyModel model = ((IRenderPony) this.renderPlayer).getPony().getModel(); AbstractPonyModel model = ((IRenderPony) this.getRenderer()).getPony().getModel();
if (model instanceof ModelHumanPlayer) {
this.elytra.doRenderLayer(entity, swing, swingAmount, ticks, age, yaw, head, scale);
return;
}
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
@ -51,14 +41,14 @@ public class LayerPonyElytra implements LayerRenderer<EntityLivingBase> {
AbstractClientPlayer player = (AbstractClientPlayer) entity; AbstractClientPlayer player = (AbstractClientPlayer) entity;
if (player.isPlayerInfoSet() && player.getLocationElytra() != null) { if (player.isPlayerInfoSet() && player.getLocationElytra() != null) {
this.renderPlayer.bindTexture(player.getLocationElytra()); this.getRenderer().bindTexture(player.getLocationElytra());
} else if (player.hasPlayerInfo() && player.getLocationCape() != null && player.isWearing(EnumPlayerModelParts.CAPE)) { } else if (player.hasPlayerInfo() && player.getLocationCape() != null && player.isWearing(EnumPlayerModelParts.CAPE)) {
this.renderPlayer.bindTexture(player.getLocationCape()); this.getRenderer().bindTexture(player.getLocationCape());
} else { } else {
this.renderPlayer.bindTexture(TEXTURE_ELYTRA); this.getRenderer().bindTexture(TEXTURE_ELYTRA);
} }
} else { } else {
this.renderPlayer.bindTexture(TEXTURE_ELYTRA); this.getRenderer().bindTexture(TEXTURE_ELYTRA);
} }
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
@ -68,7 +58,7 @@ public class LayerPonyElytra implements LayerRenderer<EntityLivingBase> {
this.modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale); this.modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);
if (itemstack.isItemEnchanted()) { if (itemstack.isItemEnchanted()) {
LayerArmorBase.renderEnchantedGlint(this.renderPlayer, entity, this.modelElytra, swing, swingAmount, ticks, age, yaw, head, scale); LayerArmorBase.renderEnchantedGlint(this.getRenderer(), entity, this.modelElytra, swing, swingAmount, ticks, age, yaw, head, scale);
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 938 B

View file

@ -1,6 +0,0 @@
{
"pony": {
"race": "unicorn",
"glowColor": 3730130
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 684 B