fix nullables and formatting

This commit is contained in:
Matthew Messinger 2017-06-12 23:55:50 -04:00
parent a411969a98
commit 370e8e3af3
25 changed files with 138 additions and 92 deletions

View file

@ -8,10 +8,8 @@ import com.google.common.collect.Maps;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.InsecureTextureException;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import com.mojang.util.UUIDTypeAdapter; import com.mojang.util.UUIDTypeAdapter;
import com.mumfrey.liteloader.core.LiteLoader; import com.mumfrey.liteloader.core.LiteLoader;
@ -31,7 +29,7 @@ import org.apache.commons.io.FileUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.awt.*; import java.awt.Graphics;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -114,7 +112,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
} }
private void loadTexture(GameProfile profile, final Type type, final SkinAvailableCallback callback) { private void loadTexture(GameProfile profile, final Type type, final SkinAvailableCallback callback) {
if (profile != null && profile.getId() != null) { if (profile.getId() != null) {
Map<Type, MinecraftProfileTexture> data = loadProfileData(profile); Map<Type, MinecraftProfileTexture> data = loadProfileData(profile);
final MinecraftProfileTexture texture = data.get(type); final MinecraftProfileTexture texture = data.get(type);
if (texture == null) { if (texture == null) {
@ -143,10 +141,8 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
if (imagebufferdownload != null) { if (imagebufferdownload != null) {
imagebufferdownload.skinAvailable(); imagebufferdownload.skinAvailable();
} }
if (callback != null) {
callback.skinAvailable(type, skin, texture); callback.skinAvailable(type, skin, texture);
} }
}
}); });
// schedule texture loading on the main thread. // schedule texture loading on the main thread.
@ -179,26 +175,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
}); });
} }
private static Map<Type, MinecraftProfileTexture> getTexturesForProfile(GameProfile profile) {
LiteLoaderLogger.debug("Get textures for " + profile.getId());
Minecraft minecraft = Minecraft.getMinecraft();
MinecraftSessionService sessionService = minecraft.getSessionService();
Map<Type, MinecraftProfileTexture> textures;
try {
textures = sessionService.getTextures(profile, true);
} catch (InsecureTextureException var6) {
textures = sessionService.getTextures(profile, false);
}
if ((textures == null || textures.isEmpty())
&& profile.getId().equals(minecraft.getSession().getProfile().getId())) {
textures = sessionService.getTextures(sessionService.fillProfileProperties(profile, false), false);
}
return textures;
}
public void setSkinUrl(String skinUrl) { public void setSkinUrl(String skinUrl) {
this.skinUrl = skinUrl; this.skinUrl = skinUrl;
} }

View file

