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

@ -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;
} }

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

@ -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

@ -210,8 +210,7 @@ public class GLWindow extends DropTarget {
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();

View file

@ -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);

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

@ -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

@ -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

@ -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 {
@ -76,8 +77,8 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
} }
/** /**
* 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,7 +112,8 @@ 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

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 {

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

@ -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

@ -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

@ -2,8 +2,7 @@ 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,

View file

@ -10,6 +10,7 @@ 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 yOffset YPosition for this model. Always 0.
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change). * @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
*/ */
@ -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

@ -2,6 +2,7 @@ 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>
@ -13,8 +14,8 @@ 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.

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

@ -100,8 +100,8 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
} }
/** /**
* 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;
@ -133,8 +133,8 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
} }
/** /**
* 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()) {

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

@ -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

@ -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

@ -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;
} }
} }