Port hdskins to mixins.

Other changes to HDSkinManager
Allow hd skins to be toggled on demand
Support small arms.
This commit is contained in:
Matthew Messinger 2016-01-19 00:34:07 -05:00
parent 15ce8e7ed0
commit 45f408cf1b
33 changed files with 371 additions and 445 deletions

View file

@ -43,16 +43,20 @@ sourceSets {
configurations.forgeGradleMc,
configurations.provided
]
main {
refMap = 'mixin.minelp.refmap.json'
}
common {
compileClasspath += files deps
}
hdskins {
compileClasspath += files deps
refMap = 'mixin.hdskins.refmap.json'
}
}
project('forge') {
apply plugin: 'net.minecraftforge.gradle.forge'
version = '0'
version = '0.0'
minecraft {
version = '1.8-11.14.3.1543'
mappings = rootProject.minecraft.mappings

View file

@ -5,7 +5,7 @@
"revision": "${revision}",
"author": "Verdana, Rene_Z, Mumfrey, JoyJoy",
"voxelCommonJarName": "voxelcommon-2.4.0.jar",
"mixinConfigs": "mixin.minelp.json",
"mixinConfigs": [ "mixin.minelp.json", "mixin.hdskins.json" ],
"description": "Mine Little Pony turns players and mobs into ponies",
"description.minelittlepony": "Mine Little Pony turns players and mobs into ponies",
"description.hdskins": "Seperate skin server for Mine Little Pony that also supports HD skins. Access via Skin Manager key binding (default: F1) in the main menu."

View file

@ -1,31 +0,0 @@
package com.voxelmodpack.hdskins;
import java.util.Map;
import com.google.common.cache.Cache;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mumfrey.liteloader.core.runtime.Obf;
import com.mumfrey.liteloader.util.PrivateFields;
import net.minecraft.client.resources.SkinManager;
public class HDPrivateFields<P, T> extends PrivateFields<P, T> {
public static PrivateFields<SkinManager, Cache<GameProfile, Map<Type, MinecraftProfileTexture>>> skinCacheLoader = new HDPrivateFields<SkinManager, Cache<GameProfile, Map<Type, MinecraftProfileTexture>>>(
SkinManager.class, HDObf.skinLoadingCache);
protected HDPrivateFields(Class<P> owner, Obf obf) {
super(owner, obf);
}
private static class HDObf extends Obf {
private static Obf skinLoadingCache = new HDObf("field_152798_f", "e", "skinCacheLoader");
protected HDObf(String seargeName, String obfName, String mcpName) {
super(seargeName, obfName, mcpName);
}
}
}

View file

@ -1,71 +0,0 @@
package com.voxelmodpack.hdskins;
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.URL;
import javax.imageio.ImageIO;
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
import com.voxelmodpack.common.runtime.PrivateFields;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
class HDSkinDownload extends Thread {
private final ThreadDownloadImageData image;
private final IImageBuffer imageBuffer;
private final String skinUrl;
private final Thread originalThread;
HDSkinDownload(ThreadDownloadImageData image, IImageBuffer imageBuffer, String url) {
this.image = image;
this.imageBuffer = imageBuffer != null ? imageBuffer : (IImageBuffer) PrivateFields.imageBuffer.get(image);
this.originalThread = PrivateFields.imageThread.get(image);
this.skinUrl = url;
}
@Override
public void run() {
Proxy proxy = Minecraft.getMinecraft().getProxy();
if (!this.tryDownload(proxy, this.skinUrl) && this.originalThread != null) {
PrivateFields.imageBuffer.set(image, imageBuffer);
this.originalThread.run();
}
}
boolean tryDownload(Proxy proxy, String strUrl) {
HttpURLConnection httpConnection = null;
try {
LiteLoaderLogger.debug("Downloading HD Skin from %s", strUrl);
URL ex = new URL(strUrl);
httpConnection = (HttpURLConnection) ex.openConnection(proxy);
httpConnection.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
httpConnection.setDoInput(true);
httpConnection.setDoOutput(false);
httpConnection.connect();
if (httpConnection.getResponseCode() / 100 == 2) {
BufferedImage image1 = ImageIO.read(httpConnection.getInputStream());
if (this.imageBuffer != null) {
image1 = this.imageBuffer.parseUserSkin(image1);
}
this.image.setBufferedImage(image1);
return true;
}
} catch (Exception var10) {
return false;
} finally {
if (httpConnection != null) {
httpConnection.disconnect();
}
}
return false;
}
}

View file

@ -4,16 +4,12 @@ import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import com.google.common.cache.Cache;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
@ -21,158 +17,89 @@ import com.mojang.authlib.minecraft.InsecureTextureException;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.util.UUIDTypeAdapter;
import com.mumfrey.liteloader.core.LiteLoader;
import com.mumfrey.liteloader.transformers.event.EventInfo;
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
import com.voxelmodpack.common.runtime.PrivateFields;
import net.minecraft.client.Minecraft;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraft.world.World;
public final class HDSkinManager {
private static String gatewayUrl = "skinmanager.voxelmodpack.com";
private static String skinUrl = "skins.voxelmodpack.com";
private static Cache<GameProfile, Map<Type, MinecraftProfileTexture>> skinsCache;
private static final Map<String, String> playerHashes = Maps.newHashMap();
private static final Map<String, Map<Type, MinecraftProfileTexture>> cachedTextures = Maps.newHashMap();
private static List<ISkinModifier> skinModifiers = Lists.newArrayList();
public static final HDSkinManager INSTANCE = new HDSkinManager();
private static final ResourceLocation LOADING = new ResourceLocation("LOADING");
private static final File skinCacheDir = new File("assets/skins");
public static void onDownloadSkin(EventInfo<ThreadDownloadImageData> e) {
ThreadDownloadImageData imageDownload = e.getSource();
if (imageDownload != null) {
String imageUrl = PrivateFields.imageUrl.get(imageDownload);
if (imageUrl != null) {
if (imageUrl.contains("optifine.net"))
return; // ignore optifine capes
String hash = FilenameUtils.getBaseName(imageUrl);
String uuid = resolvePlayerIdFromHash(hash);
if (uuid == null) {
if (!(imageDownload instanceof PreviewTexture)) {
return;
private String gatewayUrl = "skinmanager.voxelmodpack.com";
private String skinUrl = "skins.voxelmodpack.com";
private boolean enabled = true;
private Map<GameProfile, ResourceLocation> skinCache = Maps.newHashMap();
private List<ISkinModifier> skinModifiers = Lists.newArrayList();
private HDSkinManager() {}
public static Optional<ResourceLocation> getSkin(final GameProfile profile) {
return INSTANCE.getSkinLocation(profile);
}
uuid = Minecraft.getMinecraft().getSession().getPlayerID();
private Optional<ResourceLocation> getSkinLocation(final GameProfile profile) {
if (!enabled)
return Optional.absent();
ResourceLocation skin = skinCache.get(profile);
if (skin == null) {
skinCache.put(profile, LOADING);
loadTexture(profile, Type.SKIN, new SkinAvailableCallback() {
@Override
public void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) {
skinCache.put(profile, location);
}
});
return Optional.absent();
}
return skin == LOADING ? Optional.<ResourceLocation> absent() : Optional.of(skin);
}
Map<Type, MinecraftProfileTexture> textures = getCachedTexturesForId(uuid);
MinecraftProfileTexture skinTexture = textures.get(Type.SKIN);
if (skinTexture != null && skinTexture.getUrl().equals(imageUrl)) {
Thread imageThread = PrivateFields.imageThread.get(imageDownload);
if (imageThread != null) {
HDSkinDownload hdThread = new HDSkinDownload(imageDownload, new ImageBufferDownloadHD(),
getCustomSkinURLForId(uuid, imageDownload instanceof PreviewTexture));
PrivateFields.imageThread.set(imageDownload, hdThread);
hdThread.setDaemon(true);
hdThread.start();
e.cancel();
}
} else {
LiteLoaderLogger.debug("Not a skin texture!");
}
}
}
private void loadTexture(GameProfile profile, final Type type, final SkinAvailableCallback callback) {
if (profile != null && profile.getId() != null) {
String uuid = UUIDTypeAdapter.fromUUID(profile.getId());
String url = getCustomSkinURLForId(uuid, true);
// TODO use cache
final MinecraftProfileTexture texture = new MinecraftProfileTexture(url, null);
final ResourceLocation skin = new ResourceLocation("skins/" + texture.getHash());
File file1 = new File(skinCacheDir, texture.getHash().substring(0, 2));
@SuppressWarnings("unused")
File file2 = new File(file1, texture.getHash());
final IImageBuffer imagebufferdownload = new ImageBufferDownloadHD();
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(null, url,
DefaultPlayerSkin.getDefaultSkinLegacy(),
new IImageBuffer() {
public BufferedImage parseUserSkin(BufferedImage image) {
return imagebufferdownload.parseUserSkin(image);
}
private static String resolvePlayerIdFromHash(String hash) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.theWorld == null) {
return null;
public void skinAvailable() {
imagebufferdownload.skinAvailable();
if (callback != null) {
callback.skinAvailable(type, skin, texture);
}
return findPlayer(mc, hash);
}
});
}
private static String findPlayer(Minecraft mc, String hash) {
String uuid = findNetworkPlayer(mc, hash);
if (uuid == null) {
uuid = findWorldPlayers(mc.theWorld, hash);
}
if (uuid == null) {
uuid = findSkullPlayers(hash);
}
return uuid;
}
private static String findNetworkPlayer(Minecraft mc, String hash) {
Collection<NetworkPlayerInfo> playersInfo = mc.getNetHandler().getPlayerInfoMap();
// players
for (NetworkPlayerInfo player : playersInfo) {
GameProfile profile = player.getGameProfile();
Map<Type, MinecraftProfileTexture> textures = getTexturesForProfile(profile);
storeTexturesForProfile(profile, textures);
String uuid = findUUID(profile, textures, hash);
if (uuid != null)
return uuid;
}
return null;
}
private static String findWorldPlayers(World world, String hash) {
@SuppressWarnings("unchecked")
List<EntityPlayer> players = world.playerEntities;
for (EntityPlayer player : players) {
GameProfile profile = player.getGameProfile();
Map<Type, MinecraftProfileTexture> textures = getTexturesForProfile(profile);
storeTexturesForProfile(profile, textures);
String uuid = findUUID(profile, textures, hash);
if (uuid != null)
return uuid;
}
return null;
}
private static String findSkullPlayers(String hash) {
// skulls
for (Entry<GameProfile, Map<Type, MinecraftProfileTexture>> e : getSkinsCache().asMap().entrySet()) {
GameProfile profile = e.getKey();
// stupid plugineers..
if (profile.getId() == null)
continue;
Map<Type, MinecraftProfileTexture> textures = e.getValue();
storeTexturesForProfile(profile, textures);
String uuid = findUUID(profile, textures, hash);
if (uuid != null)
return uuid;
}
return null;
}
private static String findUUID(GameProfile profile, Map<?, MinecraftProfileTexture> textures, String hash) {
String uuid = playerHashes.get(hash);
for (MinecraftProfileTexture texture : textures.values()) {
if (hash.equals(texture.getHash())) {
uuid = trimUUID(profile.getId());
playerHashes.put(hash, uuid);
break;
}
}
return uuid;
}
private static void storeTexturesForProfile(GameProfile profile, Map<Type, MinecraftProfileTexture> textures) {
Map<?, ?> cached = getCachedTexturesForId(trimUUID(profile.getId()));
if (cached == null && textures != null && !textures.isEmpty()) {
LiteLoaderLogger.debug("Store textures for " + profile.getId());
cachedTextures.put(trimUUID(profile.getId()), textures);
Minecraft.getMinecraft().getTextureManager().loadTexture(skin, threaddownloadimagedata);
}
}
private static Map<Type, MinecraftProfileTexture> getTexturesForProfile(GameProfile profile) {
LiteLoaderLogger.debug("Get textures for " + profile.getId(), new Object[0]);
Map<Type, MinecraftProfileTexture> cached = getCachedTexturesForId(trimUUID(profile.getId()));
if (cached != null) {
return cached;
}
Minecraft minecraft = Minecraft.getMinecraft();
MinecraftSessionService sessionService = minecraft.getSessionService();
Map<Type, MinecraftProfileTexture> textures = null;
@ -187,56 +114,41 @@ public final class HDSkinManager {
&& profile.getId().equals(minecraft.getSession().getProfile().getId())) {
textures = sessionService.getTextures(sessionService.fillProfileProperties(profile, false), false);
}
storeTexturesForProfile(profile, textures);
return textures;
}
private static Cache<GameProfile, Map<Type, MinecraftProfileTexture>> getSkinsCache() {
if (skinsCache == null) {
// final field isn't going to change
skinsCache = HDPrivateFields.skinCacheLoader.get(Minecraft.getMinecraft().getSkinManager());
}
return skinsCache;
public void setSkinUrl(String skinUrl) {
this.skinUrl = skinUrl;
}
private static Map<Type, MinecraftProfileTexture> getCachedTexturesForId(String uuid) {
return cachedTextures.get(uuid);
public void setGatewayURL(String gatewayURL) {
this.gatewayUrl = gatewayURL;
}
private static String trimUUID(UUID uuid) {
return uuid.toString().replace("-", "");
}
public static void setSkinUrl(String skinUrl) {
HDSkinManager.skinUrl = skinUrl;
}
public static void setGatewayURL(String gatewayURL) {
gatewayUrl = gatewayURL;
}
public static String getSkinUrl() {
public String getSkinUrl() {
return String.format("http://%s/", skinUrl);
}
public static String getGatewayUrl() {
public String getGatewayUrl() {
return String.format("http://%s/", gatewayUrl);
}
public static String getCustomSkinURLForId(String uuid, boolean gateway) {
public String getCustomSkinURLForId(String uuid, boolean gateway) {
uuid = StringUtils.stripControlCodes(uuid);
return String.format("http://%s/skins/%s.png", gateway ? gatewayUrl : skinUrl, uuid);
}
public static String getCustomCloakURLForId(String uuid) {
public String getCustomCloakURLForId(String uuid) {
return String.format("http://%s/capes/%s.png", skinUrl, StringUtils.stripControlCodes(uuid));
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public static PreviewTexture getPreviewTexture(ResourceLocation skinResource, GameProfile profile) {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
Object skinTexture = textureManager.getTexture(skinResource);
ITextureObject skinTexture = textureManager.getTexture(skinResource);
if (skinTexture == null) {
Map<Type, MinecraftProfileTexture> textures = getTexturesForProfile(profile);
@ -244,7 +156,7 @@ public final class HDSkinManager {
if (skin != null) {
String url = skin.getUrl();
skinTexture = new PreviewTexture(url, DefaultPlayerSkin.getDefaultSkin(profile.getId()), new ImageBufferDownloadHD());
textureManager.loadTexture(skinResource, (ITextureObject) skinTexture);
textureManager.loadTexture(skinResource, skinTexture);
}
}
return (PreviewTexture) skinTexture;
@ -259,17 +171,14 @@ public final class HDSkinManager {
} catch (IOException var1) {
var1.printStackTrace();
}
// clear the maps, too
getSkinsCache().invalidateAll();
cachedTextures.clear();
playerHashes.clear();
}
public static void addSkinModifier(ISkinModifier modifier) {
public void addSkinModifier(ISkinModifier modifier) {
skinModifiers.add(modifier);
}
static void updateSkin(BufferedImage image, Graphics dest) {
public void convertSkin(BufferedImage image, Graphics dest) {
for (ISkinModifier skin : skinModifiers) {
skin.convertSkin(image, dest);
}

View file

@ -0,0 +1,11 @@
package com.voxelmodpack.hdskins;
import net.minecraft.client.renderer.texture.SimpleTexture;
public class HDThreadImageDownload extends SimpleTexture {
public HDThreadImageDownload() {
super(null);
}
}

View file

@ -44,7 +44,7 @@ public class ImageBufferDownloadHD implements IImageBuffer {
drawImage(48, 52, 44, 64, 52, 20, 56, 32);
// mod things
HDSkinManager.updateSkin(image, graphics);
HDSkinManager.INSTANCE.convertSkin(image, graphics);
graphics.dispose();
return image;

View file

@ -0,0 +1,34 @@
package com.voxelmodpack.hdskins.mixin;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ImageBufferDownload;
@Mixin(ImageBufferDownload.class)
public abstract class MixinImageBufferDownload implements IImageBuffer {
@Inject(method = "parseUserSkin",
require = 1,
locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "INVOKE",
shift = Shift.BEFORE,
target = "Ljava/awt/Graphics;dispose()V") )
private void update(BufferedImage image, CallbackInfo ci, BufferedImage image2, Graphics graphics) {
// convert skins from legacy server
if (image.getHeight() == 32) {
HDSkinManager.INSTANCE.convertSkin(image2, graphics);
}
}
}

View file

@ -0,0 +1,43 @@
package com.voxelmodpack.hdskins.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.google.common.base.Optional;
import com.mojang.authlib.GameProfile;
import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.util.ResourceLocation;
@Mixin(NetworkPlayerInfo.class)
public abstract class MixinPlayerInfo {
@Shadow
private GameProfile gameProfile;
@Inject(method = "hasLocationSkin",
cancellable = true,
at = @At("RETURN") )
private void hasLocationSkin(CallbackInfoReturnable<Boolean> ci) {
boolean has = ci.getReturnValueZ();
if (!has) {
// in case has no skin
ci.setReturnValue(HDSkinManager.getSkin(gameProfile).isPresent());
}
}
@Inject(method = "getLocationSkin",
cancellable = true,
at = @At("RETURN") )
private void getLocationSkin(CallbackInfoReturnable<ResourceLocation> ci) {
Optional<ResourceLocation> skin = HDSkinManager.getSkin(gameProfile);
if (skin.isPresent()) {
// set the skin
ci.setReturnValue(skin.get());
}
}
}

View file

@ -0,0 +1,37 @@
package com.voxelmodpack.hdskins.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.google.common.base.Optional;
import com.mojang.authlib.GameProfile;
import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
@Mixin(TileEntitySkullRenderer.class)
public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer {
@Inject(method = "renderSkull",
require = 1,
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
ordinal = 4,
shift = Shift.AFTER) )
private void onBindTexture(float x, float y, float z, EnumFacing facing, float rotation, int meta, GameProfile profile, int p_180543_8_,
CallbackInfo ci) {
if (profile != null) {
Optional<ResourceLocation> skin = HDSkinManager.getSkin(profile);
if (skin.isPresent())
// rebind
bindTexture(skin.get());
}
}
}

View file

@ -1,28 +0,0 @@
{
"obfuscation": {
"classes": [
{ "id": "ThreadDownloadImageData", "mcp": "net.minecraft.client.renderer.ThreadDownloadImageData", "obf": "ctq"},
{ "id": "HDSkinManager", "mcp": "com.voxelmodpack.hdskins.HDSkinManager" }
],
"methods": [
{ "id": "loadTextureFromServer", "mcp": "loadTextureFromServer", "srg": "func_152433_a", "obf": "d" }
]
},
"descriptors": [
{ "id": "start", "owner": "java.lang.Thread", "name": "start", "return": "VOID", "args": [] },
{ "id": "loadTextureFromServer", "owner": "${ThreadDownloadImageData}", "name": "${loadTextureFromServer}", "return": "VOID", "args": [] },
{ "id": "onDownloadSkin", "owner": "${HDSkinManager}", "name": "onDownloadSkin" }
],
"events": [
{
"name": "onDownloadSkin",
"cancellable": "true",
"injections": [{
"type": "INVOKE",
"method": "${loadTextureFromServer}",
"target": "${start}"
}],
"listeners": [ "${onDownloadSkin}" ]
}
]
}

View file

@ -0,0 +1,9 @@
{
"package": "com.voxelmodpack.hdskins.mixin",
"refmap": "mixin.hdskins.refmap.json",
"mixins": [
"MixinImageBufferDownload",
"MixinPlayerInfo",
"MixinSkullRenderer"
]
}

View file

@ -83,13 +83,14 @@ public class MineLittlePony implements InitCompleteListener {
@Override
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
if (this.config.getHd().get()) {
HDSkinManager.clearSkinCache();
HDSkinManager.setSkinUrl(SKIN_SERVER_URL);
HDSkinManager.setGatewayURL(GATEWAY_URL);
HDSkinManager.addSkinModifier(new PonySkinModifier());
HDSkinManager manager = HDSkinManager.INSTANCE;
manager.setSkinUrl(config.skinfix ? GATEWAY_URL : SKIN_SERVER_URL);
manager.setGatewayURL(GATEWAY_URL);
manager.addSkinModifier(new PonySkinModifier());
MineLPLogger.info("Set MineLP skin server URL.");
}
RenderManager rm = minecraft.getRenderManager();
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
if (this.config.getVillagers().get()) {
@ -127,6 +128,7 @@ public class MineLittlePony implements InitCompleteListener {
if (pressed || skins) {
minecraft.displayGuiScreen(new GuiSkinsMineLP(ponyManager));
}
HDSkinManager.INSTANCE.setEnabled(config.getHd().get());
}
public PonyManager getManager() {

View file

@ -103,11 +103,7 @@ public class Pony {
return player.capabilities.isFlying || !(player.onGround || player.isOnLadder() || player.isInWater());
}
public PlayerModel getModel() {
return getModel(false);
}
public PlayerModel getModel(boolean ignorePony) {
public PlayerModel getModel(boolean ignorePony, boolean smallArms) {
boolean is_a_pony = false;
switch (ignorePony ? PonyLevel.BOTH : config.getPonyLevel().get()) {
case HUMANS:
@ -122,9 +118,9 @@ public class Pony {
PlayerModel model;
if (is_a_pony) {
model = PMAPI.pony;
model = smallArms ? PMAPI.ponySmall : PMAPI.pony;
} else {
model = PMAPI.human;
model = smallArms ? PMAPI.humanSmall : PMAPI.human;
}
return model;
}

View file

@ -31,6 +31,8 @@ public class PonyConfig implements AdvancedExposable {
private Value<Boolean> pigzombies = new Value<Boolean>(true);
@Expose
private Value<Boolean> skeletons = new Value<Boolean>(true);
@Expose
public boolean skinfix = true;
public Value<PonyLevel> getPonyLevel() {
if (ponylevel.get() == null)

View file

@ -21,7 +21,8 @@ public class RenderPonyModel extends RenderPlayerModel {
EntityPlayerModel playerModelEntity = (EntityPlayerModel) par1EntityLivingBase;
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(this.getEntityTexture(playerModelEntity));
thePony.checkSkin();
PlayerModel pm = thePony.getModel(true);
// TODO small arms
PlayerModel pm = thePony.getModel(true, false);
this.mainModel = pm.getModel();
pm.apply(thePony.metadata);
this.mainModel.render(par1EntityLivingBase, par2, par3, par4, par5, par6, par7);

View file

@ -4,6 +4,7 @@ import static net.minecraft.client.renderer.GlStateManager.scale;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@ -34,6 +35,8 @@ import net.minecraft.util.ResourceLocation;
@Mixin(RenderPlayer.class)
public abstract class MixinRenderPlayer extends RendererLivingEntity implements IRenderPony {
@Shadow
private boolean smallArms;
private PlayerModel playerModel;
private Pony thePony;
@ -41,9 +44,11 @@ public abstract class MixinRenderPlayer extends RendererLivingEntity implements
super(renderManager, null, 0.5F);
}
@Inject(method="<init>(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V", at=@At("RETURN"))
@Inject(
method = "<init>(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V",
at = @At("RETURN") )
private void init(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) {
this.playerModel = PMAPI.pony;
this.playerModel = smallArms ? PMAPI.ponySmall : PMAPI.pony;
this.mainModel = this.playerModel.getModel();
this.shadowSize = this.playerModel.getShadowsize();
this.layerRenderers.clear();
@ -77,7 +82,7 @@ public abstract class MixinRenderPlayer extends RendererLivingEntity implements
this.playerModel.getModel().isFlying = thePony.isPegasusFlying(player);
if (MineLittlePony.getConfig().getShowScale().get()) {
if (this.playerModel != PMAPI.human) {
if (this.playerModel.getModel().metadata.getRace() != null) {
PonySize size = thePony.metadata.getSize();
if (size == PonySize.FOAL)
this.shadowSize = 0.25F;
@ -110,7 +115,7 @@ public abstract class MixinRenderPlayer extends RendererLivingEntity implements
this.playerModel.getModel().heldItemRight = 0;
}
@Inject(method = "renderLivingAt", at = @At("RETURN"))
@Inject(method = "renderLivingAt", at = @At("RETURN") )
private void setupPlayerScale(AbstractClientPlayer player, double xPosition, double yPosition, double zPosition, CallbackInfo ci) {
if (MineLittlePony.getConfig().getShowScale().get() && !(playerModel.getModel() instanceof ModelHumanPlayer)) {
@ -133,8 +138,9 @@ public abstract class MixinRenderPlayer extends RendererLivingEntity implements
}
private PlayerModel getModel(AbstractClientPlayer player) {
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
return thePony.getModel();
ResourceLocation skin = getEntityTexture(player);
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(skin);
return thePony.getModel(false, this.smallArms);
}
@Override

View file

@ -6,8 +6,6 @@ import static net.minecraft.client.renderer.GlStateManager.translate;
import java.util.List;
import com.brohoof.minelittlepony.MineLittlePony;
import com.brohoof.minelittlepony.Pony;
import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.part.IPonyPart;
@ -16,13 +14,11 @@ import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.item.EnumAction;
@ -31,6 +27,12 @@ import net.minecraft.item.ItemStack;
public abstract class AbstractPonyModel extends ModelPlayer {
protected float scale = 0.0625F;
public ModelRenderer steveLeftArm;
public ModelRenderer steveRightArm;
public ModelRenderer steveLeftArmwear;
public ModelRenderer steveRightArmwear;
public boolean isArmour = false;
public boolean isVillager;
public boolean isFlying;
@ -40,8 +42,12 @@ public abstract class AbstractPonyModel extends ModelPlayer {
protected List<IPonyPart> modelParts = Lists.newArrayList();
public AbstractPonyModel() {
super(0, false);
public AbstractPonyModel(boolean arms) {
super(0, arms);
this.steveLeftArm = this.bipedLeftArm;
this.steveRightArm = this.bipedRightArm;
this.steveLeftArmwear = this.bipedLeftArmwear;
this.steveRightArmwear = this.bipedLeftArmwear;
}
public final void init(float yOffset, float stretch) {
@ -85,44 +91,15 @@ public abstract class AbstractPonyModel extends ModelPlayer {
}
@Override
public final void renderRightArm() {
// Use the human model
PMAPI.human.getModel().renderModelRightArm();
public void renderRightArm() {
this.steveRightArm.render(0.0625F);
this.steveRightArmwear.render(0.0625F);
}
@Override
public final void renderLeftArm() {
// Use the human model
PMAPI.human.getModel().renderModelLeftArm();
}
@Override
public final void setRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity ent) {
// set the angles for the humans in preparation for arm rendering
// Comes from RenderPlayer.render[Left|Right]Arm?
if (PMAPI.human.getModel() != this
&& Thread.currentThread().getStackTrace()[2].getClassName().equals(RenderPlayer.class.getName())) {
PMAPI.human.getModel().setModelVisibilities((AbstractClientPlayer) ent);
PMAPI.human.getModel().isSneak = isSneak;
PMAPI.human.getModel().swingProgress = swingProgress;
PMAPI.human.getModel().setModelRotationAngles(f1, f2, f3, f4, f5, f6, ent);
// override default skin
Pony pony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry((AbstractClientPlayer) ent);
Minecraft.getMinecraft().getTextureManager().bindTexture(pony.getTextureResourceLocation());
}
setModelRotationAngles(f1, f2, f3, f4, f5, f6, ent);
}
protected void renderModelRightArm() {
super.renderRightArm();
}
protected void renderModelLeftArm() {
super.renderLeftArm();
}
protected void setModelRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity ent) {
super.setRotationAngles(f1, f2, f3, f4, f5, f6, ent);
public void renderLeftArm() {
this.steveLeftArm.render(0.0625f);
this.steveLeftArmwear.render(0.0625f);
}
protected void setModelVisibilities(AbstractClientPlayer clientPlayer) {

View file

@ -14,11 +14,13 @@ import com.brohoof.minelittlepony.model.pony.armor.ZombiePonyArmors;
public final class PMAPI {
public static final PlayerModel pony = new PlayerModel(new ModelPlayerPony()).setArmor(new PonyArmors());
public static final PlayerModel pony = new PlayerModel(new ModelPlayerPony(false)).setArmor(new PonyArmors());
public static final PlayerModel ponySmall = new PlayerModel(new ModelPlayerPony(true)).setArmor(new PonyArmors());
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 villager = new PlayerModel(new ModelVillagerPony()).setArmor(new PonyArmors());
public static final PlayerModel human = new PlayerModel(new ModelHumanPlayer()).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 void init() {
for (Field field : PMAPI.class.getFields()) {

View file

@ -9,6 +9,10 @@ public class ModelHumanPlayer extends AbstractPonyModel {
public ModelRenderer bipedEars;
public ModelRenderer cloak;
public ModelHumanPlayer(boolean smallArms) {
super(smallArms);
}
@Override
protected boolean doCancelRender() {
return true;

View file

@ -24,17 +24,19 @@ import net.minecraft.util.MathHelper;
public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConstants {
private final boolean smallArms;
public boolean rainboom;
public ModelRenderer bipedCape;
public PlaneRenderer[] Bodypiece;
public PlaneRenderer[] BodypieceNeck;
public ModelRenderer SteveArm;
public ModelRenderer unicornarm;
public PlaneRenderer[] Tail;
public ModelPlayerPony() {
public ModelPlayerPony(boolean smallArms) {
super(smallArms);
this.smallArms = smallArms;
addParts();
}
@ -62,7 +64,6 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.Bodypiece[k1].rotateAngleY = bodySwingRotation * 0.2F;
}
for (k1 = 0; k1 < this.BodypieceNeck.length; ++k1) {
this.BodypieceNeck[k1].rotateAngleY = bodySwingRotation * 0.2F;
}
@ -193,7 +194,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
leftLegRotateAngleX = MathHelper.sin(swing * 0.5F);
}
this.SteveArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
@ -209,7 +210,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
leftArmRotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.SteveArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.bipedRightArm.rotateAngleY = 0.0F;
@ -219,7 +220,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.SteveArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
@ -227,7 +228,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.SteveArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
}
@ -237,7 +238,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
float cosBodyRotateAngleYFactor = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
float legOutset = 4.0F;
if (this.isSneak && !this.isFlying) {
legOutset = 0.0F;
legOutset = smallArms ? 1.0F : 0F;
}
if (this.isSleeping) {
@ -246,17 +247,17 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
if (this.rainboom) {
this.bipedRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F;
this.SteveArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F;
this.steveRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F;
this.bipedLeftArm.rotationPointZ = 0.0F - sinBodyRotateAngleYFactor + 2.0F;
} else {
this.bipedRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 1.0F;
this.SteveArm.rotationPointZ = sinBodyRotateAngleYFactor + 1.0F;
this.steveRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 1.0F;
this.bipedLeftArm.rotationPointZ = 0.0F - sinBodyRotateAngleYFactor + 1.0F;
}
this.SteveArm.rotationPointX = 0.0F - cosBodyRotateAngleYFactor;
this.steveRightArm.rotationPointX = 0.0F - cosBodyRotateAngleYFactor;
this.bipedRightArm.rotationPointX = 0.0F - cosBodyRotateAngleYFactor - 1.0F + legOutset;
this.bipedLeftArm.rotationPointX = cosBodyRotateAngleYFactor + 1.0F - legOutset;
this.bipedLeftArm.rotationPointX = cosBodyRotateAngleYFactor + 2.0F - legOutset;
this.bipedRightLeg.rotationPointX = 0.0F - cosBodyRotateAngleYFactor - 1.0F + legOutset;
this.bipedLeftLeg.rotationPointX = cosBodyRotateAngleYFactor + 1.0F - legOutset;
@ -302,7 +303,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
protected void holdItem() {
if (this.heldItemRight != 0 && !this.rainboom && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) {
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.3141593F;
this.SteveArm.rotateAngleX = this.SteveArm.rotateAngleX * 0.5F - 0.3141593F;
this.steveRightArm.rotateAngleX = this.steveRightArm.rotateAngleX * 0.5F - 0.3141593F;
}
}
@ -323,9 +324,9 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArm.rotateAngleX = (float) (this.bipedRightArm.rotateAngleX - (f22 * 1.2D + f33));
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.bipedRightArm.rotateAngleZ = f28 * -0.4F;
this.SteveArm.rotateAngleX = (float) (this.SteveArm.rotateAngleX - (f22 * 1.2D + f33));
this.SteveArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.SteveArm.rotateAngleZ = f28 * -0.4F;
this.steveRightArm.rotateAngleX = (float) (this.steveRightArm.rotateAngleX - (f22 * 1.2D + f33));
this.steveRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.steveRightArm.rotateAngleZ = f28 * -0.4F;
}
}
@ -341,8 +342,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} else {
this.bipedRightArm.rotateAngleZ += cosTickFactor;
this.bipedRightArm.rotateAngleX += sinTickFactor;
this.SteveArm.rotateAngleZ += cosTickFactor;
this.SteveArm.rotateAngleX += sinTickFactor;
this.steveRightArm.rotateAngleZ += cosTickFactor;
this.steveRightArm.rotateAngleX += sinTickFactor;
}
}
@ -376,7 +377,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
}
protected void sneakLegs() {
this.SteveArm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.steveRightArm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornarm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
@ -713,7 +714,6 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
if (this.textureHeight == 64) {
this.bipedLeftArm = new ModelRenderer(this, 32, 48);
this.bipedLeftLeg = new ModelRenderer(this, 16, 48);
@ -722,15 +722,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedLeftArmwear = new ModelRenderer(this, 48, 48);
this.bipedLeftLegwear = new ModelRenderer(this, 0, 48);
} else {
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
}
this.SteveArm = new ModelRenderer(this, 40, 16).setTextureSize(64, 64);
this.unicornarm = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.boxList.remove(this.SteveArm);
this.boxList.remove(this.steveRightArm);
this.boxList.remove(this.unicornarm);
}
@ -824,6 +819,20 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
}
protected void initLegPositions(float yOffset, float stretch) {
if (this.smallArms) {
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);
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.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.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F);
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.setRotationPoint(3.0F, 8.5F + yOffset, 0.0F);
}
} 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.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F);
if (bipedRightArmwear != null) {
@ -836,6 +845,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedLeftArmwear.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.bipedLeftArmwear.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F);
}
}
this.bipedRightLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedRightLeg.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
@ -849,8 +859,6 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
if (this.bipedLeftLegwear != null) {
this.bipedLeftLegwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
}
this.SteveArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, stretch);
this.SteveArm.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
this.unicornarm.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornarm.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
}

View file

@ -9,6 +9,10 @@ import net.minecraft.util.MathHelper;
public class ModelSkeletonPony extends ModelPlayerPony {
public ModelSkeletonPony() {
super(false);
}
@Override
protected void rotateLegs(float move, float swing, float tick) {
float rightArmRotateAngleX;
@ -31,7 +35,7 @@ public class ModelSkeletonPony extends ModelPlayerPony {
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.SteveArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
@ -50,7 +54,7 @@ public class ModelSkeletonPony extends ModelPlayerPony {
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.6F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.6F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.SteveArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
@ -58,13 +62,13 @@ public class ModelSkeletonPony extends ModelPlayerPony {
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.SteveArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = rightArmRotateAngleX;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.SteveArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.heldItemRight != 0) {

View file

@ -13,6 +13,10 @@ public class ModelVillagerPony extends ModelPlayerPony {
public int profession;
public ModelVillagerPony() {
super(false);
}
@Override
public void animate(AniParams aniparams) {
super.animate(aniparams);

View file

@ -6,6 +6,10 @@ import net.minecraft.util.MathHelper;
public class ModelZombiePony extends ModelPlayerPony {
public ModelZombiePony() {
super(false);
}
@Override
protected void rotateLegs(float move, float swing, float tick) {
float rightArmRotateAngleX;
@ -29,7 +33,7 @@ public class ModelZombiePony extends ModelPlayerPony {
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.SteveArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
@ -48,7 +52,7 @@ public class ModelZombiePony extends ModelPlayerPony {
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.SteveArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
@ -56,13 +60,13 @@ public class ModelZombiePony extends ModelPlayerPony {
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.SteveArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.SteveArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.heldItemRight == 0) {

View file

@ -6,8 +6,8 @@ import com.brohoof.minelittlepony.model.pony.ModelHumanPlayer;
public class HumanArmors extends AbstractArmor {
public HumanArmors() {
this.modelArmorChestplate = new ModelHumanPlayer();
this.modelArmor = new ModelHumanPlayer();
this.modelArmorChestplate = new ModelHumanPlayer(false);
this.modelArmor = new ModelHumanPlayer(false);
}
}

View file

@ -16,6 +16,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
public ModelRenderer[] extLegs;
public ModelPonyArmor() {
super(false);
this.isArmour = true;
this.textureHeight = 32;
}
@ -194,7 +195,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.SteveArm = new ModelRenderer(this, 0, 16);
this.steveRightArm = new ModelRenderer(this, 0, 16);
this.unicornarm = new ModelRenderer(this, 0, 16);
this.extLegs[0] = new ModelRenderer(this, 48, 8);
this.extLegs[1] = new ModelRenderer(this, 48, 8);

View file

@ -28,7 +28,7 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.SteveArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
@ -43,7 +43,7 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.6F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.6F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.SteveArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
@ -51,13 +51,13 @@ public class ModelSkeletonPonyArmor extends ModelPonyArmor {
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.SteveArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.SteveArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.heldItemRight != 0) {

View file

@ -28,7 +28,7 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
}
this.bipedRightArm.rotateAngleY = 0.2F;
this.SteveArm.rotateAngleY = 0.2F;
this.steveRightArm.rotateAngleY = 0.2F;
this.bipedLeftArm.rotateAngleY = -0.2F;
this.bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F;
@ -43,7 +43,7 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
rightLegRotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
leftLegRotateAngleX = MathHelper.cos(move * 0.6662F + 3.1415927F + llQuad) * 0.45F * swing;
this.bipedRightArm.rotateAngleY = 0.0F;
this.SteveArm.rotateAngleY = 0.0F;
this.steveRightArm.rotateAngleY = 0.0F;
this.unicornarm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
@ -51,13 +51,13 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
}
this.bipedRightArm.rotateAngleX = rightArmRotateAngleX;
this.SteveArm.rotateAngleX = rightArmRotateAngleX;
this.steveRightArm.rotateAngleX = rightArmRotateAngleX;
this.unicornarm.rotateAngleX = 0.0F;
this.bipedLeftArm.rotateAngleX = leftArmRotateAngleX;
this.bipedRightLeg.rotateAngleX = rightLegRotateAngleX;
this.bipedLeftLeg.rotateAngleX = leftLegRotateAngleX;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.SteveArm.rotateAngleZ = 0.0F;
this.steveRightArm.rotateAngleZ = 0.0F;
this.unicornarm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (this.heldItemRight == 0) {

View file

@ -6,7 +6,6 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
import com.brohoof.minelittlepony.renderer.IRenderPony;
@ -43,7 +42,7 @@ public class LayerHeldPonyItem implements LayerRenderer {
public void doRenderLayer(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) {
PlayerModel pony = ((IRenderPony) livingPonyEntity).getPony();
if (pony == PMAPI.human) {
if (pony.getModel().metadata.getRace() == null) {
held.doRenderLayer(entity, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_,
p_177141_7_, scale);
return;

View file

@ -3,7 +3,6 @@ package com.brohoof.minelittlepony.renderer.layer;
import static net.minecraft.client.renderer.GlStateManager.*;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.model.PlayerModel;
import com.brohoof.minelittlepony.renderer.IRenderPony;
@ -35,7 +34,7 @@ public class LayerPonyCape implements LayerRenderer {
public void doRenderLayer(AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6,
float p7, float scale) {
PlayerModel model = ((IRenderPony) renderer).getPony();
if (model == PMAPI.human) {
if (model.getModel().metadata.getRace() == null) {
cape.doRenderLayer(clientPlayer, p2, p3, ticks, p5, p6, p7, scale);
} else if (clientPlayer.hasPlayerInfo() && !clientPlayer.isInvisible()
&& clientPlayer.isWearing(EnumPlayerModelParts.CAPE) && clientPlayer.getLocationCape() != null) {

View file

@ -7,7 +7,7 @@ minelp.options.ponylevel.ponies=Ponies Only
minelp.options.ponylevel.humans=Humans Only
minelp.options.ponylevel.both=Both
minelp.options.options=Pony Options
minelp.options.hd=Enable MineLP skin server (requries restart)
minelp.options.hd=Enable MineLP skin server
minelp.options.sizes=Allow all different sizes of pony
minelp.options.snuzzles=Display snuzzles on ponies
minelp.options.showscale=Use show-accurate scaling

View file

@ -9,7 +9,7 @@ minelp.options.ponylevel.ponies=Seuls Poneys
minelp.options.ponylevel.humans=Seuls Humains
minelp.options.ponylevel.both=Deux
minelp.options.options=Options Poney
minelp.options.hd=Activer MineLP serveur de skin (nécessite un redémarrage)
minelp.options.hd=Activer MineLP serveur de skin
minelp.options.sizes=Autoriser tous les différentes tailles de poney
minelp.options.ponyarmor=Utiliser armure compatible de MineLP
minelp.options.snuzzles=Afficher museau sur les poneys

View file

@ -6,7 +6,7 @@ minelp.options.ponylevel.ponies=Только пони
minelp.options.ponylevel.humans=Только люди
minelp.options.ponylevel.both=И то и другое
minelp.options.options=Опции
minelp.options.hd=Включить Mine Little Pony скин-сервер (требуется перезапуск)
minelp.options.hd=Включить Mine Little Pony скин-сервер
minelp.options.sizes=Разрешить пони разных размеров и расс
minelp.options.ponyarmor=Использовать текстуры брони совместимые с модом
minelp.options.snuzzles=Показывать объёмные носы