Run code format

This commit is contained in:
Sollace 2018-08-01 12:38:02 +02:00
parent b9231a5bfd
commit 65a5fc230c
62 changed files with 248 additions and 228 deletions

View file

@ -8,14 +8,13 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/** /**
* This annotation can be applied to a package, class or method to indicate that * This annotation can be applied to a package, class or method to indicate that the method in that
* the method in that element are nonnull by default unless there is: * element are nonnull by default unless there is:
* <ul> * <ul>
* <li>An explicit nullness annotation * <li>An explicit nullness annotation
* <li>The method overrides a method in a superclass (in which case the * <li>The method overrides a method in a superclass (in which case the annotation of the
* annotation of the corresponding method in the superclass applies) * corresponding method in the superclass applies)
* <li> there is a default parameter annotation applied to a more tightly nested * <li>there is a default parameter annotation applied to a more tightly nested element.
* element.
* </ul> * </ul>
* *
*/ */
@ -23,4 +22,5 @@ import java.lang.annotation.RetentionPolicy;
@Nonnull @Nonnull
@TypeQualifierDefault(ElementType.METHOD) // Note: This is a copy of javax.annotation.ParametersAreNonnullByDefault with target changed to METHOD @TypeQualifierDefault(ElementType.METHOD) // Note: This is a copy of javax.annotation.ParametersAreNonnullByDefault with target changed to METHOD
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface MethodsReturnNonnullByDefault {} public @interface MethodsReturnNonnullByDefault {
}

View file

@ -49,7 +49,7 @@ public class LiteModHDSkins implements InitCompleteListener, ViewportListener, C
// register config // register config
LiteLoader.getInstance().registerExposable(this, null); LiteLoader.getInstance().registerExposable(this, null);
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); IReloadableResourceManager irrm = (IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager();
irrm.registerReloadListener(HDSkinManager.INSTANCE); irrm.registerReloadListener(HDSkinManager.INSTANCE);
} }

View file

@ -13,8 +13,8 @@ import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**
* Manager for fetching preview textures. This ensures that multiple calls * Manager for fetching preview textures. This ensures that multiple calls to the skin server aren't
* to the skin server aren't done when fetching preview textures. * done when fetching preview textures.
*/ */
public class PreviewTextureManager { public class PreviewTextureManager {
@ -25,8 +25,7 @@ public class PreviewTextureManager {
} }
@Nullable @Nullable
public PreviewTexture getPreviewTexture(ResourceLocation location, MinecraftProfileTexture.Type type, ResourceLocation def, public PreviewTexture getPreviewTexture(ResourceLocation location, MinecraftProfileTexture.Type type, ResourceLocation def, @Nullable SkinManager.SkinAvailableCallback callback) {
@Nullable SkinManager.SkinAvailableCallback callback) {
if (!textures.containsKey(type)) { if (!textures.containsKey(type)) {
return null; return null;
} }
@ -34,19 +33,19 @@ public class PreviewTextureManager {
IImageBuffer buffer = new ImageBufferDownloadHD(); IImageBuffer buffer = new ImageBufferDownloadHD();
PreviewTexture skinTexture = new PreviewTexture(texture.getMetadata("model"), texture.getUrl(), def, PreviewTexture skinTexture = new PreviewTexture(texture.getMetadata("model"), texture.getUrl(), def,
type == MinecraftProfileTexture.Type.SKIN ? new IImageBuffer() { type == MinecraftProfileTexture.Type.SKIN ? new IImageBuffer() {
@Override @Override
@Nullable @Nullable
public BufferedImage parseUserSkin(BufferedImage image) { public BufferedImage parseUserSkin(BufferedImage image) {
return buffer.parseUserSkin(image); return buffer.parseUserSkin(image);
} }
@Override @Override
public void skinAvailable() { public void skinAvailable() {
if (callback != null) { if (callback != null) {
callback.skinAvailable(type, location, new MinecraftProfileTexture(texture.getUrl(), Maps.newHashMap())); callback.skinAvailable(type, location, new MinecraftProfileTexture(texture.getUrl(), Maps.newHashMap()));
} }
} }
} : null); } : null);
Minecraft.getMinecraft().getTextureManager().loadTexture(location, skinTexture); Minecraft.getMinecraft().getTextureManager().loadTexture(location, skinTexture);
return skinTexture; return skinTexture;

View file

@ -9,6 +9,6 @@ public class TextureLoader {
private static Minecraft mc = Minecraft.getMinecraft(); private static Minecraft mc = Minecraft.getMinecraft();
public static void loadTexture(final ResourceLocation textureLocation, final ITextureObject textureObj) { public static void loadTexture(final ResourceLocation textureLocation, final ITextureObject textureObj) {
mc.addScheduledTask((Runnable) () -> mc.getTextureManager().loadTexture(textureLocation, textureObj)); mc.addScheduledTask((Runnable)() -> mc.getTextureManager().loadTexture(textureLocation, textureObj));
} }
} }

View file

@ -130,8 +130,7 @@ public class ThreadDownloadImageETag extends SimpleTexture {
// try to load from cache anyway // try to load from cache anyway
setLocalCache(); setLocalCache();
return; return;
} catch (IOException ignored) { } catch (IOException ignored) {}
}
} }
LOGGER.error("Couldn't load skin {} ", imageUrl, e); LOGGER.error("Couldn't load skin {} ", imageUrl, e);
} finally { } finally {

View file

@ -123,8 +123,8 @@ public class CubeMap {
for (int blendPass = 0; blendPass < blendIterations * blendIterations; ++blendPass) { for (int blendPass = 0; blendPass < blendIterations * blendIterations; ++blendPass) {
pushMatrix(); pushMatrix();
float offsetX = ((float) (blendPass % blendIterations) / (float) blendIterations - 0.5F) / 64; float offsetX = ((float)(blendPass % blendIterations) / (float)blendIterations - 0.5F) / 64;
float offsetY = ((float) (blendPass / blendIterations) / (float) blendIterations - 0.5F) / 64; float offsetY = ((float)(blendPass / blendIterations) / (float)blendIterations - 0.5F) / 64;
translate(offsetX, offsetY, 0); translate(offsetX, offsetY, 0);
rotate(MathHelper.sin(lastPartialTick / 400) * 25 + 20, 1, 0, 0); rotate(MathHelper.sin(lastPartialTick / 400) * 25 + 20, 1, 0, 0);

View file

@ -38,8 +38,7 @@ public class EntityPlayerModel extends EntityLivingBase {
EntityEquipmentSlot.CHEST, ItemStack.EMPTY, EntityEquipmentSlot.CHEST, ItemStack.EMPTY,
EntityEquipmentSlot.LEGS, ItemStack.EMPTY, EntityEquipmentSlot.LEGS, ItemStack.EMPTY,
EntityEquipmentSlot.FEET, ItemStack.EMPTY, EntityEquipmentSlot.FEET, ItemStack.EMPTY,
EntityEquipmentSlot.MAINHAND, ItemStack.EMPTY EntityEquipmentSlot.MAINHAND, ItemStack.EMPTY));
));
private PreviewTexture remoteSkinTexture; private PreviewTexture remoteSkinTexture;
private ResourceLocation remoteSkinResource; private ResourceLocation remoteSkinResource;

View file

@ -35,7 +35,7 @@ public interface FileDropListener extends DropTargetListener {
default void drop(DropTargetDropEvent dtde) { default void drop(DropTargetDropEvent dtde) {
dtde.acceptDrop(DnDConstants.ACTION_LINK); dtde.acceptDrop(DnDConstants.ACTION_LINK);
try { try {
onDrop((List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor)); onDrop((List<File>)dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
dtde.getDropTargetContext().dropComplete(true); dtde.getDropTargetContext().dropComplete(true);
} catch (UnsupportedFlavorException | IOException e) { } catch (UnsupportedFlavorException | IOException e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -206,12 +206,11 @@ public class GLWindow extends DropTarget {
// LWJGL copies the initial byte streams and then reverses them. The result is a stream that's not // LWJGL copies the initial byte streams and then reverses them. The result is a stream that's not
// only already consumed, but somehow invalid when you try to parse it through ImageIO.read. // only already consumed, but somehow invalid when you try to parse it through ImageIO.read.
// //
DefaultResourcePack pack = (DefaultResourcePack) mc.getResourcePackRepository().rprDefaultResourcePack; DefaultResourcePack pack = (DefaultResourcePack)mc.getResourcePackRepository().rprDefaultResourcePack;
ArrayList<Image> images = Lists.newArrayList( ArrayList<Image> images = Lists.newArrayList(
ImageIO.read(pack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"))), ImageIO.read(pack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"))),
ImageIO.read(pack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"))) ImageIO.read(pack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"))));
);
Frame[] frames = Frame.getFrames(); Frame[] frames = Frame.getFrames();
@ -267,6 +266,6 @@ public class GLWindow extends DropTarget {
frame.setDropTarget(this); frame.setDropTarget(this);
addDropTargetListener(dtl); addDropTargetListener(dtl);
} catch (TooManyListenersException ignored) { } } catch (TooManyListenersException ignored) {}
} }
} }

