diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/DynamicTextureImage.java b/src/hdskins/java/com/voxelmodpack/hdskins/DynamicTextureImage.java index d7598b08..87d7c945 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/DynamicTextureImage.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/DynamicTextureImage.java @@ -10,7 +10,7 @@ public class DynamicTextureImage extends DynamicTexture { public DynamicTextureImage(BufferedImage bufferedImage) { super(bufferedImage); - this.image = bufferedImage; + image = bufferedImage; } public BufferedImage getImage() { @@ -20,7 +20,7 @@ public class DynamicTextureImage extends DynamicTexture { @Override public void deleteGlTexture() { super.deleteGlTexture(); - this.image = null; + image = null; } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/Later.java b/src/hdskins/java/com/voxelmodpack/hdskins/Later.java index 2e979663..f19463a4 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/Later.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/Later.java @@ -22,7 +22,9 @@ public final class Later extends Thread { @Override public void run() { try { - if (delay > 0) sleep(delay); + if (delay > 0) { + sleep(delay); + } } catch (InterruptedException e) {} super.run(); } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTexture.java b/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTexture.java index e5430ee2..bf99b60a 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTexture.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTexture.java @@ -19,13 +19,13 @@ public class PreviewTexture extends ThreadDownloadImageData { } public boolean isTextureUploaded() { - return uploaded && this.getGlTextureId() > -1; + return uploaded && getGlTextureId() > -1; } @Override public void deleteGlTexture() { super.deleteGlTexture(); - this.uploaded = true; + uploaded = true; } public boolean hasModel() { diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTextureManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTextureManager.java index 057fd56f..b480f51e 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTextureManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/PreviewTextureManager.java @@ -34,19 +34,19 @@ public class PreviewTextureManager { IImageBuffer buffer = new ImageBufferDownloadHD(); PreviewTexture skinTexture = new PreviewTexture(texture.getMetadata("model"), texture.getUrl(), def, type == MinecraftProfileTexture.Type.SKIN ? new IImageBuffer() { - @Override - @Nullable - public BufferedImage parseUserSkin(BufferedImage image) { - return buffer.parseUserSkin(image); - } + @Override + @Nullable + public BufferedImage parseUserSkin(BufferedImage image) { + return buffer.parseUserSkin(image); + } - @Override - public void skinAvailable() { - if (callback != null) { - callback.skinAvailable(type, location, new MinecraftProfileTexture(texture.getUrl(), Maps.newHashMap())); - } - } - } : null); + @Override + public void skinAvailable() { + if (callback != null) { + callback.skinAvailable(type, location, new MinecraftProfileTexture(texture.getUrl(), Maps.newHashMap())); + } + } + } : null); Minecraft.getMinecraft().getTextureManager().loadTexture(location, skinTexture); return skinTexture; diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/ThreadDownloadImageETag.java b/src/hdskins/java/com/voxelmodpack/hdskins/ThreadDownloadImageETag.java index 514aac1a..80e6c243 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/ThreadDownloadImageETag.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/ThreadDownloadImageETag.java @@ -47,35 +47,36 @@ public class ThreadDownloadImageETag extends SimpleTexture { public ThreadDownloadImageETag(@Nonnull File cacheFileIn, String imageUrlIn, ResourceLocation defLocation, @Nullable IImageBuffer imageBufferIn) { super(defLocation); - this.cacheFile = cacheFileIn; - this.eTagFile = new File(cacheFile.getParentFile(), cacheFile.getName() + ".etag"); - this.imageUrl = imageUrlIn; - this.imageBuffer = imageBufferIn; + cacheFile = cacheFileIn; + eTagFile = new File(cacheFile.getParentFile(), cacheFile.getName() + ".etag"); + imageUrl = imageUrlIn; + imageBuffer = imageBufferIn; } private void checkTextureUploaded() { - if (!this.textureUploaded) { - if (this.bufferedImage != null) { - if (this.textureLocation != null) { - this.deleteGlTexture(); + if (!textureUploaded) { + if (bufferedImage != null) { + if (textureLocation != null) { + deleteGlTexture(); } - TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage); - this.textureUploaded = true; + TextureUtil.uploadTextureImage(super.getGlTextureId(), bufferedImage); + textureUploaded = true; } } } + @Override public int getGlTextureId() { - this.checkTextureUploaded(); + checkTextureUploaded(); return super.getGlTextureId(); } private void setBufferedImage(@Nonnull BufferedImage bufferedImageIn) { - this.bufferedImage = bufferedImageIn; + bufferedImage = bufferedImageIn; - if (this.imageBuffer != null) { - this.imageBuffer.skinAvailable(); + if (imageBuffer != null) { + imageBuffer.skinAvailable(); } } @@ -84,15 +85,16 @@ public class ThreadDownloadImageETag extends SimpleTexture { return bufferedImage; } + @Override public void loadTexture(IResourceManager resourceManager) throws IOException { - if (this.bufferedImage == null && this.textureLocation != null) { + if (bufferedImage == null && textureLocation != null) { super.loadTexture(resourceManager); } - if (this.imageThread == null) { - this.imageThread = new Thread(this::loadTexture, "Texture Downloader #" + THREAD_ID.incrementAndGet()); - this.imageThread.setDaemon(true); - this.imageThread.start(); + if (imageThread == null) { + imageThread = new Thread(this::loadTexture, "Texture Downloader #" + THREAD_ID.incrementAndGet()); + imageThread.setDaemon(true); + imageThread.start(); } } @@ -133,8 +135,9 @@ public class ThreadDownloadImageETag extends SimpleTexture { } LOGGER.error("Couldn't load skin {} ", imageUrl, e); } finally { - if (response != null) + if (response != null) { EntityUtils.consumeQuietly(response.getEntity()); + } } } @@ -149,8 +152,8 @@ public class ThreadDownloadImageETag extends SimpleTexture { } private void clearCache() { - FileUtils.deleteQuietly(this.cacheFile); - FileUtils.deleteQuietly(this.eTagFile); + FileUtils.deleteQuietly(cacheFile); + FileUtils.deleteQuietly(eTagFile); } private boolean checkETag(HttpResponse response) { diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/CubeMap.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/CubeMap.java index ecfd9e02..e230549a 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/CubeMap.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/CubeMap.java @@ -61,13 +61,13 @@ public class CubeMap { public void setSource(String source) { cubemapTextures = new ResourceLocation[] { - new ResourceLocation(String.format(source, 0)), - new ResourceLocation(String.format(source, 1)), - new ResourceLocation(String.format(source, 2)), - new ResourceLocation(String.format(source, 3)), - new ResourceLocation(String.format(source, 4)), - new ResourceLocation(String.format(source, 5)) - }; + new ResourceLocation(String.format(source, 0)), + new ResourceLocation(String.format(source, 1)), + new ResourceLocation(String.format(source, 2)), + new ResourceLocation(String.format(source, 3)), + new ResourceLocation(String.format(source, 4)), + new ResourceLocation(String.format(source, 5)) + }; } public void init() { @@ -107,7 +107,7 @@ public class CubeMap { } private void renderCubeMapTexture(float partialTick) { - this.setupCubemapCamera(); + setupCubemapCamera(); color(1, 1, 1, 1); rotate(180, 1, 0, 0); @@ -177,7 +177,7 @@ public class CubeMap { enableCull(); enableAlpha(); enableDepth(); - this.revertPanoramaMatrix(); + revertPanoramaMatrix(); } private void rotateAndBlurCubemap() { diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java index b51ae3e9..c98254e3 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java @@ -11,29 +11,29 @@ import net.minecraft.world.storage.WorldInfo; public class DummyWorld extends World { - public DummyWorld() { - super(null, new WorldInfo( - new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "MpServer"), - new WorldProviderSurface(), null, true); - } + public DummyWorld() { + super(null, new WorldInfo( + new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "MpServer"), + new WorldProviderSurface(), null, true); + } - @Override - protected IChunkProvider createChunkProvider() { - return null; - } + @Override + protected IChunkProvider createChunkProvider() { + return null; + } - @Override - protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { - return true; - } + @Override + protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { + return true; + } - @Override - public float getLightBrightness(BlockPos pos) { - return 1; - } + @Override + public float getLightBrightness(BlockPos pos) { + return 1; + } - @Override - public BlockPos getSpawnPoint() { - return BlockPos.ORIGIN; - } + @Override + public BlockPos getSpawnPoint() { + return BlockPos.ORIGIN; + } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java index c9a05669..99543afa 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java @@ -39,7 +39,7 @@ public class EntityPlayerModel extends EntityLivingBase { EntityEquipmentSlot.LEGS, ItemStack.EMPTY, EntityEquipmentSlot.FEET, ItemStack.EMPTY, EntityEquipmentSlot.MAINHAND, ItemStack.EMPTY - )); + )); private PreviewTexture remoteSkinTexture; private ResourceLocation remoteSkinResource; @@ -59,38 +59,38 @@ public class EntityPlayerModel extends EntityLivingBase { public EntityPlayerModel(GameProfile profile) { super(new DummyWorld()); this.profile = profile; - this.textureManager = Minecraft.getMinecraft().getTextureManager(); - this.remoteSkinResource = new ResourceLocation("skins/preview_" + this.profile.getName() + ".png"); - this.remoteElytraResource = new ResourceLocation("elytras/preview_" + this.profile.getName() + ".png"); - this.localSkinResource = getBlankSkin(); - this.localElytraResource = getBlankElytra(); - this.textureManager.deleteTexture(this.remoteSkinResource); - this.textureManager.deleteTexture(this.remoteElytraResource); + textureManager = Minecraft.getMinecraft().getTextureManager(); + remoteSkinResource = new ResourceLocation("skins/preview_" + this.profile.getName() + ".png"); + remoteElytraResource = new ResourceLocation("elytras/preview_" + this.profile.getName() + ".png"); + localSkinResource = getBlankSkin(); + localElytraResource = getBlankElytra(); + textureManager.deleteTexture(remoteSkinResource); + textureManager.deleteTexture(remoteElytraResource); } public void reloadRemoteSkin(SkinManager.SkinAvailableCallback listener) { - this.remoteSkin = true; - if (this.remoteSkinTexture != null) { - this.textureManager.deleteTexture(this.remoteSkinResource); + remoteSkin = true; + if (remoteSkinTexture != null) { + textureManager.deleteTexture(remoteSkinResource); } - if (this.remoteElytraTexture != null) { - this.textureManager.deleteTexture(this.remoteElytraResource); + if (remoteElytraTexture != null) { + textureManager.deleteTexture(remoteElytraResource); } - PreviewTextureManager ptm = HDSkinManager.getPreviewTextureManager(this.profile); + PreviewTextureManager ptm = HDSkinManager.getPreviewTextureManager(profile); - this.remoteSkinTexture = ptm.getPreviewTexture(this.remoteSkinResource, Type.SKIN, getBlankSkin(), listener); - this.remoteElytraTexture = ptm.getPreviewTexture(this.remoteElytraResource, Type.ELYTRA, getBlankElytra(), null); + remoteSkinTexture = ptm.getPreviewTexture(remoteSkinResource, Type.SKIN, getBlankSkin(), listener); + remoteElytraTexture = ptm.getPreviewTexture(remoteElytraResource, Type.ELYTRA, getBlankElytra(), null); } public void setLocalTexture(File skinTextureFile, Type type) { if (skinTextureFile.exists()) { if (type == Type.SKIN) { - this.remoteSkin = false; - if (this.localSkinTexture != null) { - this.textureManager.deleteTexture(this.localSkinResource); - this.localSkinTexture = null; + remoteSkin = false; + if (localSkinTexture != null) { + textureManager.deleteTexture(localSkinResource); + localSkinTexture = null; } BufferedImage bufferedImage; @@ -99,33 +99,33 @@ public class EntityPlayerModel extends EntityLivingBase { bufferedImage = new ImageBufferDownloadHD().parseUserSkin(image); assert bufferedImage != null; } catch (IOException var4) { - this.localSkinResource = getBlankSkin(); + localSkinResource = getBlankSkin(); var4.printStackTrace(); return; } - this.localSkinTexture = new DynamicTextureImage(bufferedImage); - this.localSkinResource = this.textureManager.getDynamicTextureLocation("localSkinPreview", this.localSkinTexture); - this.hasLocalTexture = true; + localSkinTexture = new DynamicTextureImage(bufferedImage); + localSkinResource = textureManager.getDynamicTextureLocation("localSkinPreview", localSkinTexture); + hasLocalTexture = true; } else if (type == Type.ELYTRA) { - this.remoteSkin = false; - if (this.localElytraTexture != null) { - this.textureManager.deleteTexture(this.localElytraResource); - this.localElytraTexture = null; + remoteSkin = false; + if (localElytraTexture != null) { + textureManager.deleteTexture(localElytraResource); + localElytraTexture = null; } BufferedImage bufferedImage; try { bufferedImage = ImageIO.read(skinTextureFile); } catch (IOException var4) { - this.localElytraResource = getBlankElytra(); + localElytraResource = getBlankElytra(); var4.printStackTrace(); return; } - this.localElytraTexture = new DynamicTextureImage(bufferedImage); - this.localElytraResource = this.textureManager.getDynamicTextureLocation("localElytraPreview", this.localElytraTexture); - this.hasLocalTexture = true; + localElytraTexture = new DynamicTextureImage(bufferedImage); + localElytraResource = textureManager.getDynamicTextureLocation("localElytraPreview", localElytraTexture); + hasLocalTexture = true; } } } @@ -139,35 +139,35 @@ public class EntityPlayerModel extends EntityLivingBase { } public boolean isUsingLocalTexture() { - return !this.remoteSkin && this.hasLocalTexture; + return !remoteSkin && hasLocalTexture; } public boolean isTextureSetupComplete() { - return (this.remoteSkin && this.remoteSkinTexture != null) && this.remoteSkinTexture.isTextureUploaded(); + return remoteSkin && remoteSkinTexture != null && remoteSkinTexture.isTextureUploaded(); } public void releaseTextures() { - if (this.localSkinTexture != null) { - this.textureManager.deleteTexture(this.localSkinResource); - this.localSkinTexture = null; - this.localSkinResource = getBlankSkin(); - this.hasLocalTexture = false; + if (localSkinTexture != null) { + textureManager.deleteTexture(localSkinResource); + localSkinTexture = null; + localSkinResource = getBlankSkin(); + hasLocalTexture = false; } - if (this.localElytraTexture != null) { - this.textureManager.deleteTexture(this.localElytraResource); - this.localElytraTexture = null; - this.localElytraResource = getBlankElytra(); - this.hasLocalTexture = false; + if (localElytraTexture != null) { + textureManager.deleteTexture(localElytraResource); + localElytraTexture = null; + localElytraResource = getBlankElytra(); + hasLocalTexture = false; } } public ResourceLocation getSkinTexture() { - return this.remoteSkin ? (this.remoteSkinTexture != null ? this.remoteSkinResource - : DefaultPlayerSkin.getDefaultSkin(entityUniqueID)) : this.localSkinResource; + return remoteSkin ? remoteSkinTexture != null ? remoteSkinResource + : DefaultPlayerSkin.getDefaultSkin(entityUniqueID) : localSkinResource; } public ResourceLocation getElytraTexture() { - return this.remoteSkin && this.remoteElytraTexture != null ? this.remoteElytraResource : localElytraResource; + return remoteSkin && remoteElytraTexture != null ? remoteElytraResource : localElytraResource; } public void setPreviewThinArms(boolean thinArms) { @@ -185,27 +185,27 @@ public class EntityPlayerModel extends EntityLivingBase { @Override public void swingArm(EnumHand hand) { super.swingArm(hand); - if (!this.isSwingInProgress || this.swingProgressInt >= 4 || this.swingProgressInt < 0) { - this.swingProgressInt = -1; - this.isSwingInProgress = true; - this.swingingHand = hand; + if (!isSwingInProgress || swingProgressInt >= 4 || swingProgressInt < 0) { + swingProgressInt = -1; + isSwingInProgress = true; + swingingHand = hand; } } public void updateModel() { - this.prevSwingProgress = this.swingProgress; - if (this.isSwingInProgress) { - ++this.swingProgressInt; - if (this.swingProgressInt >= 8) { - this.swingProgressInt = 0; - this.isSwingInProgress = false; + prevSwingProgress = swingProgress; + if (isSwingInProgress) { + ++swingProgressInt; + if (swingProgressInt >= 8) { + swingProgressInt = 0; + isSwingInProgress = false; } } else { - this.swingProgressInt = 0; + swingProgressInt = 0; } - this.swingProgress = this.swingProgressInt / 8.0F; + swingProgress = swingProgressInt / 8.0F; } @Override diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GLWindow.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GLWindow.java index b62d6e83..59f554d3 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GLWindow.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GLWindow.java @@ -5,7 +5,6 @@ import com.voxelmodpack.hdskins.upload.awt.FileDropper; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.DefaultResourcePack; -import net.minecraft.launchwrapper.injector.VanillaTweakInjector; import net.minecraft.util.ResourceLocation; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; @@ -21,7 +20,6 @@ import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.TooManyListenersException; @@ -112,7 +110,7 @@ public class GLWindow extends DropTarget { @Override public void windowClosed(WindowEvent windowEvent) { if (!closeRequested) { - for (Window w : Frame.getWindows()) { + for (Window w : Window.getWindows()) { w.dispose(); } @@ -174,7 +172,7 @@ public class GLWindow extends DropTarget { if (isFullscreen) { Display.setFullscreen(true); } else { - if ((windowState & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH) { + if ((windowState & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) { Display.setLocation(0, 0); Display.setDisplayMode(Display.getDesktopDisplayMode()); } else { @@ -193,7 +191,7 @@ public class GLWindow extends DropTarget { frame.setVisible(false); frame.dispose(); - for (Window w : Frame.getWindows()) { + for (Window w : Window.getWindows()) { w.dispose(); } @@ -213,7 +211,7 @@ public class GLWindow extends DropTarget { ArrayList images = Lists.newArrayList( ImageIO.read(pack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"))), ImageIO.read(pack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"))) - ); + ); Frame[] frames = Frame.getFrames(); diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiItemStackButton.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiItemStackButton.java index d4d7eede..79c88a13 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiItemStackButton.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/GuiItemStackButton.java @@ -17,6 +17,6 @@ public class GuiItemStackButton extends GuiButton { public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { super.drawButton(mc, mouseX, mouseY, partialTicks); - mc.getRenderItem().renderItemIntoGUI(itemStack, this.x + 2, this.y + 2); + mc.getRenderItem().renderItemIntoGUI(itemStack, x + 2, y + 2); } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/HDSkinsConfigPanel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/HDSkinsConfigPanel.java index ed2b89e5..0d9b25d2 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/HDSkinsConfigPanel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/HDSkinsConfigPanel.java @@ -20,20 +20,20 @@ public class HDSkinsConfigPanel implements ConfigPanel { @Override public void onPanelShown(ConfigPanelHost host) { - this.mod = LiteLoader.getInstance().getMod(LiteModHDSkins.class); + mod = LiteLoader.getInstance().getMod(LiteModHDSkins.class); - this.button = new GuiButton(0, 40, 70, 100, 20, "Clear Skin Cache"); - this.checkbox = new GuiCheckbox(1, 40, 40, "Experimental Skin Drop"); + button = new GuiButton(0, 40, 70, 100, 20, "Clear Skin Cache"); + checkbox = new GuiCheckbox(1, 40, 40, "Experimental Skin Drop"); - this.checkbox.checked = mod.experimentalSkinDrop; + checkbox.checked = mod.experimentalSkinDrop; } @Override public void drawPanel(ConfigPanelHost host, int mouseX, int mouseY, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); - this.button.drawButton(mc, mouseX, mouseY, partialTicks); - this.checkbox.drawButton(mc, mouseX, mouseY, partialTicks); + button.drawButton(mc, mouseX, mouseY, partialTicks); + checkbox.drawButton(mc, mouseX, mouseY, partialTicks); } @Override diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java index 544eab00..ac21a13d 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java @@ -90,7 +90,7 @@ public class RenderPlayerModel extends RenderLiving @Override public void doRender(M par1Entity, double par2, double par4, double par6, float par8, float par9) { ModelPlayer player = this.getEntityModel(par1Entity); - this.mainModel = player; + mainModel = player; Set parts = Minecraft.getMinecraft().gameSettings.getModelParts(); player.bipedHeadwear.isHidden = !parts.contains(EnumPlayerModelParts.HAT); diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinGuiMainMenu.java b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinGuiMainMenu.java index 2f0c0436..e5bf5c34 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinGuiMainMenu.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinGuiMainMenu.java @@ -21,13 +21,13 @@ public class MixinGuiMainMenu extends GuiScreen { private void onInit(CallbackInfo ci) { ItemStack itemStack = new ItemStack(Items.LEATHER_LEGGINGS); Items.LEATHER_LEGGINGS.setColor(itemStack, 0x3c5dcb); - this.buttonList.add(new GuiItemStackButton(SKINS, width - 50, height - 50, itemStack)); + buttonList.add(new GuiItemStackButton(SKINS, width - 50, height - 50, itemStack)); } @Inject(method = "actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V", at = @At("RETURN")) private void onActionPerformed(GuiButton button, CallbackInfo ci) { if (button.id == SKINS) { - this.mc.displayGuiScreen(HDSkinManager.INSTANCE.createSkinsGui()); + mc.displayGuiScreen(HDSkinManager.INSTANCE.createSkinsGui()); } } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinImageBufferDownload.java b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinImageBufferDownload.java index 58be43b9..18fa35f0 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinImageBufferDownload.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinImageBufferDownload.java @@ -17,7 +17,7 @@ public abstract class MixinImageBufferDownload implements IImageBuffer { @Inject( method = "parseUserSkin(Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage;", at = @At("RETURN"), - cancellable = true) + cancellable = true) private void update(BufferedImage image, CallbackInfoReturnable ci) { // convert skins from mojang server BufferedImage image2 = ci.getReturnValue(); diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java index 432c383d..c107ad98 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinPlayerInfo.java @@ -57,8 +57,9 @@ public abstract class MixinPlayerInfo { MinecraftProfileTexture skin = HDSkinManager.INSTANCE.getProfileData(getGameProfile()).get(Type.SKIN); if (skin != null) { String type = skin.getMetadata("model"); - if (type == null) + if (type == null) { type = "default"; + } String type1 = type; Optional texture = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), Type.SKIN, false); diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinSkullRenderer.java b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinSkullRenderer.java index dda9662c..9f96b1c2 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinSkullRenderer.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/mixin/MixinSkullRenderer.java @@ -25,15 +25,17 @@ public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true); - if (skin.isPresent()) + if (skin.isPresent()) { // rebind bindTexture(skin.get()); - else + } else { bindTexture(rl); - } else + } + } else { bindTexture(rl); + } } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java b/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java index 6a4ff50f..1d4154d5 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java @@ -21,7 +21,7 @@ public class ImageLoader implements Supplier { private final ResourceLocation original; public ImageLoader(ResourceLocation loc) { - this.original = loc; + original = loc; } @Override @@ -34,7 +34,7 @@ public class ImageLoader implements Supplier { } if (updated == image) { // don't load a new image - return this.original; + return original; } return addTaskAndGet(() -> loadSkin(updated)); } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java index d02b22df..2d91f64c 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/resource/SkinResourceManager.java @@ -75,9 +75,10 @@ public class SkinResourceManager implements IResourceManagerReloadListener { @Nullable public ResourceLocation getPlayerTexture(GameProfile profile, Type type) { - if (type != Type.SKIN) + if (type != Type.SKIN) { // not supported return null; + } Skin skin = getSkin(profile); if (skin != null) { @@ -102,11 +103,11 @@ public class SkinResourceManager implements IResourceManagerReloadListener { private void loadSkinResource(@Nullable final ResourceLocation res) { if (res != null) { // read and convert in a new thread - this.inProgress.computeIfAbsent(res, r -> CompletableFuture.supplyAsync(new ImageLoader(r), executor) + inProgress.computeIfAbsent(res, r -> CompletableFuture.supplyAsync(new ImageLoader(r), executor) .whenComplete((loc, t) -> { - if (loc != null) + if (loc != null) { converted.put(res, loc); - else { + } else { LogManager.getLogger().warn("Errored while processing {}. Using original.", res, t); converted.put(res, res); } @@ -119,9 +120,9 @@ public class SkinResourceManager implements IResourceManagerReloadListener { @Nullable private Skin getSkin(GameProfile profile) { - Skin skin = this.uuidSkins.get(profile.getId()); + Skin skin = uuidSkins.get(profile.getId()); if (skin == null) { - skin = this.namedSkins.get(profile.getName()); + skin = namedSkins.get(profile.getName()); } return skin; } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/skins/IndentedToStringStyle.java b/src/hdskins/java/com/voxelmodpack/hdskins/skins/IndentedToStringStyle.java index 44255b78..4140885a 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/skins/IndentedToStringStyle.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/skins/IndentedToStringStyle.java @@ -10,11 +10,11 @@ public class IndentedToStringStyle extends ToStringStyle { public static final ToStringStyle INSTANCE = new IndentedToStringStyle(); private IndentedToStringStyle() { - this.setContentStart(null); - this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + " "); - this.setFieldSeparatorAtStart(true); - this.setContentEnd(null); - this.setUseIdentityHashCode(false); - this.setUseShortClassName(true); + setContentStart(null); + setFieldSeparator(SystemUtils.LINE_SEPARATOR + " "); + setFieldSeparatorAtStart(true); + setContentEnd(null); + setUseIdentityHashCode(false); + setUseShortClassName(true); } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/skins/LegacySkinServer.java b/src/hdskins/java/com/voxelmodpack/hdskins/skins/LegacySkinServer.java index 418d0fd3..bca30b67 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/skins/LegacySkinServer.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/skins/LegacySkinServer.java @@ -46,7 +46,7 @@ public class LegacySkinServer implements SkinServer { @Override public Map getPreviewTextures(GameProfile profile) { - if (Strings.isNullOrEmpty(this.gateway)) { + if (Strings.isNullOrEmpty(gateway)) { return Collections.emptyMap(); } Map map = new EnumMap<>(MinecraftProfileTexture.Type.class); @@ -61,7 +61,7 @@ public class LegacySkinServer implements SkinServer { ImmutableMap.Builder builder = ImmutableMap.builder(); for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) { - String url = getPath(this.address, type, profile); + String url = getPath(address, type, profile); try { HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); if (urlConnection.getResponseCode() / 100 != 2) { @@ -76,7 +76,7 @@ public class LegacySkinServer implements SkinServer { Map map = builder.build(); if (map.isEmpty()) { - logger.debug("No textures found for {} at {}", profile, this.address); + logger.debug("No textures found for {} at {}", profile, address); return Optional.empty(); } @@ -86,7 +86,7 @@ public class LegacySkinServer implements SkinServer { @SuppressWarnings("deprecation") @Override public CompletableFuture uploadSkin(Session session, @Nullable URI image, MinecraftProfileTexture.Type type, Map metadata) { - if (Strings.isNullOrEmpty(this.gateway)) { + if (Strings.isNullOrEmpty(gateway)) { return CallableFutures.failedFuture(new NullPointerException("gateway url is blank")); } @@ -94,13 +94,14 @@ public class LegacySkinServer implements SkinServer { SkinServer.verifyServerConnection(session, SERVER_ID); String model = metadata.getOrDefault("model", "default"); Map data = image == null ? getClearData(session, type) : getUploadData(session, type, model, image); - ThreadMultipartPostUpload upload = new ThreadMultipartPostUpload(this.gateway, data); + ThreadMultipartPostUpload upload = new ThreadMultipartPostUpload(gateway, data); String response = upload.uploadMultipart(); if (response.startsWith("ERROR: ")) { response = response.substring(7); } - if (!response.equalsIgnoreCase("OK") && !response.endsWith("OK")) + if (!response.equalsIgnoreCase("OK") && !response.endsWith("OK")) { throw new IOException(response); + } return new SkinUploadResponse(response); }, HDSkinManager.skinUploadExecutor); @@ -132,8 +133,8 @@ public class LegacySkinServer implements SkinServer { @Override public String toString() { return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE) - .append("address", this.address) - .append("gateway", this.gateway) + .append("address", address) + .append("gateway", gateway) .build(); } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/skins/SkinServer.java b/src/hdskins/java/com/voxelmodpack/hdskins/skins/SkinServer.java index dce9d855..5637fc93 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/skins/SkinServer.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/skins/SkinServer.java @@ -26,7 +26,7 @@ import javax.annotation.Nullable; public interface SkinServer extends Exposable { - static final Gson gson = new GsonBuilder() + Gson gson = new GsonBuilder() .registerTypeAdapter(UUID.class, new UUIDTypeAdapter()) .create(); @@ -43,7 +43,7 @@ public interface SkinServer extends Exposable { CompletableFuture uploadSkin(Session session, @Nullable URI image, MinecraftProfileTexture.Type type, Map metadata); - public static void verifyServerConnection(Session session, String serverId) throws AuthenticationException { + static void verifyServerConnection(Session session, String serverId) throws AuthenticationException { MinecraftSessionService service = Minecraft.getMinecraft().getSessionService(); service.joinServer(session.getProfile(), session.getToken(), serverId); } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/skins/TexturesPayloadBuilder.java b/src/hdskins/java/com/voxelmodpack/hdskins/skins/TexturesPayloadBuilder.java index 39b301ce..2ef57ec8 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/skins/TexturesPayloadBuilder.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/skins/TexturesPayloadBuilder.java @@ -1,6 +1,5 @@ package com.voxelmodpack.hdskins.skins; -import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.mojang.authlib.GameProfile; diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/skins/ValhallaSkinServer.java b/src/hdskins/java/com/voxelmodpack/hdskins/skins/ValhallaSkinServer.java index dd8f309d..0b10823d 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/skins/ValhallaSkinServer.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/skins/ValhallaSkinServer.java @@ -90,7 +90,7 @@ public class ValhallaSkinServer implements SkinServer { private SkinUploadResponse upload(CloseableHttpClient client, Session session, @Nullable URI image, MinecraftProfileTexture.Type type, Map metadata) - throws IOException { + throws IOException { GameProfile profile = session.getProfile(); if (image == null) { @@ -111,7 +111,7 @@ public class ValhallaSkinServer implements SkinServer { private SkinUploadResponse resetSkin(CloseableHttpClient client, GameProfile profile, MinecraftProfileTexture.Type type) throws IOException { return upload(client, RequestBuilder.delete() .setUri(buildUserTextureUri(profile, type)) - .addHeader(HttpHeaders.AUTHORIZATION, this.accessToken) + .addHeader(HttpHeaders.AUTHORIZATION, accessToken) .build()); } @@ -122,7 +122,7 @@ public class ValhallaSkinServer implements SkinServer { return upload(client, RequestBuilder.put() .setUri(buildUserTextureUri(profile, type)) - .addHeader(HttpHeaders.AUTHORIZATION, this.accessToken) + .addHeader(HttpHeaders.AUTHORIZATION, accessToken) .setEntity(b.build()) .build()); } @@ -131,7 +131,7 @@ public class ValhallaSkinServer implements SkinServer { return upload(client, RequestBuilder.post() .setUri(buildUserTextureUri(profile, type)) - .addHeader(HttpHeaders.AUTHORIZATION, this.accessToken) + .addHeader(HttpHeaders.AUTHORIZATION, accessToken) .addParameter("file", uri.toString()) .addParameters(metadata.entrySet().stream() .map(entry -> new BasicNameValuePair(entry.getKey(), entry.getValue())) @@ -147,7 +147,7 @@ public class ValhallaSkinServer implements SkinServer { private void authorize(CloseableHttpClient client, Session session) throws IOException, AuthenticationException { - if (this.accessToken != null) { + if (accessToken != null) { return; } GameProfile profile = session.getProfile(); @@ -165,7 +165,7 @@ public class ValhallaSkinServer implements SkinServer { if (!response.userId.equals(profile.getId())) { throw new IOException("UUID mismatch!"); // probably won't ever throw } - this.accessToken = response.accessToken; + accessToken = response.accessToken; } private T readJson(HttpResponse resp, Class cl) throws IOException { @@ -208,26 +208,26 @@ public class ValhallaSkinServer implements SkinServer { private URI buildUserTextureUri(GameProfile profile, MinecraftProfileTexture.Type textureType) { String user = UUIDTypeAdapter.fromUUID(profile.getId()); String skinType = textureType.name().toLowerCase(Locale.US); - return URI.create(String.format("%s/user/%s/%s", this.address, user, skinType)); + return URI.create(String.format("%s/user/%s/%s", address, user, skinType)); } private URI getTexturesURI(GameProfile profile) { Preconditions.checkNotNull(profile.getId(), "profile id required for skins"); - return URI.create(String.format("%s/user/%s", this.address, UUIDTypeAdapter.fromUUID(profile.getId()))); + return URI.create(String.format("%s/user/%s", address, UUIDTypeAdapter.fromUUID(profile.getId()))); } private URI getHandshakeURI() { - return URI.create(String.format("%s/auth/handshake", this.address)); + return URI.create(String.format("%s/auth/handshake", address)); } private URI getResponseURI() { - return URI.create(String.format("%s/auth/response", this.address)); + return URI.create(String.format("%s/auth/response", address)); } @Override public String toString() { return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE) - .append("address", this.address) + .append("address", address) .toString(); } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java b/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java index d9933a24..d62ca3fa 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java @@ -45,7 +45,7 @@ public class ThreadMultipartPostUpload { public ThreadMultipartPostUpload(String method, String url, Map sourceData, @Nullable String authorization) { this.method = method; - this.urlString = url; + urlString = url; this.sourceData = sourceData; this.authorization = authorization; } @@ -56,28 +56,28 @@ public class ThreadMultipartPostUpload { public String uploadMultipart() throws IOException { // open a URL connection - URL url = new URL(this.urlString); + URL url = new URL(urlString); // Open a HTTP connection to the URL - this.httpClient = (HttpURLConnection) url.openConnection(); - this.httpClient.setDoOutput(true); - this.httpClient.setUseCaches(false); + httpClient = (HttpURLConnection) url.openConnection(); + httpClient.setDoOutput(true); + httpClient.setUseCaches(false); - this.httpClient.setRequestMethod(this.method); - this.httpClient.setRequestProperty("Connection", "Close"); - this.httpClient.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); // For CloudFlare + httpClient.setRequestMethod(method); + httpClient.setRequestProperty("Connection", "Close"); + httpClient.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); // For CloudFlare - if (this.sourceData.size() > 0) { - this.httpClient.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); + if (sourceData.size() > 0) { + httpClient.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); } - if (this.authorization != null) { - this.httpClient.addRequestProperty("Authorization", this.authorization); + if (authorization != null) { + httpClient.addRequestProperty("Authorization", authorization); } - try (DataOutputStream outputStream = new DataOutputStream(this.httpClient.getOutputStream())) { + try (DataOutputStream outputStream = new DataOutputStream(httpClient.getOutputStream())) { - for (Entry data : this.sourceData.entrySet()) { + for (Entry data : sourceData.entrySet()) { outputStream.writeBytes(twoHyphens + boundary + CRLF); String paramName = data.getKey(); @@ -103,7 +103,7 @@ public class ThreadMultipartPostUpload { outputStream.writeBytes(twoHyphens + boundary + twoHyphens + CRLF); } - try (InputStream input = this.httpClient.getInputStream()) { + try (InputStream input = httpClient.getInputStream()) { return IOUtils.toString(input, StandardCharsets.UTF_8); } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/FileDropper.java b/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/FileDropper.java index 8c37a5a1..2cd2723a 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/FileDropper.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/FileDropper.java @@ -13,6 +13,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRootPane; import javax.swing.SwingConstants; +import javax.swing.WindowConstants; public class FileDropper extends JFrame { private static final long serialVersionUID = -2945117328826695659L; @@ -33,7 +34,7 @@ public class FileDropper extends JFrame { super("Skin Drop"); setType(Type.UTILITY); - setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setResizable(false); setTitle("Skin Drop"); setSize(256, 256); diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/ThreadOpenFile.java b/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/ThreadOpenFile.java index 51502a90..42edb4e9 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/ThreadOpenFile.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/upload/awt/ThreadOpenFile.java @@ -31,19 +31,19 @@ public abstract class ThreadOpenFile extends Thread { throw new IllegalStateException("Cannot open an awt window whilst minecraft is in full screen mode!"); } - this.parentScreen = callback; + parentScreen = callback; this.dialogTitle = dialogTitle; } @Override public void run() { fileDialog = new JFileChooser(); - fileDialog.setDialogTitle(this.dialogTitle); + fileDialog.setDialogTitle(dialogTitle); if (lastChosenFile != null) { fileDialog.setSelectedFile(new File(lastChosenFile)); } - fileDialog.setFileFilter(this.getFileFilter()); + fileDialog.setFileFilter(getFileFilter()); int dialogResult = fileDialog.showOpenDialog(InternalDialog.getAWTContext()); @@ -53,7 +53,7 @@ public abstract class ThreadOpenFile extends Thread { lastChosenFile = f.getAbsolutePath(); } - this.parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult); + parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult); } /** diff --git a/src/main/java/com/minelittlepony/ForgeProxy.java b/src/main/java/com/minelittlepony/ForgeProxy.java index 09d5b6a5..4ffc618a 100644 --- a/src/main/java/com/minelittlepony/ForgeProxy.java +++ b/src/main/java/com/minelittlepony/ForgeProxy.java @@ -31,8 +31,9 @@ public class ForgeProxy { * @return */ public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) { - if (forgeLoaded) + if (forgeLoaded) { return ForgeHooksClient.getArmorTexture(entity, item, def, slot, type); + } return def; } @@ -45,8 +46,9 @@ public class ForgeProxy { * @param def Default return value if no mods present */ public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) { - if (forgeLoaded) + if (forgeLoaded) { return ForgeHooksClient.getArmorModel(entity, item, slot, def); + } return def; } } diff --git a/src/main/java/com/minelittlepony/PonyManager.java b/src/main/java/com/minelittlepony/PonyManager.java index b65a6e9f..8cb118f8 100644 --- a/src/main/java/com/minelittlepony/PonyManager.java +++ b/src/main/java/com/minelittlepony/PonyManager.java @@ -85,7 +85,9 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl ResourceLocation skin = player.getLocationSkin(); UUID uuid = player.getGameProfile().getId(); - if (skin == null) return getDefaultPony(uuid); + if (skin == null) { + return getDefaultPony(uuid); + } return getPony(skin, uuid); } @@ -97,7 +99,9 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl ResourceLocation skin = playerInfo.getLocationSkin(); UUID uuid = playerInfo.getGameProfile().getId(); - if (skin == null) return getDefaultPony(uuid); + if (skin == null) { + return getDefaultPony(uuid); + } return getPony(skin, uuid); } @@ -141,7 +145,9 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl } int bgi = uuid.hashCode() % getNumberOfPonies(); - while (bgi < 0) bgi += getNumberOfPonies(); + while (bgi < 0) { + bgi += getNumberOfPonies(); + } return getPony(backgroundPonyList.get(bgi), false); } @@ -163,7 +169,7 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl backgroundPonyList.clear(); try { for (IResource res : resourceManager.getAllResources(BGPONIES_JSON)) { - try (Reader reader = new InputStreamReader((res.getInputStream()))) { + try (Reader reader = new InputStreamReader(res.getInputStream())) { BackgroundPonies ponies = GSON.fromJson(reader, BackgroundPonies.class); if (ponies.override) { backgroundPonyList.clear(); diff --git a/src/main/java/com/minelittlepony/gui/Label.java b/src/main/java/com/minelittlepony/gui/Label.java index e7a3949b..a6f78062 100644 --- a/src/main/java/com/minelittlepony/gui/Label.java +++ b/src/main/java/com/minelittlepony/gui/Label.java @@ -20,13 +20,15 @@ public class Label extends GuiButton { super(0, x, y, ""); this.color = color; this.center = center; - this.text = translationString; + text = translationString; } + @Override public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { return false; } + @Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { if (center) { drawCenteredString(mc.fontRenderer, I18n.format(text), x, y, color); diff --git a/src/main/java/com/minelittlepony/gui/PonySettingsPanel.java b/src/main/java/com/minelittlepony/gui/PonySettingsPanel.java index d0b173b5..622bb7df 100644 --- a/src/main/java/com/minelittlepony/gui/PonySettingsPanel.java +++ b/src/main/java/com/minelittlepony/gui/PonySettingsPanel.java @@ -97,6 +97,7 @@ public class PonySettingsPanel extends GuiPonySettings implements ConfigPanel { } + @Override protected boolean mustScroll() { return true; } diff --git a/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java b/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java index d529406d..1943cfa7 100644 --- a/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java +++ b/src/main/java/com/minelittlepony/hdskins/gui/GuiSkinsMineLP.java @@ -29,8 +29,8 @@ public class GuiSkinsMineLP extends GuiSkins { private static final String[] panoramas = new String[] { - "minelp:textures/cubemap/sugarcubecorner_%d.png", - "minelp:textures/cubemap/quillsandsofas_%d.png" + "minelp:textures/cubemap/sugarcubecorner_%d.png", + "minelp:textures/cubemap/quillsandsofas_%d.png" }; @Override @@ -61,19 +61,19 @@ public class GuiSkinsMineLP extends GuiSkins { protected void actionPerformed(GuiButton guiButton) { super.actionPerformed(guiButton); - if (guiButton.id == this.btnModeDry.id) { - this.isWet = false; - this.localPlayer.releaseTextures(); - } else if (guiButton.id == this.btnModeWet.id) { - this.isWet = true; - this.localPlayer.releaseTextures(); + if (guiButton.id == btnModeDry.id) { + isWet = false; + localPlayer.releaseTextures(); + } else if (guiButton.id == btnModeWet.id) { + isWet = true; + localPlayer.releaseTextures(); } btnModeDry.enabled = isWet; btnModeWet.enabled = !isWet; - ((EntityPonyModel)this.localPlayer).setWet(isWet); - ((EntityPonyModel)this.remotePlayer).setWet(isWet); + ((EntityPonyModel)localPlayer).setWet(isWet); + ((EntityPonyModel)remotePlayer).setWet(isWet); } @Override diff --git a/src/main/java/com/minelittlepony/mixin/MixinItemRenderer.java b/src/main/java/com/minelittlepony/mixin/MixinItemRenderer.java index 72f53464..3a28d55a 100644 --- a/src/main/java/com/minelittlepony/mixin/MixinItemRenderer.java +++ b/src/main/java/com/minelittlepony/mixin/MixinItemRenderer.java @@ -24,8 +24,8 @@ public class MixinItemRenderer { //public void renderItemInFirstPerson(AbstractClientPlayer player, float p_187457_2_, float p_187457_3_, EnumHand hand, float p_187457_5_, ItemStack stack, float p_187457_7_) //public void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform, boolean leftHanded) @Redirect(method = "renderItemInFirstPerson(" + AbstractClientPlayer + "FF" + EnumHand + "F" + ItemStack + "F)V", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItemSide(" + EntityLivingBase + ItemStack + TransformType + "Z)V")) + at = @At(value = "INVOKE", + 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) { MineLittlePony.getInstance().getRenderManager().getMagicRenderer().renderItemInFirstPerson(self, (AbstractClientPlayer)entity, stack, transform, left); } diff --git a/src/main/java/com/minelittlepony/model/ModelWrapper.java b/src/main/java/com/minelittlepony/model/ModelWrapper.java index 3a48db66..4c283808 100644 --- a/src/main/java/com/minelittlepony/model/ModelWrapper.java +++ b/src/main/java/com/minelittlepony/model/ModelWrapper.java @@ -33,11 +33,13 @@ public class ModelWrapper implements IModelWrapper { return armor; } + @Override public void apply(IPonyData meta) { body.metadata = meta; armor.apply(meta); } + @Override public void init() { body.init(0, 0); armor.init(); diff --git a/src/main/java/com/minelittlepony/model/PonyModelConstants.java b/src/main/java/com/minelittlepony/model/PonyModelConstants.java index 676c220a..b34314d7 100644 --- a/src/main/java/com/minelittlepony/model/PonyModelConstants.java +++ b/src/main/java/com/minelittlepony/model/PonyModelConstants.java @@ -3,69 +3,69 @@ package com.minelittlepony.model; public final class PonyModelConstants { public static final float - PI = (float)Math.PI, + PI = (float)Math.PI, - BODY_CENTRE_X = 0, - BODY_CENTRE_Y = 8, - BODY_CENTRE_Z = 6, + BODY_CENTRE_X = 0, + BODY_CENTRE_Y = 8, + BODY_CENTRE_Z = 6, - NECK_CENTRE_X = BODY_CENTRE_X - 2, - NECK_CENTRE_Y = BODY_CENTRE_Y - 6.8F, - NECK_CENTRE_Z = BODY_CENTRE_Z - 8.8F, + NECK_CENTRE_X = BODY_CENTRE_X - 2, + NECK_CENTRE_Y = BODY_CENTRE_Y - 6.8F, + NECK_CENTRE_Z = BODY_CENTRE_Z - 8.8F, - BODY_ROTATE_ANGLE_X_NOTSNEAK = 0, - BODY_ROTATE_ANGLE_X_SNEAK = 0.4F, - BODY_ROTATE_ANGLE_X_RIDING = PI * 3.8F, + BODY_ROTATE_ANGLE_X_NOTSNEAK = 0, + BODY_ROTATE_ANGLE_X_SNEAK = 0.4F, + BODY_ROTATE_ANGLE_X_RIDING = PI * 3.8F, - BODY_RP_Y_NOTSNEAK = 0, - BODY_RP_Y_SNEAK = 7, - BODY_RP_Y_RIDING = 1, + BODY_RP_Y_NOTSNEAK = 0, + BODY_RP_Y_SNEAK = 7, + BODY_RP_Y_RIDING = 1, - BODY_RP_Z_NOTSNEAK = 0, - BODY_RP_Z_SNEAK = -4, - BODY_RP_Z_RIDING = 4, + BODY_RP_Z_NOTSNEAK = 0, + BODY_RP_Z_SNEAK = -4, + BODY_RP_Z_RIDING = 4, - FRONT_LEG_RP_Y_NOTSNEAK = 8, - FRONT_LEG_RP_Y_SNEAK = 8, + FRONT_LEG_RP_Y_NOTSNEAK = 8, + FRONT_LEG_RP_Y_SNEAK = 8, - HEAD_CENTRE_X = 0, - HEAD_CENTRE_Y = -1, - HEAD_CENTRE_Z = -2, + HEAD_CENTRE_X = 0, + HEAD_CENTRE_Y = -1, + HEAD_CENTRE_Z = -2, - HEAD_RP_X = 0, - HEAD_RP_Y = 0, - HEAD_RP_Z = 0, + HEAD_RP_X = 0, + HEAD_RP_Y = 0, + HEAD_RP_Z = 0, - HORN_X = HEAD_CENTRE_X - 0.5F, - HORN_Y = HEAD_CENTRE_Y - 10, - HORN_Z = HEAD_CENTRE_Z - 1.5F, + HORN_X = HEAD_CENTRE_X - 0.5F, + HORN_Y = HEAD_CENTRE_Y - 10, + HORN_Z = HEAD_CENTRE_Z - 1.5F, - LEFT_WING_EXT_RP_X = 4.5F, - LEFT_WING_EXT_RP_Y = 5.3F, - LEFT_WING_EXT_RP_Z = 6, + LEFT_WING_EXT_RP_X = 4.5F, + LEFT_WING_EXT_RP_Y = 5.3F, + 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_90 = 1.571F, + ROTATE_270 = 4.712F, + ROTATE_90 = 1.571F, - SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F, + SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F, - TAIL_RP_X = 0, - TAIL_RP_Y = 0, - TAIL_RP_Z = 0, + TAIL_RP_X = 0, + TAIL_RP_Y = 0, + TAIL_RP_Z = 0, - TAIL_RP_Z_NOTSNEAK = 14, - TAIL_RP_Z_SNEAK = 15, + TAIL_RP_Z_NOTSNEAK = 14, + TAIL_RP_Z_SNEAK = 15, - FIRSTP_ARM_CENTRE_X = -3, + FIRSTP_ARM_CENTRE_X = -3, - THIRDP_ARM_CENTRE_X = 0, - THIRDP_ARM_CENTRE_Y = 4, - THIRDP_ARM_CENTRE_Z = -1, + THIRDP_ARM_CENTRE_X = 0, + THIRDP_ARM_CENTRE_Y = 4, + THIRDP_ARM_CENTRE_Z = -1, - WING_FOLDED_RP_Y = 13, - WING_FOLDED_RP_Z = -3, + WING_FOLDED_RP_Y = 13, + WING_FOLDED_RP_Z = -3, - NECK_ROT_X = 0.166F; + NECK_ROT_X = 0.166F; } diff --git a/src/main/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java b/src/main/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java index 9354e201..5e34f654 100644 --- a/src/main/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java +++ b/src/main/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java @@ -5,7 +5,7 @@ import java.util.Map; public class BasicEasingInterpolator implements IInterpolator { - private final Map properties = new HashMap(); + private final Map properties = new HashMap<>(); private float getLast(String key, float to) { if (properties.containsKey(key)) { diff --git a/src/main/java/com/minelittlepony/model/capabilities/IModelPegasus.java b/src/main/java/com/minelittlepony/model/capabilities/IModelPegasus.java index 9161c523..418f4fa9 100644 --- a/src/main/java/com/minelittlepony/model/capabilities/IModelPegasus.java +++ b/src/main/java/com/minelittlepony/model/capabilities/IModelPegasus.java @@ -17,7 +17,7 @@ public interface IModelPegasus extends IModel { default float getWingRotationFactor(float ticks) { if (isSwimming()) { - return (MathHelper.sin(ticks * 0.136f) / 2) + ROTATE_270; + return MathHelper.sin(ticks * 0.136f) / 2 + ROTATE_270; } if (isFlying()) { return MathHelper.sin(ticks * 0.536f) + ROTATE_270 + 0.4f; diff --git a/src/main/java/com/minelittlepony/model/components/ModelDeadMau5Ears.java b/src/main/java/com/minelittlepony/model/components/ModelDeadMau5Ears.java index f36158bb..869e3b2f 100644 --- a/src/main/java/com/minelittlepony/model/components/ModelDeadMau5Ears.java +++ b/src/main/java/com/minelittlepony/model/components/ModelDeadMau5Ears.java @@ -12,7 +12,7 @@ public class ModelDeadMau5Ears extends ModelSkeletonHead { } public void setVisible(boolean show) { - this.boxList.clear(); + boxList.clear(); skeletonHead = new ModelRenderer(this, 24, 0); skeletonHead.addBox(-9, -13, -1, 6, 6, 1, 0); diff --git a/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java b/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java index 4d792b57..ee627264 100644 --- a/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java +++ b/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java @@ -46,8 +46,12 @@ public class ModelEarthPony extends AbstractPonyModel { @Override protected float getLegOutset() { if (smallArms) { - if (isSleeping()) return 2.6f; - if (isCrouching()) return 1; + if (isSleeping()) { + return 2.6f; + } + if (isCrouching()) { + return 1; + } return 4; } return super.getLegOutset(); diff --git a/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java b/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java index 48731dff..a9da8072 100644 --- a/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java +++ b/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java @@ -39,6 +39,7 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn { unicornArmLeft.rotateAngleY = 0; } + @Override protected float getWobbleAmount() { if (isCasting()) { return 0; @@ -87,7 +88,9 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn { @Override protected void swingArms(float ticks) { - if (isSleeping()) return; + if (isSleeping()) { + return; + } if (canCast()) { float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; diff --git a/src/main/java/com/minelittlepony/model/player/PlayerModels.java b/src/main/java/com/minelittlepony/model/player/PlayerModels.java index 4f86f717..edd94194 100644 --- a/src/main/java/com/minelittlepony/model/player/PlayerModels.java +++ b/src/main/java/com/minelittlepony/model/player/PlayerModels.java @@ -19,6 +19,7 @@ public enum PlayerModels { ALICORN("alicorn", "slimalicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall), ZEBRA("zebra", "slimzebra", () -> PMAPI.zebra, () -> PMAPI.zebraSmall), SEAPONY("seapony", "slimseapony", () -> PMAPI.seapony, () -> PMAPI.seapony) { + @Override public RenderPonyPlayer createRenderer(RenderManager manager, boolean slimArms) { return new RenderSeaponyPlayer(manager, slimArms, PlayerModels.UNICORN.getModel(slimArms), getModel(slimArms)); } diff --git a/src/main/java/com/minelittlepony/model/ponies/ModelBreezie.java b/src/main/java/com/minelittlepony/model/ponies/ModelBreezie.java index 79619eff..aa4631d9 100644 --- a/src/main/java/com/minelittlepony/model/ponies/ModelBreezie.java +++ b/src/main/java/com/minelittlepony/model/ponies/ModelBreezie.java @@ -26,14 +26,14 @@ public class ModelBreezie extends ModelBiped { bipedHeadwear.showModel = false; bipedHead = new PonyRenderer(this) .child(new PonyRenderer(this) - .addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4) - .tex(28, 0).addBox( 2, -7, 1, 1, 1, 1) - .tex(24, 0).addBox(-3, -7, 1, 1, 1, 1) - .tex(24, 9).addBox(-1, -2, -4, 2, 2, 1)) + .addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4) + .tex(28, 0).addBox( 2, -7, 1, 1, 1, 1) + .tex(24, 0).addBox(-3, -7, 1, 1, 1, 1) + .tex(24, 9).addBox(-1, -2, -4, 2, 2, 1)) .child(new PonyRenderer(this) - .tex(28, 2).addBox( 1, -11, -2, 1, 6, 1) - .tex(24, 2).addBox(-2, -11, -2, 1, 6, 1) - .rotate(-0.2617994F, 0, 0)); + .tex(28, 2).addBox( 1, -11, -2, 1, 6, 1) + .tex(24, 2).addBox(-2, -11, -2, 1, 6, 1) + .rotate(-0.2617994F, 0, 0)); bipedBody = new PonyRenderer(this, 2, 12) .addBox(0, 0, 0, 6, 7, 14).rotate(-0.5235988F, 0, 0).around(-3, 1, -3); @@ -93,8 +93,8 @@ public class ModelBreezie extends ModelBiped { bipedLeftArm.rotateAngleX += -PI / 5; bipedRightArm.rotateAngleX += -PI / 5; - rotateLegRiding(((PonyRenderer)bipedLeftLeg), -1); - rotateLegRiding(((PonyRenderer)bipedRightLeg), 1); + rotateLegRiding((PonyRenderer)bipedLeftLeg, -1); + rotateLegRiding((PonyRenderer)bipedRightLeg, 1); } rotateArm(bipedLeftArm, leftArmPose, 1); @@ -160,7 +160,7 @@ public class ModelBreezie extends ModelBiped { arm.rotateAngleY = 0; break; case ITEM: - arm.rotateAngleX = arm.rotateAngleX / 2 - (PI / 10); + arm.rotateAngleX = arm.rotateAngleX / 2 - PI / 10; arm.rotateAngleY = 0; case BLOCK: arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F; @@ -171,10 +171,10 @@ public class ModelBreezie extends ModelBiped { } protected void raiseArm(ModelRenderer up, ModelRenderer down, float factor) { - up.rotateAngleY = bipedHead.rotateAngleY + (factor / 10); - up.rotateAngleX = bipedHead.rotateAngleX - (PI / 2); + up.rotateAngleY = bipedHead.rotateAngleY + factor / 10; + up.rotateAngleX = bipedHead.rotateAngleX - PI / 2; - down.rotateAngleY = bipedHead.rotateAngleY - (factor / 2); - down.rotateAngleX = bipedHead.rotateAngleX - (PI / 2); + down.rotateAngleY = bipedHead.rotateAngleY - factor / 2; + down.rotateAngleX = bipedHead.rotateAngleX - PI / 2; } } diff --git a/src/main/java/com/minelittlepony/model/ponies/ModelZombiePony.java b/src/main/java/com/minelittlepony/model/ponies/ModelZombiePony.java index a23751cd..c5cac61e 100644 --- a/src/main/java/com/minelittlepony/model/ponies/ModelZombiePony.java +++ b/src/main/java/com/minelittlepony/model/ponies/ModelZombiePony.java @@ -10,7 +10,9 @@ public class ModelZombiePony extends ModelMobPony { @Override protected void rotateLegs(float move, float swing, float ticks, Entity entity) { super.rotateLegs(move, swing, ticks, entity); - if (rightArmPose != ArmPose.EMPTY) return; + if (rightArmPose != ArmPose.EMPTY) { + return; + } if (islookAngleRight(move)) { rotateArmHolding(bipedRightArm, 1, swingProgress, ticks); diff --git a/src/main/java/com/minelittlepony/pony/data/ITriggerPixelMapped.java b/src/main/java/com/minelittlepony/pony/data/ITriggerPixelMapped.java index 3a967aa8..3af22148 100644 --- a/src/main/java/com/minelittlepony/pony/data/ITriggerPixelMapped.java +++ b/src/main/java/com/minelittlepony/pony/data/ITriggerPixelMapped.java @@ -20,9 +20,11 @@ public interface ITriggerPixelMapped & ITriggerPixelMapped> * @param pixelValue The pixel colour to search for. */ @SuppressWarnings("unchecked") - public static & ITriggerPixelMapped> T getByTriggerPixel(T type, int pixelValue) { + static & ITriggerPixelMapped> T getByTriggerPixel(T type, int pixelValue) { for (T i : (T[])type.getClass().getEnumConstants()) { - if (i.getTriggerPixel() == pixelValue) return i; + if (i.getTriggerPixel() == pixelValue) { + return i; + } } return type; } diff --git a/src/main/java/com/minelittlepony/pony/data/Pony.java b/src/main/java/com/minelittlepony/pony/data/Pony.java index b3b92297..e783a0ff 100644 --- a/src/main/java/com/minelittlepony/pony/data/Pony.java +++ b/src/main/java/com/minelittlepony/pony/data/Pony.java @@ -49,7 +49,9 @@ public class Pony { private IPonyData checkSkin(ResourceLocation resource) { IPonyData data = checkPonyMeta(resource); - if (data != null) return data; + if (data != null) { + return data; + } BufferedImage skinImage = getBufferedImage(resource); return this.checkSkin(skinImage); @@ -99,7 +101,9 @@ public class Pony { } private IPonyData checkSkin(BufferedImage bufferedimage) { - if (bufferedimage == null) return new PonyData(); + if (bufferedimage == null) { + return new PonyData(); + } MineLittlePony.logger.debug("\tStart skin check for pony #{} with image {}.", ponyId, bufferedimage); return PonyData.parse(bufferedimage); } diff --git a/src/main/java/com/minelittlepony/pony/data/PonyLevel.java b/src/main/java/com/minelittlepony/pony/data/PonyLevel.java index cf26cde3..93317648 100644 --- a/src/main/java/com/minelittlepony/pony/data/PonyLevel.java +++ b/src/main/java/com/minelittlepony/pony/data/PonyLevel.java @@ -10,6 +10,6 @@ public enum PonyLevel { if (index < 0) { index = 0; } - return values[(int)Math.round(index) % values.length]; + return values[Math.round(index) % values.length]; } } diff --git a/src/main/java/com/minelittlepony/pony/data/PonyRace.java b/src/main/java/com/minelittlepony/pony/data/PonyRace.java index 3271d4c9..4b7acbf4 100644 --- a/src/main/java/com/minelittlepony/pony/data/PonyRace.java +++ b/src/main/java/com/minelittlepony/pony/data/PonyRace.java @@ -67,7 +67,9 @@ public enum PonyRace implements ITriggerPixelMapped { * PonyLevel.PONIES (should) return a pony if this is a human. Don't be fooled, though. It doesn't. */ public PonyRace getEffectiveRace(PonyLevel level) { - if (level == PonyLevel.HUMANS) return HUMAN; + if (level == PonyLevel.HUMANS) { + return HUMAN; + } return this; } diff --git a/src/main/java/com/minelittlepony/pony/data/PonyWearable.java b/src/main/java/com/minelittlepony/pony/data/PonyWearable.java index 941d9682..5c60198e 100644 --- a/src/main/java/com/minelittlepony/pony/data/PonyWearable.java +++ b/src/main/java/com/minelittlepony/pony/data/PonyWearable.java @@ -20,10 +20,12 @@ public enum PonyWearable implements ITriggerPixelMapped { } public static PonyWearable[] flags(boolean[] flags) { - List wears = new ArrayList(); + List wears = new ArrayList<>(); PonyWearable[] values = values(); for (int i = 0; i < values.length; i++) { - if (flags[i]) wears.add(values[i]); + if (flags[i]) { + wears.add(values[i]); + } } return wears.toArray(new PonyWearable[wears.size()]); } diff --git a/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java b/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java index 6645d94c..7d33a6a0 100644 --- a/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java +++ b/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java @@ -61,7 +61,9 @@ public enum TriggerPixels { private & ITriggerPixelMapped> void readFlag(boolean[] out, Channel channel, BufferedImage image) { T value = ITriggerPixelMapped.getByTriggerPixel((T)def, channel.readValue(x, y, image)); - if (value != def) out[value.ordinal()] = true; + if (value != def) { + out[value.ordinal()] = true; + } } enum Channel { diff --git a/src/main/java/com/minelittlepony/render/HornGlow.java b/src/main/java/com/minelittlepony/render/HornGlow.java index e5f2d558..3a93b5e4 100644 --- a/src/main/java/com/minelittlepony/render/HornGlow.java +++ b/src/main/java/com/minelittlepony/render/HornGlow.java @@ -50,12 +50,12 @@ public class HornGlow extends Box { Vertex wun = vert(xMin, yMax, zMax, 8, 0); quadList = new Quad[] { - quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun), - quad(texX, d, texY + d, h, wds, wdn, wun, wus), - quad(texX + d, w, texY, d, edn, wdn, wds, eds), - quad(texX + d + w, w, texY + d, -d, eus, wus, wun, eun), - quad(texX + d, w, texY + d, h, eds, wds, wus, eus), - quad(texX + d + w + d, w, texY + d, h, wdn, edn, eun, wun) + quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun), + quad(texX, d, texY + d, h, wds, wdn, wun, wus), + quad(texX + d, w, texY, d, edn, wdn, wds, eds), + quad(texX + d + w, w, texY + d, -d, eus, wus, wun, eun), + quad(texX + d, w, texY + d, h, eds, wds, wus, eus), + quad(texX + d + w + d, w, texY + d, h, wdn, edn, eun, wun) }; if (renderer.mirror) { diff --git a/src/main/java/com/minelittlepony/render/PonySkullRenderer.java b/src/main/java/com/minelittlepony/render/PonySkullRenderer.java index 3f5a8a26..7729fa0c 100644 --- a/src/main/java/com/minelittlepony/render/PonySkullRenderer.java +++ b/src/main/java/com/minelittlepony/render/PonySkullRenderer.java @@ -27,7 +27,7 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende public static PonySkullRenderer ponyInstance = new PonySkullRenderer(); private static TileEntitySkullRenderer backup = null; - private static final Map skullMap = new HashMap(); + private static final Map skullMap = new HashMap<>(); /** * Resolves the games skull renderer to either a specialised pony skull renderer @@ -43,7 +43,7 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende instance = ponyInstance; } } else { - if ((instance instanceof PonySkullRenderer)) { + if (instance instanceof PonySkullRenderer) { ponyInstance = (PonySkullRenderer)instance; if (backup == null) { backup = new TileEntitySkullRenderer(); @@ -150,12 +150,12 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende */ public interface ISkull { - public static final int SKELETON = 0; - public static final int WITHER = 1; - public static final int ZOMBIE = 2; - public static final int PLAYER = 3; - public static final int CREEPER = 4; - public static final int DRAGON = 5; + int SKELETON = 0; + int WITHER = 1; + int ZOMBIE = 2; + int PLAYER = 3; + int CREEPER = 4; + int DRAGON = 5; void preRender(boolean transparency); diff --git a/src/main/java/com/minelittlepony/render/RenderPony.java b/src/main/java/com/minelittlepony/render/RenderPony.java index 014b61f6..f726c21b 100644 --- a/src/main/java/com/minelittlepony/render/RenderPony.java +++ b/src/main/java/com/minelittlepony/render/RenderPony.java @@ -48,7 +48,9 @@ public class RenderPony { return PonyPosture.ELYTRA; } - if (entity.isEntityAlive() && entity.isPlayerSleeping()) return null; + if (entity.isEntityAlive() && entity.isPlayerSleeping()) { + return null; + } if (ponyModel.isSwimming()) { return PonyPosture.SWIMMING; diff --git a/src/main/java/com/minelittlepony/render/RenderPonyMob.java b/src/main/java/com/minelittlepony/render/RenderPonyMob.java index e68b7059..b029748e 100644 --- a/src/main/java/com/minelittlepony/render/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/render/RenderPonyMob.java @@ -24,7 +24,7 @@ import javax.annotation.Nonnull; // and is the whole reason we had this scaling bug in the first place. public abstract class RenderPonyMob extends RenderLiving implements IRenderPony { - protected final RenderPony renderPony = new RenderPony(this); + protected final RenderPony renderPony = new RenderPony<>(this); public RenderPonyMob(RenderManager manager, ModelWrapper model) { super(manager, model.getBody(), 0.5F); diff --git a/src/main/java/com/minelittlepony/render/layer/LayerPonyCape.java b/src/main/java/com/minelittlepony/render/layer/LayerPonyCape.java index 221e67ca..f49e2fb1 100644 --- a/src/main/java/com/minelittlepony/render/layer/LayerPonyCape.java +++ b/src/main/java/com/minelittlepony/render/layer/LayerPonyCape.java @@ -42,18 +42,24 @@ public class LayerPonyCape extends AbstractPonyLayer { float motionYaw = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * scale; 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; - if (capeMotionY < -6) capeMotionY = -6; - if (capeMotionY > 32) capeMotionY = 32; + if (capeMotionY < -6) { + capeMotionY = -6; + } + if (capeMotionY > 32) { + capeMotionY = 32; + } float capeMotionX = (float) (capeX * sin + capeZ * cos) * 100; float diagMotion = (float) (capeX * cos - capeZ * sin) * 100; - if (capeMotionX < 0) capeMotionX = 0; + if (capeMotionX < 0) { + capeMotionX = 0; + } float camera = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * scale; capeMotionY += MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * scale) * 6) * 32 * camera; diff --git a/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java b/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java index 0057df20..4c712fb9 100644 --- a/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java +++ b/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java @@ -58,13 +58,17 @@ public class LayerPonyElytra extends AbstractPonyLay if (player.isPlayerInfoSet()) { result = player.getLocationElytra(); - if (result != null) return result; + if (result != null) { + return result; + } } if (player.hasPlayerInfo() && player.isWearing(EnumPlayerModelParts.CAPE)) { result = player.getLocationCape(); - if (result != null) return result; + if (result != null) { + return result; + } } } diff --git a/src/main/java/com/minelittlepony/render/plane/ModelPlane.java b/src/main/java/com/minelittlepony/render/plane/ModelPlane.java index 8a7c8716..2b9d8630 100644 --- a/src/main/java/com/minelittlepony/render/plane/ModelPlane.java +++ b/src/main/java/com/minelittlepony/render/plane/ModelPlane.java @@ -77,6 +77,8 @@ public class ModelPlane extends Box { @Override public void render(@Nonnull BufferBuilder buffer, float scale) { - if (!hidden) quad.draw(buffer, scale); + if (!hidden) { + quad.draw(buffer, scale); + } } } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java index ffb35818..f79cdabb 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java @@ -41,6 +41,7 @@ public class RenderPonyGuardian extends RenderGuardian { ponyRenderer.preRenderCallback(entity, ticks); } + @Override public void doRender(EntityGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) { float origin = entity.height; diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java index 541d8092..7ecc6cbc 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java @@ -61,21 +61,21 @@ public class RenderPonyZombie extends RenderPonyMob public static class Giant extends RenderPonyMob { - public Giant(RenderManager manager) { - super(manager, PMAPI.zombie); - } + public Giant(RenderManager manager) { + super(manager, PMAPI.zombie); + } - @Override - public void preRenderCallback(EntityGiantZombie entity, float ticks) { - super.preRenderCallback(entity, ticks); - GlStateManager.scale(3, 3, 3); - } + @Override + public void preRenderCallback(EntityGiantZombie entity, float ticks) { + super.preRenderCallback(entity, ticks); + GlStateManager.scale(3, 3, 3); + } - @Override - protected ResourceLocation getTexture(EntityGiantZombie entity) { - return ZOMBIE; - } + @Override + protected ResourceLocation getTexture(EntityGiantZombie entity) { + return ZOMBIE; + } } - //TODO: MC1.13 EntityDrowned + //TODO: MC1.13 EntityDrowned } diff --git a/src/main/java/com/minelittlepony/transform/PonyTransformation.java b/src/main/java/com/minelittlepony/transform/PonyTransformation.java index 7d84801b..0d6d6f21 100644 --- a/src/main/java/com/minelittlepony/transform/PonyTransformation.java +++ b/src/main/java/com/minelittlepony/transform/PonyTransformation.java @@ -11,11 +11,15 @@ public enum PonyTransformation { NORMAL { @Override public void transform(IModel model, BodyPart part) { - if (model.isSleeping()) translate(0, -0.61F, 0); + if (model.isSleeping()) { + translate(0, -0.61F, 0); + } switch (part) { case NECK: - if (model.isCrouching()) translate(-0.03F, 0.03F, 0.1F); + if (model.isCrouching()) { + translate(-0.03F, 0.03F, 0.1F); + } default: } } @@ -23,17 +27,25 @@ public enum PonyTransformation { LARGE { @Override public void transform(IModel model, BodyPart part) { - if (model.isSleeping()) translate(0, -0.98F, 0.2F); + if (model.isSleeping()) { + translate(0, -0.98F, 0.2F); + } switch (part) { case NECK: translate(0, -0.15F, -0.07F); - if (model.isCrouching()) translate(-0.03F, 0.16F, 0.07F); + if (model.isCrouching()) { + translate(-0.03F, 0.16F, 0.07F); + } break; case HEAD: translate(0, -0.17F, -0.04F); - if (model.isSleeping()) translate(0, 0, -0.1F); - if (model.isCrouching()) translate(0, 0.15F, 0); + if (model.isSleeping()) { + translate(0, 0, -0.1F); + } + if (model.isCrouching()) { + translate(0, 0.15F, 0); + } break; case BODY: translate(0, -0.2F, -0.04F); @@ -52,16 +64,24 @@ public enum PonyTransformation { FOAL { @Override public void transform(IModel model, BodyPart part) { - if (model.isCrouching()) translate(0, -0.3F, 0); - if (model.isSleeping()) translate(0, -0.6F, -0.5F); - if (model.isRiding()) translate(0, -0.4F, 0); + if (model.isCrouching()) { + translate(0, -0.3F, 0); + } + if (model.isSleeping()) { + translate(0, -0.6F, -0.5F); + } + if (model.isRiding()) { + translate(0, -0.4F, 0); + } translate(0, 0.2F, 0); switch (part) { case NECK: scale(1.3F, 1.3F, 1.3F); - if (model.isCrouching()) translate(0, -0.01F, 0.15F); + if (model.isCrouching()) { + translate(0, -0.01F, 0.15F); + } break; case HEAD: scale(1.3F, 1.3F, 1.3F); @@ -77,17 +97,23 @@ public enum PonyTransformation { TALL { @Override public void transform(IModel model, BodyPart part) { - if (model.isSleeping()) translate(0, -0.5F, 0.25F); + if (model.isSleeping()) { + translate(0, -0.5F, 0.25F); + } switch (part) { case NECK: translate(0, -0.09F, -0.01F); scale(1, 1.1F, 1); - if (model.isCrouching()) translate(-0.02F, -0.02F, 0.1F); + if (model.isCrouching()) { + translate(-0.02F, -0.02F, 0.1F); + } break; case HEAD: translate(0, -0.15F, 0.01F); - if (model.isCrouching()) translate(0, 0.05F, 0); + if (model.isCrouching()) { + translate(0, 0.05F, 0); + } break; case BODY: translate(0, -0.1F, 0); @@ -98,7 +124,9 @@ public enum PonyTransformation { case LEGS: translate(0, -0.25F, 0.03F); scale(1, 1.18F, 1); - if (model.isGoingFast()) translate(0, 0.05F, 0); + if (model.isGoingFast()) { + translate(0, 0.05F, 0); + } break; } } diff --git a/src/main/java/com/minelittlepony/transform/PostureFlight.java b/src/main/java/com/minelittlepony/transform/PostureFlight.java index 761a0dd8..1bc454fe 100644 --- a/src/main/java/com/minelittlepony/transform/PostureFlight.java +++ b/src/main/java/com/minelittlepony/transform/PostureFlight.java @@ -61,6 +61,6 @@ public class PostureFlight implements PonyPosture { roll = model.getMetadata().getInterpolator().interpolate("pegasusRoll", roll, 10); - GlStateManager.rotate((float)roll, 0, 0, 1); + GlStateManager.rotate(roll, 0, 0, 1); } } diff --git a/src/main/java/com/minelittlepony/util/coordinates/Color.java b/src/main/java/com/minelittlepony/util/coordinates/Color.java index 915b910b..a5fcc211 100644 --- a/src/main/java/com/minelittlepony/util/coordinates/Color.java +++ b/src/main/java/com/minelittlepony/util/coordinates/Color.java @@ -3,19 +3,19 @@ package com.minelittlepony.util.coordinates; import net.minecraft.client.renderer.GlStateManager; public interface Color { - public static float r(int color) { + static float r(int color) { return (color >> 16 & 255) / 255F; } - public static float g(int color) { + static float g(int color) { return (color >> 8 & 255) / 255F; } - public static float b(int color) { + static float b(int color) { return (color & 255) / 255F; } - public static void glColor(int color, float alpha) { + static void glColor(int color, float alpha) { GlStateManager.color(Color.r(color), Color.g(color), Color.b(color), alpha); } } diff --git a/src/main/java/com/minelittlepony/util/coordinates/Vertex.java b/src/main/java/com/minelittlepony/util/coordinates/Vertex.java index c2a30a44..c3dcb87c 100644 --- a/src/main/java/com/minelittlepony/util/coordinates/Vertex.java +++ b/src/main/java/com/minelittlepony/util/coordinates/Vertex.java @@ -14,6 +14,7 @@ public class Vertex extends PositionTextureVertex { // The MCP name is misleading. // This is meant to return a COPY with the given texture position + @Override public Vertex setTexturePosition(float texX, float texY) { return new Vertex(this, texX, texY); } diff --git a/src/main/java/com/minelittlepony/util/math/MathUtil.java b/src/main/java/com/minelittlepony/util/math/MathUtil.java index 2836b01b..4b350fd6 100644 --- a/src/main/java/com/minelittlepony/util/math/MathUtil.java +++ b/src/main/java/com/minelittlepony/util/math/MathUtil.java @@ -11,8 +11,12 @@ public class MathUtil { public static float sensibleAngle(float angle) { angle %= 360; - if (angle > 180) angle -= 360; - if (angle < -180) angle += 360; + if (angle > 180) { + angle -= 360; + } + if (angle < -180) { + angle += 360; + } return angle; }