@ -3,6 +3,7 @@ package com.voxelmodpack.hdskins;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@FunctionalInterface
public interface ISkinModifier { public interface ISkinModifier {
void convertSkin(BufferedImage skin, Graphics dest); void convertSkin(BufferedImage skin, Graphics dest);

View file

@ -2,6 +2,7 @@ package com.voxelmodpack.hdskins;
import net.minecraft.client.renderer.IImageBuffer; import net.minecraft.client.renderer.IImageBuffer;
import javax.annotation.Nullable;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -12,8 +13,9 @@ public class ImageBufferDownloadHD implements IImageBuffer {
private BufferedImage image; private BufferedImage image;
@Override @Override
@SuppressWarnings("SuspiciousNameCombination") @Nullable
public BufferedImage parseUserSkin(BufferedImage downloadedImage) { @SuppressWarnings({"SuspiciousNameCombination", "NullableProblems"})
public BufferedImage parseUserSkin(@Nullable BufferedImage downloadedImage) {
if (downloadedImage == null) { if (downloadedImage == null) {
return null; return null;
} }

View file

@ -4,11 +4,13 @@ import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData; import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import javax.annotation.Nullable;
public class PreviewTexture extends ThreadDownloadImageData { public class PreviewTexture extends ThreadDownloadImageData {
private boolean uploaded; private boolean uploaded;
public PreviewTexture(String url, ResourceLocation fallbackTexture, IImageBuffer imageBuffer) { public PreviewTexture(String url, ResourceLocation fallbackTexture, @Nullable IImageBuffer imageBuffer) {
super(null, url, fallbackTexture, imageBuffer); super(null, url, fallbackTexture, imageBuffer);
} }

View file

@ -11,6 +11,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@FunctionalInterface
public interface FileDropListener extends DropTargetListener { public interface FileDropListener extends DropTargetListener {
@Override @Override

View file

@ -51,7 +51,7 @@ import static com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.ELYTRA;
import static com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.SKIN; import static com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.SKIN;
import static net.minecraft.client.renderer.GlStateManager.*; import static net.minecraft.client.renderer.GlStateManager.*;
public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpenFileCallback { public class GuiSkins extends GuiScreen {
private static final int MAX_SKIN_DIMENSION = 8192; private static final int MAX_SKIN_DIMENSION = 8192;
private static final String skinServerId = "7853dfddc358333843ad55a2c7485c4aa0380a51"; private static final String skinServerId = "7853dfddc358333843ad55a2c7485c4aa0380a51";
private int updateCounter = 0; private int updateCounter = 0;
@ -242,8 +242,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.remotePlayer.releaseTextures(); this.remotePlayer.releaseTextures();
} }
@Override private void onFileOpenDialogClosed(JFileChooser fileDialog, int dialogResult) {
public void onFileOpenDialogClosed(JFileChooser fileDialog, int dialogResult) {
this.openFileThread = null; this.openFileThread = null;
this.btnBrowse.enabled = true; this.btnBrowse.enabled = true;
if (dialogResult == 0) { if (dialogResult == 0) {
@ -293,7 +292,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
if (guiButton.id == this.btnBrowse.id) { if (guiButton.id == this.btnBrowse.id) {
this.selectedSkin = null; this.selectedSkin = null;
this.localPlayer.releaseTextures(); this.localPlayer.releaseTextures();
this.openFileThread = new ThreadOpenFilePNG(this.mc, I18n.format("hdskins.open.title"), this); this.openFileThread = new ThreadOpenFilePNG(this.mc, I18n.format("hdskins.open.title"), this::onFileOpenDialogClosed);
this.openFileThread.start(); this.openFileThread.start();
guiButton.enabled = false; guiButton.enabled = false;
} }
@ -680,7 +679,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.uploadError = null; this.uploadError = null;
this.uploadingSkin = true; this.uploadingSkin = true;
this.skinUploadMessage = I18n.format("hdskins.request"); this.skinUploadMessage = I18n.format("hdskins.request");
this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this); this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this::onUploadComplete);
this.threadSkinUpload.start(); this.threadSkinUpload.start();
} }
} }
@ -691,7 +690,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.uploadError = null; this.uploadError = null;
this.uploadingSkin = true; this.uploadingSkin = true;
this.skinUploadMessage = I18n.format("hdskins.upload"); this.skinUploadMessage = I18n.format("hdskins.upload");
this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this); this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this::onUploadComplete);
this.threadSkinUpload.start(); this.threadSkinUpload.start();
} }
} }
@ -717,8 +716,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.btnUpload.enabled = true; this.btnUpload.enabled = true;
} }
@Override private void onUploadComplete(String response) {
public void onUploadComplete(String response) {
LiteLoaderLogger.info("Upload completed with: %s", response); LiteLoaderLogger.info("Upload completed with: %s", response);
this.uploadingSkin = false; this.uploadingSkin = false;
this.threadSkinUpload = null; this.threadSkinUpload = null;

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins.gui;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -12,6 +12,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
import javax.annotation.Nullable;
import java.util.Optional; import java.util.Optional;
@Mixin(TileEntitySkullRenderer.class) @Mixin(TileEntitySkullRenderer.class)
@ -24,7 +25,7 @@ public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileE
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V", target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
ordinal = 4)) ordinal = 4))
private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta, private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta,
GameProfile profile, int p_180543_8_, float ticks) { @Nullable GameProfile profile, int p_180543_8_, float ticks) {
if (profile != null) { if (profile != null) {
Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true); Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true);
if (skin.isPresent()) if (skin.isPresent())

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins.mixin;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins.mod;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins.resource;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -1,5 +1,6 @@
package com.voxelmodpack.hdskins.upload; package com.voxelmodpack.hdskins.upload;
@FunctionalInterface
public interface IUploadCompleteCallback { public interface IUploadCompleteCallback {
void onUploadComplete(String response); void onUploadComplete(String response);
} }

View file

@ -2,6 +2,7 @@ package com.voxelmodpack.hdskins.upload;
import com.google.common.io.Files; import com.google.common.io.Files;
import javax.annotation.Nullable;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.File; import java.io.File;
@ -39,7 +40,7 @@ public class ThreadMultipartPostUpload extends Thread {
public String response; public String response;
public ThreadMultipartPostUpload(String method, String url, Map<String, ?> sourceData, String authorization, IUploadCompleteCallback callback) { public ThreadMultipartPostUpload(String method, String url, Map<String, ?> sourceData, @Nullable String authorization, IUploadCompleteCallback callback) {
this.method = method; this.method = method;
this.urlString = url; this.urlString = url;
this.sourceData = sourceData; this.sourceData = sourceData;

View file

@ -7,6 +7,7 @@ import javax.swing.JFileChooser;
* *
* @author Adam Mummery-Smith * @author Adam Mummery-Smith
*/ */
@FunctionalInterface
public interface IOpenFileCallback { public interface IOpenFileCallback {
/** /**

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins.upload.awt;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,7 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.voxelmodpack.hdskins.upload;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -8,11 +8,13 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.ForgeHooksClient;
import javax.annotation.Nullable;
public class ForgeProxy { public class ForgeProxy {
private static boolean forgeLoaded = ModUtilities.fmlIsPresent(); private static boolean forgeLoaded = ModUtilities.fmlIsPresent();
public static String getArmorTexture(Entity entity, ItemStack armor, String def, EntityEquipmentSlot slot, String type) { public static String getArmorTexture(Entity entity, ItemStack armor, String def, EntityEquipmentSlot slot, @Nullable String type) {
if (forgeLoaded) if (forgeLoaded)
return ForgeHooksClient.getArmorTexture(entity, armor, def, slot, type); return ForgeHooksClient.getArmorTexture(entity, armor, def, slot, type);
return def; return def;

View file

@ -36,8 +36,6 @@ public class PonyConfig implements Exposable {
} }
public void setPonyLevel(PonyLevel ponylevel) { public void setPonyLevel(PonyLevel ponylevel) {
if (ponylevel == null)
ponylevel = PonyLevel.PONIES;
this.ponylevel = ponylevel; this.ponylevel = ponylevel;
} }
} }

View file

@ -27,10 +27,22 @@ public class PonyData implements IPonyData {
.build(); .build();
private PonyRace race; private PonyRace race;
private TailLengths tailSize = TailLengths.FULL; private TailLengths tailSize;
private PonyGender gender = PonyGender.MARE; private PonyGender gender;
private PonySize size = PonySize.NORMAL; private PonySize size;
private int glowColor = 0x4444aa; private int glowColor;
public PonyData() {
this(PonyRace.HUMAN, TailLengths.FULL, PonyGender.MARE, PonySize.NORMAL, 0x4444aa);
}
private PonyData(PonyRace race, TailLengths tailSize, PonyGender gender, PonySize size, int glowColor) {
this.race = race;
this.tailSize = tailSize;
this.gender = gender;
this.size = size;
this.glowColor = glowColor;
}
public PonyRace getRace() { public PonyRace getRace() {
return race; return race;
@ -77,28 +89,21 @@ public class PonyData implements IPonyData {
} }
static PonyData parse(BufferedImage image) { static PonyData parse(BufferedImage image) {
PonyData data = new PonyData(); int racePx = TriggerPixels.RACE.readColor(image);
PonyRace race = RACE_COLORS.getOrDefault(racePx, PonyRace.HUMAN);
int race = TriggerPixels.RACE.readColor(image); int tailPx = TriggerPixels.TAIL.readColor(image);
data.race = RACE_COLORS.get(race); TailLengths tail = TAIL_COLORS.getOrDefault(tailPx, TailLengths.FULL);
int tail = TriggerPixels.TAIL.readColor(image); int sizePx = TriggerPixels.SIZE.readColor(image);
if (TAIL_COLORS.containsKey(tail)) PonySize size = SIZE_COLORS.getOrDefault(sizePx, PonySize.NORMAL);
data.tailSize = TAIL_COLORS.get(tail);
int gender = TriggerPixels.GENDER.readColor(image); int genderPx = TriggerPixels.GENDER.readColor(image);
if (gender == 0xffffff) PonyGender gender = genderPx == 0xffffff ? PonyGender.STALLION : PonyGender.MARE;
data.gender = PonyGender.STALLION;
int size = TriggerPixels.SIZE.readColor(image); int glowColor = TriggerPixels.GLOW.readColor(image, -1);
if (SIZE_COLORS.containsKey(size))
data.size = SIZE_COLORS.get(size);
int color = TriggerPixels.GLOW.readColor(image); return new PonyData(race, tail, gender, size, glowColor);
if (color != 0x000000)
data.glowColor = color;
return data;
} }
private enum TriggerPixels { private enum TriggerPixels {
@ -116,7 +121,11 @@ public class PonyData implements IPonyData {
} }
private int readColor(BufferedImage image) { private int readColor(BufferedImage image) {
return image.getRGB(x, y) & 0xffffff; return readColor(image, 0xffffff);
}
private int readColor(BufferedImage image, int mask) {
return image.getRGB(x, y) & mask;
} }
} }
} }

View file

@ -1,6 +1,8 @@
package com.minelittlepony; package com.minelittlepony;
public enum PonyRace { public enum PonyRace {
HUMAN(false, false),
EARTH(false, false), EARTH(false, false),
PEGASUS(true, false), PEGASUS(true, false),
UNICORN(false, true), UNICORN(false, true),

View file

@ -2,6 +2,7 @@ package com.minelittlepony.mixin;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.Pony; import com.minelittlepony.Pony;
import com.minelittlepony.PonyRace;
import com.minelittlepony.PonySize; import com.minelittlepony.PonySize;
import com.minelittlepony.ducks.IRenderPony; import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.PMAPI; import com.minelittlepony.model.PMAPI;
@ -28,6 +29,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect; 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;
@Mixin(RenderPlayer.class) @Mixin(RenderPlayer.class)
public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony { public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony {
@ -68,20 +70,18 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
this.playerModel.getModel().isFlying = thePony.isPegasusFlying(player); this.playerModel.getModel().isFlying = thePony.isPegasusFlying(player);
this.playerModel.getModel().isSleeping = player.isPlayerSleeping(); this.playerModel.getModel().isSleeping = player.isPlayerSleeping();
if (MineLittlePony.getConfig().showscale) { if (MineLittlePony.getConfig().showscale && this.playerModel.getModel().metadata.getRace() != PonyRace.HUMAN) {
if (this.playerModel.getModel().metadata.getRace() != null) {
PonySize size = thePony.metadata.getSize(); PonySize size = thePony.metadata.getSize();
if (size == PonySize.FOAL) if (size == PonySize.FOAL) {
this.shadowSize = 0.25F; this.shadowSize = 0.25F;
else if (size == PonySize.NORMAL) } else if (size == PonySize.NORMAL) {
this.shadowSize = 0.4F; this.shadowSize = 0.4F;
else if (size == PonySize.TALL) } else if (size == PonySize.TALL) {
this.shadowSize = 0.45F; this.shadowSize = 0.45F;
else
this.shadowSize = 0.5F;
} else { } else {
this.shadowSize = 0.5F; this.shadowSize = 0.5F;
} }
} else { } else {
this.shadowSize = 0.5F; this.shadowSize = 0.5F;
} }
@ -95,12 +95,13 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
if (MineLittlePony.getConfig().showscale && !(playerModel.getModel() instanceof ModelHumanPlayer)) { if (MineLittlePony.getConfig().showscale && !(playerModel.getModel() instanceof ModelHumanPlayer)) {
PonySize size = thePony.metadata.getSize(); PonySize size = thePony.metadata.getSize();
if (size == PonySize.LARGE) if (size == PonySize.LARGE) {
GlStateManager.scale(0.9F, 0.9F, 0.9F); GlStateManager.scale(0.9F, 0.9F, 0.9F);
else if (size == PonySize.NORMAL || size == PonySize.FOAL) } else if (size == PonySize.NORMAL || size == PonySize.FOAL) {
GlStateManager.scale(0.8F, 0.8F, 0.8F); GlStateManager.scale(0.8F, 0.8F, 0.8F);
} }
} }
}
@Inject( @Inject(
method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V", method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
@ -194,10 +195,12 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
} }
} }
if (angle > Math.PI / 3) if (angle > Math.PI / 3) {
angle = Math.PI / 3; angle = Math.PI / 3;
if (angle < -Math.PI / 3) }
if (angle < -Math.PI / 3) {
angle = -Math.PI / 3; angle = -Math.PI / 3;
}
this.playerModel.getModel().motionPitch = (float) Math.toDegrees(angle); this.playerModel.getModel().motionPitch = (float) Math.toDegrees(angle);
@ -214,13 +217,15 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
ordinal = 3)) ordinal = 3))
private void rotateRedirect(float f1, float f2, float f3, float f4) { private void rotateRedirect(float f1, float f2, float f3, float f4) {
boolean isPony = this.playerModel.getModel() instanceof ModelPlayerPony; boolean isPony = this.playerModel.getModel() instanceof ModelPlayerPony;
if (isPony) if (isPony) {
f1 += 90; f1 += 90;
}
GlStateManager.rotate(f1, f2, f3, f4); GlStateManager.rotate(f1, f2, f3, f4);
if (isPony) if (isPony) {
GlStateManager.translate(0, -1, 0); GlStateManager.translate(0, -1, 0);
} }
}
private void updateModel(AbstractClientPlayer player) { private void updateModel(AbstractClientPlayer player) {
this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player); this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
@ -232,6 +237,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
} }
@Override @Override
@Nonnull
public ResourceLocation getEntityTexture(AbstractClientPlayer player) { public ResourceLocation getEntityTexture(AbstractClientPlayer player) {
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player); Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
return thePony.getTextureResourceLocation(); return thePony.getTextureResourceLocation();

View file

@ -129,7 +129,7 @@ public class PegasusWings extends ModelBase implements PonyModelConstants {
@Override @Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (pony.metadata.getRace() != null && pony.metadata.getRace().hasWings()) { if (pony.metadata.getRace().hasWings()) {
if (!pony.isFlying && !pony.isSneak) { if (!pony.isFlying && !pony.isSneak) {
for (ModelRenderer aLeftWing : this.leftWing) { for (ModelRenderer aLeftWing : this.leftWing) {

View file

@ -38,7 +38,7 @@ public class UnicornHorn extends ModelBase implements PonyModelConstants {
PonyData data = pony.metadata; PonyData data = pony.metadata;
if (data.getRace() != null && 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 ((pony.leftArmPose != ArmPose.EMPTY || pony.rightArmPose != ArmPose.EMPTY) && data.hasMagic()) {
GL11.glPushAttrib(24577); GL11.glPushAttrib(24577);

View file

@ -11,13 +11,9 @@ public class HornGlowRenderer extends ModelRenderer {
private int textureOffsetY; private int textureOffsetY;
private ModelBase baseModel; private ModelBase baseModel;
public HornGlowRenderer(ModelBase par1ModelBase, String par2Str) {
super(par1ModelBase, par2Str);
this.baseModel = par1ModelBase;
}
public HornGlowRenderer(ModelBase par1ModelBase) { public HornGlowRenderer(ModelBase par1ModelBase) {
this(par1ModelBase, null); super(par1ModelBase);
this.baseModel = par1ModelBase;
} }
public HornGlowRenderer(ModelBase par1ModelBase, int par2, int par3) { public HornGlowRenderer(ModelBase par1ModelBase, int par2, int par3) {