View file

@ -214,7 +214,7 @@ public class GuiSkins extends GuiScreen {
} }
private void enableDnd() { private void enableDnd() {
GLWindow.current().setDropTargetListener((FileDropListener) files -> { GLWindow.current().setDropTargetListener((FileDropListener)files -> {
files.stream().findFirst().ifPresent(instance::loadLocalFile); files.stream().findFirst().ifPresent(instance::loadLocalFile);
}); });
} }
@ -241,7 +241,7 @@ public class GuiSkins extends GuiScreen {
Minecraft.getMinecraft().addScheduledTask(localPlayer::releaseTextures); Minecraft.getMinecraft().addScheduledTask(localPlayer::releaseTextures);
if (!skinFile.exists()) { if (!skinFile.exists()) {
skinMessage = I18n.format("hdskins.error.unreadable"); skinMessage = I18n.format("hdskins.error.unreadable");
} else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) { } else if (!FilenameUtils.isExtension(skinFile.getName(), new String[] {"png", "PNG"})) {
skinMessage = I18n.format("hdskins.error.ext"); skinMessage = I18n.format("hdskins.error.ext");
} else { } else {
BufferedImage chosenImage; BufferedImage chosenImage;
@ -257,7 +257,7 @@ public class GuiSkins extends GuiScreen {
skinMessage = I18n.format("hdskins.error.open"); skinMessage = I18n.format("hdskins.error.open");
} else if (isPowerOfTwo(chosenImage.getWidth()) } else if (isPowerOfTwo(chosenImage.getWidth())
&& (chosenImage.getWidth() == chosenImage.getHeight() * 2 && (chosenImage.getWidth() == chosenImage.getHeight() * 2
|| chosenImage.getWidth() == chosenImage.getHeight()) || chosenImage.getWidth() == chosenImage.getHeight())
&& chosenImage.getWidth() <= MAX_SKIN_DIMENSION && chosenImage.getWidth() <= MAX_SKIN_DIMENSION
&& chosenImage.getHeight() <= MAX_SKIN_DIMENSION) { && chosenImage.getHeight() <= MAX_SKIN_DIMENSION) {
synchronized (skinLock) { synchronized (skinLock) {
@ -435,7 +435,7 @@ public class GuiSkins extends GuiScreen {
if (!localPlayer.isUsingLocalTexture()) { if (!localPlayer.isUsingLocalTexture()) {
int opacity = fontRenderer.getStringWidth(skinMessage) / 2; int opacity = fontRenderer.getStringWidth(skinMessage) / 2;
Gui.drawRect(40, height / 2 - 12, width / 2 - 40, height / 2 + 12, 0xB0000000); Gui.drawRect(40, height / 2 - 12, width / 2 - 40, height / 2 + 12, 0xB0000000);
fontRenderer.drawStringWithShadow(skinMessage, (int) (xPos1 - opacity), height / 2 - 4, 0xffffff); fontRenderer.drawStringWithShadow(skinMessage, (int)(xPos1 - opacity), height / 2 - 4, 0xffffff);
} }
if (btnModeSkin.isMouseOver() || btnModeElytra.isMouseOver() || btnModeSkinnySkin.isMouseOver()) { if (btnModeSkin.isMouseOver() || btnModeElytra.isMouseOver() || btnModeSkinnySkin.isMouseOver()) {
int y = Math.max(mouseY, 16); int y = Math.max(mouseY, 16);
@ -462,15 +462,15 @@ public class GuiSkins extends GuiScreen {
int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2; int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2;
int stringWidth2 = fontRenderer.getStringWidth(stringWidth) / 2; int stringWidth2 = fontRenderer.getStringWidth(stringWidth) / 2;
Gui.drawRect((int) (xPos2 - labelwidth), height / 2 - 16, width - 40, height / 2 + 16, 0xB0000000); Gui.drawRect((int)(xPos2 - labelwidth), height / 2 - 16, width - 40, height / 2 + 16, 0xB0000000);
fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), height / 2 - 10, 0xffffff); fontRenderer.drawStringWithShadow(opacity1, (int)(xPos2 - stringWidth1), height / 2 - 10, 0xffffff);
fontRenderer.drawStringWithShadow(stringWidth, (int) (xPos2 - stringWidth2), height / 2 + 2, 0xffffff); fontRenderer.drawStringWithShadow(stringWidth, (int)(xPos2 - stringWidth2), height / 2 + 2, 0xffffff);
} else { } else {
opacity1 = I18n.format("hdskins.fetch"); opacity1 = I18n.format("hdskins.fetch");
int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2; int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2;
Gui.drawRect((int) (xPos2 - labelwidth), height / 2 - 12, width - 40, height / 2 + 12, 0xB0000000); Gui.drawRect((int)(xPos2 - labelwidth), height / 2 - 12, width - 40, height / 2 + 12, 0xB0000000);
fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), height / 2 - 4, 0xffffff); fontRenderer.drawStringWithShadow(opacity1, (int)(xPos2 - stringWidth1), height / 2 - 4, 0xffffff);
} }
} }
@ -485,7 +485,7 @@ public class GuiSkins extends GuiScreen {
uploadOpacity = 1; uploadOpacity = 1;
} }
int opacity = Math.min(180, (int) (uploadOpacity * 180)) & 255; int opacity = Math.min(180, (int)(uploadOpacity * 180)) & 255;
if (uploadOpacity > 0) { if (uploadOpacity > 0) {
Gui.drawRect(0, 0, width, height, opacity << 24); Gui.drawRect(0, 0, width, height, opacity << 24);
if (uploadingSkin) { if (uploadingSkin) {
@ -504,8 +504,7 @@ public class GuiSkins extends GuiScreen {
enableDepth(); enableDepth();
} }
private void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float mouseX, private void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float mouseX, float partialTick) {
float partialTick) {
enableColorMaterial(); enableColorMaterial();
pushMatrix(); pushMatrix();
translate(xPosition, yPosition, 300); translate(xPosition, yPosition, 300);
@ -523,9 +522,9 @@ public class GuiSkins extends GuiScreen {
rotate(rot, 0, 1, 0); rotate(rot, 0, 1, 0);
thePlayer.rotationYawHead = (float) Math.atan(mouseX / 20) * 30; thePlayer.rotationYawHead = (float)Math.atan(mouseX / 20) * 30;
thePlayer.rotationPitch = -((float) Math.atan(mouseY / 40)) * 20; thePlayer.rotationPitch = -((float)Math.atan(mouseY / 40)) * 20;
translate(0, thePlayer.getYOffset(), 0); translate(0, thePlayer.getYOffset(), 0);
RenderManager rm = Minecraft.getMinecraft().getRenderManager(); RenderManager rm = Minecraft.getMinecraft().getRenderManager();

View file

@ -40,7 +40,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
return new LayerRenderer<EntityLivingBase>() { return new LayerRenderer<EntityLivingBase>() {
@Override @Override
public void doRenderLayer(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void doRenderLayer(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
EntityPlayerModel entity = (EntityPlayerModel) entityBase; EntityPlayerModel entity = (EntityPlayerModel)entityBase;
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (itemstack.getItem() == Items.ELYTRA) { if (itemstack.getItem() == Items.ELYTRA) {

View file

@ -24,8 +24,7 @@ public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileE
value = "INVOKE", value = "INVOKE",
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, @Nullable 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

@ -11,6 +11,7 @@ class SkinData {
List<Skin> skins; List<Skin> skins;
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
class Skin { class Skin {

View file

@ -91,8 +91,8 @@ public class SkinResourceManager implements IResourceManagerReloadListener {
/** /**
* Convert older resources to a newer format. * Convert older resources to a newer format.
* *
* @param res The skin resource to convert * @param res The skin resource to convert
* @return The converted resource * @return The converted resource
*/ */
@Nullable @Nullable
public ResourceLocation getConvertedResource(@Nullable ResourceLocation res) { public ResourceLocation getConvertedResource(@Nullable ResourceLocation res) {

View file

@ -63,7 +63,7 @@ public class LegacySkinServer implements SkinServer {
String url = getPath(address, type, profile); String url = getPath(address, type, profile);
try { try {
HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); HttpURLConnection urlConnection = (HttpURLConnection)new URL(url).openConnection();
if (urlConnection.getResponseCode() / 100 != 2) { if (urlConnection.getResponseCode() / 100 != 2) {
throw new IOException("Bad response code: " + urlConnection.getResponseCode()); throw new IOException("Bad response code: " + urlConnection.getResponseCode());
} }

View file

@ -58,7 +58,7 @@ public class NetClient {
response = HttpClients.createSystem().execute(request); response = HttpClients.createSystem().execute(request);
return getResponseCode() == HttpStatus.SC_OK; return getResponseCode() == HttpStatus.SC_OK;
} catch (IOException e) { } } catch (IOException e) {}
return false; return false;
} }

View file

@ -12,9 +12,9 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
/** /**
* Use this to build a {@link MinecraftTexturesPayload} object. This is * Use this to build a {@link MinecraftTexturesPayload} object. This is required because it has no
* required because it has no useful constructor. This uses reflection * useful constructor. This uses reflection via Gson to create a new instance and populate the
* via Gson to create a new instance and populate the fields. * fields.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class TexturesPayloadBuilder { public class TexturesPayloadBuilder {

View file

@ -55,8 +55,7 @@ public class ValhallaSkinServer implements SkinServer {
@Override @Override
public Optional<MinecraftTexturesPayload> loadProfileData(GameProfile profile) { public Optional<MinecraftTexturesPayload> loadProfileData(GameProfile profile) {
try (CloseableHttpClient client = HttpClients.createSystem(); try (CloseableHttpClient client = HttpClients.createSystem(); CloseableHttpResponse response = client.execute(new HttpGet(getTexturesURI(profile)))) {
CloseableHttpResponse response = client.execute(new HttpGet(getTexturesURI(profile)))) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
@ -88,9 +87,7 @@ public class ValhallaSkinServer implements SkinServer {
}, HDSkinManager.skinUploadExecutor); }, HDSkinManager.skinUploadExecutor);
} }
private SkinUploadResponse upload(CloseableHttpClient client, Session session, @Nullable URI image, private SkinUploadResponse upload(CloseableHttpClient client, Session session, @Nullable URI image, MinecraftProfileTexture.Type type, Map<String, String> metadata) throws IOException {
MinecraftProfileTexture.Type type, Map<String, String> metadata)
throws IOException {
GameProfile profile = session.getProfile(); GameProfile profile = session.getProfile();
if (image == null) { if (image == null) {

View file

@ -20,7 +20,7 @@ import javax.annotation.Nullable;
/** /**
* Uploader for Multipart form data * Uploader for Multipart form data
* *
* @author Adam Mummery-Smith * @author Adam Mummery-Smith
* @deprecated Use httpmime multipart upload * @deprecated Use httpmime multipart upload
*/ */
@Deprecated @Deprecated
@ -59,7 +59,7 @@ public class ThreadMultipartPostUpload {
URL url = new URL(urlString); URL url = new URL(urlString);
// Open a HTTP connection to the URL // Open a HTTP connection to the URL
httpClient = (HttpURLConnection) url.openConnection(); httpClient = (HttpURLConnection)url.openConnection();
httpClient.setDoOutput(true); httpClient.setDoOutput(true);
httpClient.setUseCaches(false); httpClient.setUseCaches(false);
@ -84,7 +84,7 @@ public class ThreadMultipartPostUpload {
Object paramData = data.getValue(); Object paramData = data.getValue();
if (paramData instanceof URI) { if (paramData instanceof URI) {
Path uploadPath = Paths.get((URI) paramData); Path uploadPath = Paths.get((URI)paramData);
outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + uploadPath.getFileName() + "\"" + CRLF); outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + uploadPath.getFileName() + "\"" + CRLF);
outputStream.writeBytes("Content-Type: image/png" + CRLF + CRLF); outputStream.writeBytes("Content-Type: image/png" + CRLF + CRLF);

View file

@ -25,8 +25,7 @@ public abstract class ThreadOpenFile extends Thread {
private static String lastChosenFile = null; private static String lastChosenFile = null;
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) throws IllegalStateException {
throws IllegalStateException {
if (minecraft.isFullScreen()) { if (minecraft.isFullScreen()) {
throw new IllegalStateException("Cannot open an awt window whilst minecraft is in full screen mode!"); throw new IllegalStateException("Cannot open an awt window whilst minecraft is in full screen mode!");
} }

View file

@ -12,8 +12,7 @@ import java.io.File;
*/ */
public class ThreadOpenFilePNG extends ThreadOpenFile { public class ThreadOpenFilePNG extends ThreadOpenFile {
public ThreadOpenFilePNG(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) public ThreadOpenFilePNG(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) throws IllegalStateException {
throws IllegalStateException {
super(minecraft, dialogTitle, callback); super(minecraft, dialogTitle, callback);
} }

View file

@ -23,11 +23,11 @@ public class ForgeProxy {
/** /**
* Gets the mod armour texture for an associated item and slot. * Gets the mod armour texture for an associated item and slot.
* *
* @param entity The entity to get armour for. * @param entity The entity to get armour for.
* @param item The armour item * @param item The armour item
* @param def Default return value if no mods present * @param def Default return value if no mods present
* @param slot The slot this armour piece is place in. * @param slot The slot this armour piece is place in.
* @param type unknown * @param type unknown
* @return * @return
*/ */
public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) { public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
@ -40,10 +40,10 @@ public class ForgeProxy {
/** /**
* Gets the mod armour model for an associated item and slot. * Gets the mod armour model for an associated item and slot.
* *
* @param entity The entity to get armour for. * @param entity The entity to get armour for.
* @param item The armour item * @param item The armour item
* @param slot The slot this armour piece is place in. * @param slot The slot this armour piece is place in.
* @param def Default return value if no mods present * @param def Default return value if no mods present
*/ */
public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) { public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) {
if (forgeLoaded) { if (forgeLoaded) {

View file

@ -54,7 +54,7 @@ public class MineLittlePony {
LiteLoader.getInstance().registerExposable(config, null); LiteLoader.getInstance().registerExposable(config, null);
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); IReloadableResourceManager irrm = (IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager();
irrm.registerReloadListener(ponyManager); irrm.registerReloadListener(ponyManager);
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer; MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;

View file

@ -14,14 +14,21 @@ import com.mumfrey.liteloader.modconfig.ExposableOptions;
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned) @ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
public class PonyConfig extends SensibleConfig implements Exposable { public class PonyConfig extends SensibleConfig implements Exposable {
@Expose private PonyLevel ponylevel = PonyLevel.PONIES; @Expose
private PonyLevel ponylevel = PonyLevel.PONIES;
@Expose public boolean sizes = true; @Expose
@Expose public boolean snuzzles = true; public boolean sizes = true;
@Expose public boolean hd = true; @Expose
@Expose public boolean showscale = true; public boolean snuzzles = true;
@Expose public boolean fpsmagic = true; @Expose
@Expose public boolean ponyskulls = true; public boolean hd = true;
@Expose
public boolean showscale = true;
@Expose
public boolean fpsmagic = true;
@Expose
public boolean ponyskulls = true;
public enum PonySettings implements Setting { public enum PonySettings implements Setting {
SIZES, SIZES,
@ -32,15 +39,22 @@ public class PonyConfig extends SensibleConfig implements Exposable {
PONYSKULLS; PONYSKULLS;
} }
@Expose public boolean villagers = true; @Expose
@Expose public boolean zombies = true; public boolean villagers = true;
@Expose public boolean pigzombies = true; @Expose
@Expose public boolean skeletons = true; public boolean zombies = true;
@Expose public boolean illagers = true; @Expose
@Expose public boolean guardians = true; public boolean pigzombies = true;
@Expose
public boolean skeletons = true;
@Expose
public boolean illagers = true;
@Expose
public boolean guardians = true;
/** /**
* Gets the current PonyLevel. That is the level of ponies you would like to see. * Gets the current PonyLevel. That is the level of ponies you would like to see.
*
* @param ignorePony true to ignore whatever value the setting has. * @param ignorePony true to ignore whatever value the setting has.
*/ */
public PonyLevel getEffectivePonyLevel(boolean ignorePony) { public PonyLevel getEffectivePonyLevel(boolean ignorePony) {
@ -59,6 +73,7 @@ public class PonyConfig extends SensibleConfig implements Exposable {
/** /**
* Sets the pony level. Want MOAR PONEHS? Well here you go. * Sets the pony level. Want MOAR PONEHS? Well here you go.
*
* @param ponylevel * @param ponylevel
*/ */
public void setPonyLevel(PonyLevel ponylevel) { public void setPonyLevel(PonyLevel ponylevel) {

View file

@ -28,7 +28,8 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* The PonyManager is responsible for reading and recoding all the pony data associated with an entity of skin. * The PonyManager is responsible for reading and recoding all the pony data associated with an
* entity of skin.
* *
*/ */
public class PonyManager implements IResourceManagerReloadListener, ISkinCacheClearListener { public class PonyManager implements IResourceManagerReloadListener, ISkinCacheClearListener {
@ -69,15 +70,15 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
if (pony.usesThinArms() != slim) { if (pony.usesThinArms() != slim) {
pony = new Pony(resource, slim); pony = new Pony(resource, slim);
poniesCache.put(resource, pony); poniesCache.put(resource, pony);
} }
return pony; return pony;
} }
/** /**
* Gets or creates a pony for the given player. * Gets or creates a pony for the given player. Delegates to the background-ponies registry if no
* Delegates to the background-ponies registry if no pony skins were available and client settings allows it. * pony skins were available and client settings allows it.
* *
* @param player the player * @param player the player
*/ */
@ -111,10 +112,11 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
* *
* Whether is has slim arms is determined by the id. * Whether is has slim arms is determined by the id.
* *
* Delegates to the background-ponies registry if no pony skins were available and client settings allows it. * Delegates to the background-ponies registry if no pony skins were available and client settings
* allows it.
* *
* @param resource A texture resource * @param resource A texture resource
* @param uuid id of a player or entity * @param uuid id of a player or entity
*/ */
public Pony getPony(ResourceLocation resource, UUID uuid) { public Pony getPony(ResourceLocation resource, UUID uuid) {
Pony pony = getPony(resource, isSlimSkin(uuid)); Pony pony = getPony(resource, isSlimSkin(uuid));

View file

@ -17,8 +17,8 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
/** /**
* Render manager responsible for replacing and restoring entity renderers when the client settings change. * Render manager responsible for replacing and restoring entity renderers when the client settings
* Old values are persisted internally. * change. Old values are persisted internally.
*/ */
public class PonyRenderManager { public class PonyRenderManager {
@ -65,11 +65,11 @@ public class PonyRenderManager {
* *
* Replaces an entity renderer depending on whether we want ponies or not. * Replaces an entity renderer depending on whether we want ponies or not.
* *
* @param state True if we want ponies (the original will be stored) * @param state True if we want ponies (the original will be stored)
* @param manager The render manager * @param manager The render manager
* @param type The type to replace * @param type The type to replace
* @param renderer The replacement value * @param renderer The replacement value
* @param <T> The entity type * @param <T> The entity type
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Entity, V extends T> void switchRenderer(boolean state, RenderManager manager, Class<V> type, Render<T> renderer) { public <T extends Entity, V extends T> void switchRenderer(boolean state, RenderManager manager, Class<V> type, Render<T> renderer) {

View file

@ -4,7 +4,8 @@ import net.minecraft.client.network.NetworkPlayerInfo;
public interface IPlayerInfo { public interface IPlayerInfo {
/** /**
* Returns true if the vanilla skin (the one returned by NetworkPlayerInfo.getSkinLocation) uses the ALEX model type. * Returns true if the vanilla skin (the one returned by NetworkPlayerInfo.getSkinLocation) uses the
* ALEX model type.
*/ */
boolean usesSlimArms(); boolean usesSlimArms();

View file

@ -8,8 +8,8 @@ public interface IGUIAction<T> {
/** /**
* Performs this action now. * Performs this action now.
* *
* @param value New Value of the field being changed * @param value New Value of the field being changed
* @return Adjusted value the field must take on * @return Adjusted value the field must take on
*/ */
T perform(T value); T perform(T value);
} }

View file

@ -24,7 +24,8 @@ public class Slider extends GuiSlider {
} }
@Override @Override
public void setEntryValue(int id, boolean value) { } public void setEntryValue(int id, boolean value) {
}
@Override @Override
public void setEntryValue(int id, float value) { public void setEntryValue(int id, float value) {
@ -32,7 +33,8 @@ public class Slider extends GuiSlider {
} }
@Override @Override
public void setEntryValue(int id, String value) { } public void setEntryValue(int id, String value) {
}
} }
} }

View file

@ -25,7 +25,7 @@ public class MixinItemRenderer {
//public void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform, boolean leftHanded) //public void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform, boolean leftHanded)
@Redirect(method = "renderItemInFirstPerson(" + AbstractClientPlayer + "FF" + EnumHand + "F" + ItemStack + "F)V", @Redirect(method = "renderItemInFirstPerson(" + AbstractClientPlayer + "FF" + EnumHand + "F" + ItemStack + "F)V",
at = @At(value = "INVOKE", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItemSide(" + EntityLivingBase + ItemStack + TransformType + "Z)V")) target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItemSide(" + EntityLivingBase + ItemStack + TransformType + "Z)V"))
private void redirectRenderItemSide(ItemRenderer self, EntityLivingBase entity, ItemStack stack, TransformType transform, boolean left) { private void redirectRenderItemSide(ItemRenderer self, EntityLivingBase entity, ItemStack stack, TransformType transform, boolean left) {
MineLittlePony.getInstance().getRenderManager().getMagicRenderer().renderItemInFirstPerson(self, (AbstractClientPlayer)entity, stack, transform, left); MineLittlePony.getInstance().getRenderManager().getMagicRenderer().renderItemInFirstPerson(self, (AbstractClientPlayer)entity, stack, transform, left);
} }

View file

@ -27,6 +27,7 @@ public class ModelWrapper implements IModelWrapper {
/** /**
* Returns the contained armour model. * Returns the contained armour model.
*
* @return * @return
*/ */
public PonyArmor getArmor() { public PonyArmor getArmor() {

View file

@ -47,7 +47,7 @@ public final class PMAPI {
public static void init() { public static void init() {
for (Field field : PMAPI.class.getFields()) { for (Field field : PMAPI.class.getFields()) {
try { try {
ModelWrapper model = (ModelWrapper) field.get(null); ModelWrapper model = (ModelWrapper)field.get(null);
model.init(); model.init();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -2,70 +2,69 @@ package com.minelittlepony.model;
public final class PonyModelConstants { public final class PonyModelConstants {
public static final float public static final float PI = (float)Math.PI,
PI = (float)Math.PI,
BODY_CENTRE_X = 0, BODY_CENTRE_X = 0,
BODY_CENTRE_Y = 8, BODY_CENTRE_Y = 8,
BODY_CENTRE_Z = 6, BODY_CENTRE_Z = 6,
NECK_CENTRE_X = BODY_CENTRE_X - 2, NECK_CENTRE_X = BODY_CENTRE_X - 2,
NECK_CENTRE_Y = BODY_CENTRE_Y - 6.8F, NECK_CENTRE_Y = BODY_CENTRE_Y - 6.8F,
NECK_CENTRE_Z = BODY_CENTRE_Z - 8.8F, NECK_CENTRE_Z = BODY_CENTRE_Z - 8.8F,
BODY_ROTATE_ANGLE_X_NOTSNEAK = 0, BODY_ROTATE_ANGLE_X_NOTSNEAK = 0,
BODY_ROTATE_ANGLE_X_SNEAK = 0.4F, BODY_ROTATE_ANGLE_X_SNEAK = 0.4F,
BODY_ROTATE_ANGLE_X_RIDING = PI * 3.8F, BODY_ROTATE_ANGLE_X_RIDING = PI * 3.8F,
BODY_RP_Y_NOTSNEAK = 0, BODY_RP_Y_NOTSNEAK = 0,
BODY_RP_Y_SNEAK = 7, BODY_RP_Y_SNEAK = 7,
BODY_RP_Y_RIDING = 1, BODY_RP_Y_RIDING = 1,
BODY_RP_Z_NOTSNEAK = 0, BODY_RP_Z_NOTSNEAK = 0,
BODY_RP_Z_SNEAK = -4, BODY_RP_Z_SNEAK = -4,
BODY_RP_Z_RIDING = 4, BODY_RP_Z_RIDING = 4,
FRONT_LEG_RP_Y_NOTSNEAK = 8, FRONT_LEG_RP_Y_NOTSNEAK = 8,
FRONT_LEG_RP_Y_SNEAK = 8, FRONT_LEG_RP_Y_SNEAK = 8,
HEAD_CENTRE_X = 0, HEAD_CENTRE_X = 0,
HEAD_CENTRE_Y = -1, HEAD_CENTRE_Y = -1,
HEAD_CENTRE_Z = -2, HEAD_CENTRE_Z = -2,
HEAD_RP_X = 0, HEAD_RP_X = 0,
HEAD_RP_Y = 0, HEAD_RP_Y = 0,
HEAD_RP_Z = 0, HEAD_RP_Z = 0,
HORN_X = HEAD_CENTRE_X - 0.5F, HORN_X = HEAD_CENTRE_X - 0.5F,
HORN_Y = HEAD_CENTRE_Y - 10, HORN_Y = HEAD_CENTRE_Y - 10,
HORN_Z = HEAD_CENTRE_Z - 1.5F, HORN_Z = HEAD_CENTRE_Z - 1.5F,
LEFT_WING_EXT_RP_X = 4.5F, LEFT_WING_EXT_RP_X = 4.5F,
LEFT_WING_EXT_RP_Y = 5.3F, LEFT_WING_EXT_RP_Y = 5.3F,
LEFT_WING_EXT_RP_Z = 6, LEFT_WING_EXT_RP_Z = 6,
LEFT_WING_ROTATE_ANGLE_Z_SNEAK = 4, LEFT_WING_ROTATE_ANGLE_Z_SNEAK = 4,
ROTATE_270 = 4.712F, ROTATE_270 = 4.712F,
ROTATE_90 = 1.571F, ROTATE_90 = 1.571F,
SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F, SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F,
TAIL_RP_X = 0, TAIL_RP_X = 0,
TAIL_RP_Y = 0, TAIL_RP_Y = 0,
TAIL_RP_Z = 0, TAIL_RP_Z = 0,
TAIL_RP_Z_NOTSNEAK = 14, TAIL_RP_Z_NOTSNEAK = 14,
TAIL_RP_Z_SNEAK = 15, TAIL_RP_Z_SNEAK = 15,
FIRSTP_ARM_CENTRE_X = -3, FIRSTP_ARM_CENTRE_X = -3,
THIRDP_ARM_CENTRE_X = 0, THIRDP_ARM_CENTRE_X = 0,
THIRDP_ARM_CENTRE_Y = 4, THIRDP_ARM_CENTRE_Y = 4,
THIRDP_ARM_CENTRE_Z = -1, THIRDP_ARM_CENTRE_Z = -1,
WING_FOLDED_RP_Y = 13, WING_FOLDED_RP_Y = 13,
WING_FOLDED_RP_Z = -3, WING_FOLDED_RP_Z = -3,
NECK_ROT_X = 0.166F; NECK_ROT_X = 0.166F;
} }

View file

@ -10,8 +10,9 @@ public interface IModel extends ICapitated {
/** /**
* Sets up this model's initial values, like a constructor... * Sets up this model's initial values, like a constructor...
* @param yOffset YPosition for this model. Always 0. *
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change). * @param yOffset YPosition for this model. Always 0.
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
*/ */
void init(float yOffset, float stretch); void init(float yOffset, float stretch);
@ -40,8 +41,8 @@ public interface IModel extends ICapitated {
boolean isFlying(); boolean isFlying();
/** /**
* Returns true if the model is elytra flying. Elytra flying is different * Returns true if the model is elytra flying. Elytra flying is different from regular flying in
* from regular flying in that there are actual "wings" involved. * that there are actual "wings" involved.
*/ */
boolean isElytraFlying(); boolean isElytraFlying();

View file

@ -3,6 +3,7 @@ package com.minelittlepony.model.capabilities;
public interface IModelPart { public interface IModelPart {
/** /**
* Initialises all of the boxes in this modelpart. * Initialises all of the boxes in this modelpart.
*
* @param yOffset * @param yOffset
* @param stretch * @param stretch
*/ */

View file

@ -14,6 +14,7 @@ public interface IModelUnicorn extends IModel {
/** /**
* Returns true if this model is currently using magic (horn is lit). * Returns true if this model is currently using magic (horn is lit).
*
* @return * @return
*/ */
boolean isCasting(); boolean isCasting();

View file

@ -55,10 +55,10 @@ public class ModelVillagerPony extends ModelAlicorn {
protected int getProfession(Entity entity) { protected int getProfession(Entity entity) {
if (entity instanceof EntityVillager) { if (entity instanceof EntityVillager) {
return ((EntityVillager) entity).getProfession(); return ((EntityVillager)entity).getProfession();
} }
if (entity instanceof EntityZombieVillager) { if (entity instanceof EntityZombieVillager) {
return ((EntityZombieVillager) entity).getProfession(); return ((EntityZombieVillager)entity).getProfession();
} }
return -1; return -1;
} }

View file

@ -2,9 +2,10 @@ package com.minelittlepony.pony.data;
/** /**
* Interface for enums that can be parsed from an image trigger pixel value. * Interface for enums that can be parsed from an image trigger pixel value.
*
* @author Chris Albers * @author Chris Albers
* *
* @param <T> * @param <T>
*/ */
public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>> { public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>> {
/** /**
@ -13,10 +14,10 @@ public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>>
int getTriggerPixel(); int getTriggerPixel();
/** /**
* Gets the enum value corresponding to the given enum type and pixel value. * Gets the enum value corresponding to the given enum type and pixel value. If none are found, the
* If none are found, the first parameter is returned as the default. * first parameter is returned as the default.
* *
* @param type Return type and default value. * @param type Return type and default value.
* @param pixelValue The pixel colour to search for. * @param pixelValue The pixel colour to search for.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -83,19 +83,19 @@ public class Pony {
MineLittlePony.logger.debug("Obtained skin from resource location {}", resource); MineLittlePony.logger.debug("Obtained skin from resource location {}", resource);
return skinImage; return skinImage;
} catch (IOException ignored) { } } catch (IOException ignored) {}
try { try {
ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resource); ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
if (texture instanceof MixinThreadDownloadImageData) { if (texture instanceof MixinThreadDownloadImageData) {
return ((MixinThreadDownloadImageData) texture).getBufferedImage(); return ((MixinThreadDownloadImageData)texture).getBufferedImage();
} else if (texture instanceof ThreadDownloadImageETag) { } else if (texture instanceof ThreadDownloadImageETag) {
return ((ThreadDownloadImageETag) texture).getBufferedImage(); return ((ThreadDownloadImageETag)texture).getBufferedImage();
} else if (texture instanceof DynamicTextureImage) { } else if (texture instanceof DynamicTextureImage) {
return ((DynamicTextureImage) texture).getImage(); return ((DynamicTextureImage)texture).getImage();
} }
} catch (Exception ignored) { } } catch (Exception ignored) {}
return null; return null;
} }

View file

@ -98,7 +98,8 @@ public class PonyData implements IPonyData {
} }
/** /**
* Parses an image buffer into a new IPonyData representing the values stored in it's individual trigger pixels. * Parses an image buffer into a new IPonyData representing the values stored in it's individual
* trigger pixels.
*/ */
static IPonyData parse(BufferedImage image) { static IPonyData parse(BufferedImage image) {
return new PonyData(image); return new PonyData(image);

View file

@ -53,7 +53,7 @@ public enum TriggerPixels {
return out; return out;
} }
public <T extends Enum<T> & ITriggerPixelMapped<T>> void readFlags(boolean[] out, BufferedImage image) { public <T extends Enum<T> & ITriggerPixelMapped<T>> void readFlags(boolean[] out, BufferedImage image) {
readFlag(out, Channel.RED, image); readFlag(out, Channel.RED, image);
readFlag(out, Channel.GREEN, image); readFlag(out, Channel.GREEN, image);
readFlag(out, Channel.BLUE, image); readFlag(out, Channel.BLUE, image);
@ -85,4 +85,4 @@ public enum TriggerPixels {
return (image.getRGB(x, y) & mask) >> offset; return (image.getRGB(x, y) & mask) >> offset;
} }
} }
} }

View file

@ -37,7 +37,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
this.textureOffsetX = x; this.textureOffsetX = x;
this.textureOffsetY = y; this.textureOffsetY = y;
super.setTextureOffset(x, y); super.setTextureOffset(x, y);
return (T) this; return (T)this;
} }
/** /**
@ -49,7 +49,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
public T mirror(boolean m) { public T mirror(boolean m) {
mirror = m; mirror = m;
return (T) this; return (T)this;
} }
/** /**
@ -60,7 +60,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
} }
public T size(int x, int y) { public T size(int x, int y) {
return (T) setTextureSize(x, y); return (T)setTextureSize(x, y);
} }
/** /**
@ -77,7 +77,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
modelOffsetX = x; modelOffsetX = x;
modelOffsetY = y; modelOffsetY = y;
modelOffsetZ = z; modelOffsetZ = z;
return (T) this; return (T)this;
} }
/** /**
@ -96,12 +96,12 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
rotateAngleX = x; rotateAngleX = x;
rotateAngleY = y; rotateAngleY = y;
rotateAngleZ = z; rotateAngleZ = z;
return (T) this; return (T)this;
} }
/** /**
* Positions a given model in space by setting its offset values divided * Positions a given model in space by setting its offset values divided by 16 to account for
* by 16 to account for scaling applied inside the model. * scaling applied inside the model.
*/ */
public static <T extends ModelRenderer> T at(T renderer, float x, float y, float z) { public static <T extends ModelRenderer> T at(T renderer, float x, float y, float z) {
renderer.offsetX = x / 16; renderer.offsetX = x / 16;
@ -129,12 +129,12 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
*/ */
public T around(float x, float y, float z) { public T around(float x, float y, float z) {
setRotationPoint(x, y, z); setRotationPoint(x, y, z);
return (T) this; return (T)this;
} }
/** /**
* Gets or creates a new child model based on its unique index. * Gets or creates a new child model based on its unique index. New children will be of the same
* New children will be of the same type and inherit the same textures and offsets of the original. * type and inherit the same textures and offsets of the original.
*/ */
public T child(int index) { public T child(int index) {
if (childModels == null || index >= childModels.size()) { if (childModels == null || index >= childModels.size()) {
@ -171,13 +171,13 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
setTextureOffset(tex.textureOffsetX, tex.textureOffsetY).addBox(offX, offY, offZ, width, height, depth); setTextureOffset(tex.textureOffsetX, tex.textureOffsetY).addBox(offX, offY, offZ, width, height, depth);
cubeList.get(cubeList.size() - 1).setBoxName(partName); cubeList.get(cubeList.size() - 1).setBoxName(partName);
return (T) this; return (T)this;
} }
@Override @Override
public T addBox(float offX, float offY, float offZ, int width, int height, int depth) { public T addBox(float offX, float offY, float offZ, int width, int height, int depth) {
addBox(offX, offY, offZ, width, height, depth, 0); addBox(offX, offY, offZ, width, height, depth, 0);
return (T) this; return (T)this;
} }
@Override @Override

View file

@ -34,7 +34,7 @@ public class LevitatingItemRenderer {
setColor(glowColor); setColor(glowColor);
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
((IRenderItem) renderItem).useTransparency(true); ((IRenderItem)renderItem).useTransparency(true);
PonySkullRenderer.ponyInstance.useTransparency(true); PonySkullRenderer.ponyInstance.useTransparency(true);
scale(1.1, 1.1, 1.1); scale(1.1, 1.1, 1.1);
@ -44,7 +44,7 @@ public class LevitatingItemRenderer {
translate(0.01F, -0.01F, -0.02F); translate(0.01F, -0.01F, -0.02F);
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT); renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
((IRenderItem) renderItem).useTransparency(false); ((IRenderItem)renderItem).useTransparency(false);
PonySkullRenderer.ponyInstance.useTransparency(false); PonySkullRenderer.ponyInstance.useTransparency(false);
unsetColor(); unsetColor();
enableLighting(); enableLighting();

View file

@ -22,4 +22,4 @@ public abstract class PonySkull implements ISkull {
public void render(float animateTicks, float rotation, float scale) { public void render(float animateTicks, float rotation, float scale) {
ponyHead.render(null, animateTicks, 0, 0, rotation, 0, scale); ponyHead.render(null, animateTicks, 0, 0, rotation, 0, scale);
} }
} }

View file

@ -30,8 +30,8 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
private static final Map<Integer, ISkull> skullMap = new HashMap<>(); private static final Map<Integer, ISkull> skullMap = new HashMap<>();
/** /**
* Resolves the games skull renderer to either a specialised pony skull renderer * Resolves the games skull renderer to either a specialised pony skull renderer or some other skull
* or some other skull renderer depending on the ponyskulls state. * renderer depending on the ponyskulls state.
* *
* Original/Existing renderer is stored to a backup variable as a fallback in case of mods. * Original/Existing renderer is stored to a backup variable as a fallback in case of mods.
*/ */

View file

@ -21,7 +21,7 @@ import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
// TODO: A lot of this duplicates RenderPonyPlayer // TODO: A lot of this duplicates RenderPonyPlayer
// and is the whole reason we had this scaling bug in the first place. // and is the whole reason we had this scaling bug in the first place.
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony<T> { public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony<T> {
protected final RenderPony<T> renderPony = new RenderPony<>(this); protected final RenderPony<T> renderPony = new RenderPony<>(this);

View file

@ -28,13 +28,16 @@ public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements L
* Renders this layer. * Renders this layer.
* *
* @param entity The entity we're being called for. * @param entity The entity we're being called for.
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount. * @param move Entity motion parameter - i.e. velocity in no specific direction used in
* bipeds to calculate step amount.
* @param swing Degree to which each 'limb' swings. * @param swing Degree to which each 'limb' swings.
* @param partialTicks Render partial ticks * @param partialTicks Render partial ticks
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}. * @param ticks Total whole and partial ticks since the entity's existance. Used in
* animations together with {@code swing} and {@code move}.
* @param headYaw Horizontal head motion in radians. * @param headYaw Horizontal head motion in radians.
* @param headPitch Vertical head motion in radians. * @param headPitch Vertical head motion in radians.
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}. * @param scale Scaling factor used to render this model. Determined by the return value of
* {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
*/ */
protected abstract void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale); protected abstract void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale);

View file

@ -51,7 +51,7 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
private EntityLivingBase renderShoulderEntity(AbstractClientPlayer player, @Nullable EntityLivingBase entity, NBTTagCompound shoulderTag, float headYaw, float headPitch, boolean left) { private EntityLivingBase renderShoulderEntity(AbstractClientPlayer player, @Nullable EntityLivingBase entity, NBTTagCompound shoulderTag, float headYaw, float headPitch, boolean left) {
if (entity == null || !entity.getUniqueID().equals(shoulderTag.getUniqueId("UUID"))) { if (entity == null || !entity.getUniqueID().equals(shoulderTag.getUniqueId("UUID"))) {
entity = (EntityLivingBase) EntityList.createEntityFromNBT(shoulderTag, player.world); entity = (EntityLivingBase)EntityList.createEntityFromNBT(shoulderTag, player.world);
// this isn't an entity. // this isn't an entity.
if (entity == null) { if (entity == null) {
return null; return null;

View file

@ -36,7 +36,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
pushMatrix(); pushMatrix();
if (model instanceof IModel) { if (model instanceof IModel) {
((IModel) model).transform(BodyPart.LEGS); ((IModel)model).transform(BodyPart.LEGS);
} }
if (model.isChild) { if (model.isChild) {

View file

@ -37,4 +37,4 @@ public abstract class LayerOverlayBase<T extends EntityLiving> implements LayerR
protected abstract ResourceLocation getOverlayTexture(); protected abstract ResourceLocation getOverlayTexture();
} }

View file

@ -56,7 +56,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) { if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) {
ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
ModelPonyArmor armour = getArmorModel(entity, itemstack, armorSlot, pony.getArmor().getArmorForSlot(armorSlot)); ModelPonyArmor armour = getArmorModel(entity, itemstack, armorSlot, pony.getArmor().getArmorForSlot(armorSlot));
armour.setModelAttributes(pony.getBody()); armour.setModelAttributes(pony.getBody());
@ -85,7 +85,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
} }
private Tuple<ResourceLocation, Boolean> getArmorTexture(T entity, ItemStack itemstack, EntityEquipmentSlot slot, @Nullable String type) { private Tuple<ResourceLocation, Boolean> getArmorTexture(T 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";
@ -170,7 +170,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
} }
if (model instanceof IEquestrianArmor) { if (model instanceof IEquestrianArmor) {
return ((IEquestrianArmor) model).getArmorForSlot(slot); return ((IEquestrianArmor)model).getArmorForSlot(slot);
} }
return def; return def;

View file

@ -44,7 +44,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
double sin = MathHelper.sin(motionYaw * PI / 180); double sin = MathHelper.sin(motionYaw * PI / 180);
double cos = -MathHelper.cos(motionYaw * PI / 180); double cos = -MathHelper.cos(motionYaw * PI / 180);
float capeMotionY = (float) capeY * 10; float capeMotionY = (float)capeY * 10;
if (capeMotionY < -6) { if (capeMotionY < -6) {
capeMotionY = -6; capeMotionY = -6;
@ -53,9 +53,9 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
capeMotionY = 32; capeMotionY = 32;
} }
float capeMotionX = (float) (capeX * sin + capeZ * cos) * 100; float capeMotionX = (float)(capeX * sin + capeZ * cos) * 100;
float diagMotion = (float) (capeX * cos - capeZ * sin) * 100; float diagMotion = (float)(capeX * cos - capeZ * sin) * 100;
if (capeMotionX < 0) { if (capeMotionX < 0) {
capeMotionX = 0; capeMotionX = 0;
@ -65,7 +65,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
capeMotionY += MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * scale) * 6) * 32 * camera; capeMotionY += MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * scale) * 6) * 32 * camera;
rotate(2 + capeMotionX / 12 + capeMotionY, 1, 0, 0); rotate(2 + capeMotionX / 12 + capeMotionY, 1, 0, 0);
rotate( diagMotion / 2, 0, 0, 1); rotate(diagMotion / 2, 0, 0, 1);
rotate(-diagMotion / 2, 0, 1, 0); rotate(-diagMotion / 2, 0, 1, 0);
rotate(180, 0, 0, 1); rotate(180, 0, 0, 1);
rotate(90, 1, 0, 0); rotate(90, 1, 0, 0);

View file

@ -101,7 +101,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
} }
private ModelWrapper getModel() { private ModelWrapper getModel() {
return ((IRenderPony) renderer).getModelWrapper(); return ((IRenderPony)renderer).getModelWrapper();
} }
@Override @Override

View file

@ -51,7 +51,7 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
protected ResourceLocation getElytraTexture(T entity) { protected ResourceLocation getElytraTexture(T entity) {
if (entity instanceof AbstractClientPlayer) { if (entity instanceof AbstractClientPlayer) {
AbstractClientPlayer player = (AbstractClientPlayer) entity; AbstractClientPlayer player = (AbstractClientPlayer)entity;
ResourceLocation result; ResourceLocation result;

View file

@ -1,7 +1,10 @@
package com.minelittlepony.render.plane; package com.minelittlepony.render.plane;
enum Face { enum Face {
NORTH, SOUTH, NORTH,
UP, DOWN, SOUTH,
EAST, WEST; UP,
} DOWN,
EAST,
WEST;
}

View file

@ -107,7 +107,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
public float prepareScale(AbstractClientPlayer player, float ticks) { public float prepareScale(AbstractClientPlayer player, float ticks) {
if (!player.isRiding() && !player.isPlayerSleeping()) { if (!player.isRiding() && !player.isPlayerSleeping()) {
float x = player.width/2; float x = player.width / 2;
float y = 0; float y = 0;
if (player.isSneaking()) { if (player.isSneaking()) {

View file

@ -79,4 +79,4 @@ public enum MobRenderers implements Setting {
} }
public abstract void register(boolean state, PonyRenderManager pony, RenderManager manager); public abstract void register(boolean state, PonyRenderManager pony, RenderManager manager);
} }

View file

@ -30,7 +30,7 @@ public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager
@Override @Override
protected void applyRotations(EntityZombieVillager entity, float move, float rotationYaw, float ticks) { protected void applyRotations(EntityZombieVillager entity, float move, float rotationYaw, float ticks) {
if (entity.isConverting()) { if (entity.isConverting()) {
rotationYaw += (float) (Math.cos(entity.ticksExisted * 3.25D) * (Math.PI / 4)); rotationYaw += (float)(Math.cos(entity.ticksExisted * 3.25D) * (Math.PI / 4));
} }
super.applyRotations(entity, move, rotationYaw, ticks); super.applyRotations(entity, move, rotationYaw, ticks);

View file

@ -53,8 +53,7 @@ public abstract class SensibleConfig {
public boolean setValue(Setting key, boolean value) { public boolean setValue(Setting key, boolean value) {
try { try {
this.getClass().getField(key.name().toLowerCase()).setBoolean(this, value); this.getClass().getField(key.name().toLowerCase()).setBoolean(this, value);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignored) { } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignored) {}
}
return value; return value;
} }
} }

View file

@ -22,7 +22,7 @@ public class PostureFlight implements PonyPosture<AbstractClientPlayer> {
float modelYaw = MathUtil.sensibleAngle(player.renderYawOffset); float modelYaw = MathUtil.sensibleAngle(player.renderYawOffset);
// detecting that we're flying backwards and roll must be inverted // detecting that we're flying backwards and roll must be inverted
if (Math.abs(MathUtil.sensibleAngle((float) Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) { if (Math.abs(MathUtil.sensibleAngle((float)Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) {
roll *= -1; roll *= -1;
} }
@ -53,11 +53,11 @@ public class PostureFlight implements PonyPosture<AbstractClientPlayer> {
@Override @Override
public void transform(AbstractPonyModel model, AbstractClientPlayer player, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) { public void transform(AbstractPonyModel model, AbstractClientPlayer player, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) {
model.motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ); model.motionPitch = (float)calculateIncline(player, motionX, motionY, motionZ);
GlStateManager.rotate(model.motionPitch, 1, 0, 0); GlStateManager.rotate(model.motionPitch, 1, 0, 0);
float roll = (float)calculateRoll(player, motionX, motionY, motionZ); float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
roll = model.getMetadata().getInterpolator().interpolate("pegasusRoll", roll, 10); roll = model.getMetadata().getInterpolator().interpolate("pegasusRoll", roll, 10);

View file

@ -27,10 +27,10 @@ public abstract class Box<T extends ModelRenderer> extends ModelBox {
/** /**
* Creates a new quad with the given spacial vertices. * Creates a new quad with the given spacial vertices.
*/ */
protected Quad quad(int startX, int width, int startY, int height, Vertex ...verts) { protected Quad quad(int startX, int width, int startY, int height, Vertex... verts) {
return new Quad(verts, return new Quad(verts,
startX, startY, startX, startY,
startX + width, startY + height, startX + width, startY + height,
parent.textureWidth, parent.textureHeight); parent.textureWidth, parent.textureHeight);
} }
} }

View file

@ -7,4 +7,4 @@ public class Quad extends TexturedQuad {
public Quad(Vertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) { public Quad(Vertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) {
super(vertices, texcoordU1, texcoordV1, texcoordU2, texcoordV2, textureWidth, textureHeight); super(vertices, texcoordU1, texcoordV1, texcoordU2, texcoordV2, textureWidth, textureHeight);
} }
} }