mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-12-02 00:37:59 +01:00
Run code format
This commit is contained in:
parent
b9231a5bfd
commit
65a5fc230c
62 changed files with 248 additions and 228 deletions
|
@ -8,14 +8,13 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to a package, class or method to indicate that
|
||||
* the method in that element are nonnull by default unless there is:
|
||||
* This annotation can be applied to a package, class or method to indicate that the method in that
|
||||
* element are nonnull by default unless there is:
|
||||
* <ul>
|
||||
* <li>An explicit nullness annotation
|
||||
* <li>The method overrides a method in a superclass (in which case the
|
||||
* annotation of the corresponding method in the superclass applies)
|
||||
* <li> there is a default parameter annotation applied to a more tightly nested
|
||||
* element.
|
||||
* <li>The method overrides a method in a superclass (in which case the annotation of the
|
||||
* corresponding method in the superclass applies)
|
||||
* <li>there is a default parameter annotation applied to a more tightly nested element.
|
||||
* </ul>
|
||||
*
|
||||
*/
|
||||
|
@ -23,4 +22,5 @@ import java.lang.annotation.RetentionPolicy;
|
|||
@Nonnull
|
||||
@TypeQualifierDefault(ElementType.METHOD) // Note: This is a copy of javax.annotation.ParametersAreNonnullByDefault with target changed to METHOD
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MethodsReturnNonnullByDefault {}
|
||||
public @interface MethodsReturnNonnullByDefault {
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class LiteModHDSkins implements InitCompleteListener, ViewportListener, C
|
|||
// register config
|
||||
LiteLoader.getInstance().registerExposable(this, null);
|
||||
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager();
|
||||
irrm.registerReloadListener(HDSkinManager.INSTANCE);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ import java.util.Map;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Manager for fetching preview textures. This ensures that multiple calls
|
||||
* to the skin server aren't done when fetching preview textures.
|
||||
* Manager for fetching preview textures. This ensures that multiple calls to the skin server aren't
|
||||
* done when fetching preview textures.
|
||||
*/
|
||||
public class PreviewTextureManager {
|
||||
|
||||
|
@ -25,8 +25,7 @@ public class PreviewTextureManager {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public PreviewTexture getPreviewTexture(ResourceLocation location, MinecraftProfileTexture.Type type, ResourceLocation def,
|
||||
@Nullable SkinManager.SkinAvailableCallback callback) {
|
||||
public PreviewTexture getPreviewTexture(ResourceLocation location, MinecraftProfileTexture.Type type, ResourceLocation def, @Nullable SkinManager.SkinAvailableCallback callback) {
|
||||
if (!textures.containsKey(type)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -34,19 +33,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;
|
||||
|
|
|
@ -9,6 +9,6 @@ public class TextureLoader {
|
|||
private static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public static void loadTexture(final ResourceLocation textureLocation, final ITextureObject textureObj) {
|
||||
mc.addScheduledTask((Runnable) () -> mc.getTextureManager().loadTexture(textureLocation, textureObj));
|
||||
mc.addScheduledTask((Runnable)() -> mc.getTextureManager().loadTexture(textureLocation, textureObj));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,8 +130,7 @@ public class ThreadDownloadImageETag extends SimpleTexture {
|
|||
// try to load from cache anyway
|
||||
setLocalCache();
|
||||
return;
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
LOGGER.error("Couldn't load skin {} ", imageUrl, e);
|
||||
} finally {
|
||||
|
|
|
@ -123,8 +123,8 @@ public class CubeMap {
|
|||
|
||||
for (int blendPass = 0; blendPass < blendIterations * blendIterations; ++blendPass) {
|
||||
pushMatrix();
|
||||
float offsetX = ((float) (blendPass % blendIterations) / (float) blendIterations - 0.5F) / 64;
|
||||
float offsetY = ((float) (blendPass / blendIterations) / (float) blendIterations - 0.5F) / 64;
|
||||
float offsetX = ((float)(blendPass % blendIterations) / (float)blendIterations - 0.5F) / 64;
|
||||
float offsetY = ((float)(blendPass / blendIterations) / (float)blendIterations - 0.5F) / 64;
|
||||
|
||||
translate(offsetX, offsetY, 0);
|
||||
rotate(MathHelper.sin(lastPartialTick / 400) * 25 + 20, 1, 0, 0);
|
||||
|
|
|
@ -38,8 +38,7 @@ public class EntityPlayerModel extends EntityLivingBase {
|
|||
EntityEquipmentSlot.CHEST, ItemStack.EMPTY,
|
||||
EntityEquipmentSlot.LEGS, ItemStack.EMPTY,
|
||||
EntityEquipmentSlot.FEET, ItemStack.EMPTY,
|
||||
EntityEquipmentSlot.MAINHAND, ItemStack.EMPTY
|
||||
));
|
||||
EntityEquipmentSlot.MAINHAND, ItemStack.EMPTY));
|
||||
|
||||
private PreviewTexture remoteSkinTexture;
|
||||
private ResourceLocation remoteSkinResource;
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface FileDropListener extends DropTargetListener {
|
|||
default void drop(DropTargetDropEvent dtde) {
|
||||
dtde.acceptDrop(DnDConstants.ACTION_LINK);
|
||||
try {
|
||||
onDrop((List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
|
||||
onDrop((List<File>)dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
|
||||
dtde.getDropTargetContext().dropComplete(true);
|
||||
} catch (UnsupportedFlavorException | IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -206,12 +206,11 @@ public class GLWindow extends DropTarget {
|
|||
// LWJGL copies the initial byte streams and then reverses them. The result is a stream that's not
|
||||
// only already consumed, but somehow invalid when you try to parse it through ImageIO.read.
|
||||
//
|
||||
DefaultResourcePack pack = (DefaultResourcePack) mc.getResourcePackRepository().rprDefaultResourcePack;
|
||||
DefaultResourcePack pack = (DefaultResourcePack)mc.getResourcePackRepository().rprDefaultResourcePack;
|
||||
|
||||
ArrayList<Image> images = Lists.newArrayList(
|
||||
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();
|
||||
|
||||
|
@ -267,6 +266,6 @@ public class GLWindow extends DropTarget {
|
|||
|
||||
frame.setDropTarget(this);
|
||||
addDropTargetListener(dtl);
|
||||
} catch (TooManyListenersException ignored) { }
|
||||
} catch (TooManyListenersException ignored) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public class GuiSkins extends GuiScreen {
|
|||
}
|
||||
|
||||
private void enableDnd() {
|
||||
GLWindow.current().setDropTargetListener((FileDropListener) files -> {
|
||||
GLWindow.current().setDropTargetListener((FileDropListener)files -> {
|
||||
files.stream().findFirst().ifPresent(instance::loadLocalFile);
|
||||
});
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public class GuiSkins extends GuiScreen {
|
|||
Minecraft.getMinecraft().addScheduledTask(localPlayer::releaseTextures);
|
||||
if (!skinFile.exists()) {
|
||||
skinMessage = I18n.format("hdskins.error.unreadable");
|
||||
} else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) {
|
||||
} else if (!FilenameUtils.isExtension(skinFile.getName(), new String[] {"png", "PNG"})) {
|
||||
skinMessage = I18n.format("hdskins.error.ext");
|
||||
} else {
|
||||
BufferedImage chosenImage;
|
||||
|
@ -257,7 +257,7 @@ public class GuiSkins extends GuiScreen {
|
|||
skinMessage = I18n.format("hdskins.error.open");
|
||||
} else if (isPowerOfTwo(chosenImage.getWidth())
|
||||
&& (chosenImage.getWidth() == chosenImage.getHeight() * 2
|
||||
|| chosenImage.getWidth() == chosenImage.getHeight())
|
||||
|| chosenImage.getWidth() == chosenImage.getHeight())
|
||||
&& chosenImage.getWidth() <= MAX_SKIN_DIMENSION
|
||||
&& chosenImage.getHeight() <= MAX_SKIN_DIMENSION) {
|
||||
synchronized (skinLock) {
|
||||
|
@ -435,7 +435,7 @@ public class GuiSkins extends GuiScreen {
|
|||
if (!localPlayer.isUsingLocalTexture()) {
|
||||
int opacity = fontRenderer.getStringWidth(skinMessage) / 2;
|
||||
Gui.drawRect(40, height / 2 - 12, width / 2 - 40, height / 2 + 12, 0xB0000000);
|
||||
fontRenderer.drawStringWithShadow(skinMessage, (int) (xPos1 - opacity), height / 2 - 4, 0xffffff);
|
||||
fontRenderer.drawStringWithShadow(skinMessage, (int)(xPos1 - opacity), height / 2 - 4, 0xffffff);
|
||||
}
|
||||
if (btnModeSkin.isMouseOver() || btnModeElytra.isMouseOver() || btnModeSkinnySkin.isMouseOver()) {
|
||||
int y = Math.max(mouseY, 16);
|
||||
|
@ -462,15 +462,15 @@ public class GuiSkins extends GuiScreen {
|
|||
int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2;
|
||||
int stringWidth2 = fontRenderer.getStringWidth(stringWidth) / 2;
|
||||
|
||||
Gui.drawRect((int) (xPos2 - labelwidth), height / 2 - 16, width - 40, height / 2 + 16, 0xB0000000);
|
||||
Gui.drawRect((int)(xPos2 - labelwidth), height / 2 - 16, width - 40, height / 2 + 16, 0xB0000000);
|
||||
|
||||
fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), height / 2 - 10, 0xffffff);
|
||||
fontRenderer.drawStringWithShadow(stringWidth, (int) (xPos2 - stringWidth2), height / 2 + 2, 0xffffff);
|
||||
fontRenderer.drawStringWithShadow(opacity1, (int)(xPos2 - stringWidth1), height / 2 - 10, 0xffffff);
|
||||
fontRenderer.drawStringWithShadow(stringWidth, (int)(xPos2 - stringWidth2), height / 2 + 2, 0xffffff);
|
||||
} else {
|
||||
opacity1 = I18n.format("hdskins.fetch");
|
||||
int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2;
|
||||
Gui.drawRect((int) (xPos2 - labelwidth), height / 2 - 12, width - 40, height / 2 + 12, 0xB0000000);
|
||||
fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), height / 2 - 4, 0xffffff);
|
||||
Gui.drawRect((int)(xPos2 - labelwidth), height / 2 - 12, width - 40, height / 2 + 12, 0xB0000000);
|
||||
fontRenderer.drawStringWithShadow(opacity1, (int)(xPos2 - stringWidth1), height / 2 - 4, 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ public class GuiSkins extends GuiScreen {
|
|||
uploadOpacity = 1;
|
||||
}
|
||||
|
||||
int opacity = Math.min(180, (int) (uploadOpacity * 180)) & 255;
|
||||
int opacity = Math.min(180, (int)(uploadOpacity * 180)) & 255;
|
||||
if (uploadOpacity > 0) {
|
||||
Gui.drawRect(0, 0, width, height, opacity << 24);
|
||||
if (uploadingSkin) {
|
||||
|
@ -504,8 +504,7 @@ public class GuiSkins extends GuiScreen {
|
|||
enableDepth();
|
||||
}
|
||||
|
||||
private void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float mouseX,
|
||||
float partialTick) {
|
||||
private void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float mouseX, float partialTick) {
|
||||
enableColorMaterial();
|
||||
pushMatrix();
|
||||
translate(xPosition, yPosition, 300);
|
||||
|
@ -523,9 +522,9 @@ public class GuiSkins extends GuiScreen {
|
|||
|
||||
rotate(rot, 0, 1, 0);
|
||||
|
||||
thePlayer.rotationYawHead = (float) Math.atan(mouseX / 20) * 30;
|
||||
thePlayer.rotationYawHead = (float)Math.atan(mouseX / 20) * 30;
|
||||
|
||||
thePlayer.rotationPitch = -((float) Math.atan(mouseY / 40)) * 20;
|
||||
thePlayer.rotationPitch = -((float)Math.atan(mouseY / 40)) * 20;
|
||||
translate(0, thePlayer.getYOffset(), 0);
|
||||
|
||||
RenderManager rm = Minecraft.getMinecraft().getRenderManager();
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
|||
return new LayerRenderer<EntityLivingBase>() {
|
||||
@Override
|
||||
public void doRenderLayer(EntityLivingBase entityBase, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
EntityPlayerModel entity = (EntityPlayerModel) entityBase;
|
||||
EntityPlayerModel entity = (EntityPlayerModel)entityBase;
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack.getItem() == Items.ELYTRA) {
|
||||
|
|
|
@ -24,8 +24,7 @@ public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileE
|
|||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
|
||||
ordinal = 4))
|
||||
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) {
|
||||
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) {
|
||||
if (profile != null) {
|
||||
Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true);
|
||||
if (skin.isPresent()) {
|
||||
|
|
|
@ -11,6 +11,7 @@ class SkinData {
|
|||
List<Skin> skins;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
class Skin {
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ public class SkinResourceManager implements IResourceManagerReloadListener {
|
|||
/**
|
||||
* Convert older resources to a newer format.
|
||||
*
|
||||
* @param res The skin resource to convert
|
||||
* @return The converted resource
|
||||
* @param res The skin resource to convert
|
||||
* @return The converted resource
|
||||
*/
|
||||
@Nullable
|
||||
public ResourceLocation getConvertedResource(@Nullable ResourceLocation res) {
|
||||
|
|
|
@ -63,7 +63,7 @@ public class LegacySkinServer implements SkinServer {
|
|||
|
||||
String url = getPath(address, type, profile);
|
||||
try {
|
||||
HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection();
|
||||
HttpURLConnection urlConnection = (HttpURLConnection)new URL(url).openConnection();
|
||||
if (urlConnection.getResponseCode() / 100 != 2) {
|
||||
throw new IOException("Bad response code: " + urlConnection.getResponseCode());
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class NetClient {
|
|||
response = HttpClients.createSystem().execute(request);
|
||||
|
||||
return getResponseCode() == HttpStatus.SC_OK;
|
||||
} catch (IOException e) { }
|
||||
} catch (IOException e) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Use this to build a {@link MinecraftTexturesPayload} object. This is
|
||||
* required because it has no useful constructor. This uses reflection
|
||||
* via Gson to create a new instance and populate the fields.
|
||||
* Use this to build a {@link MinecraftTexturesPayload} object. This is required because it has no
|
||||
* useful constructor. This uses reflection via Gson to create a new instance and populate the
|
||||
* fields.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class TexturesPayloadBuilder {
|
||||
|
|
|
@ -55,8 +55,7 @@ public class ValhallaSkinServer implements SkinServer {
|
|||
@Override
|
||||
public Optional<MinecraftTexturesPayload> loadProfileData(GameProfile profile) {
|
||||
|
||||
try (CloseableHttpClient client = HttpClients.createSystem();
|
||||
CloseableHttpResponse response = client.execute(new HttpGet(getTexturesURI(profile)))) {
|
||||
try (CloseableHttpClient client = HttpClients.createSystem(); CloseableHttpResponse response = client.execute(new HttpGet(getTexturesURI(profile)))) {
|
||||
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
|
||||
|
@ -88,9 +87,7 @@ public class ValhallaSkinServer implements SkinServer {
|
|||
}, HDSkinManager.skinUploadExecutor);
|
||||
}
|
||||
|
||||
private SkinUploadResponse upload(CloseableHttpClient client, Session session, @Nullable URI image,
|
||||
MinecraftProfileTexture.Type type, Map<String, String> metadata)
|
||||
throws IOException {
|
||||
private SkinUploadResponse upload(CloseableHttpClient client, Session session, @Nullable URI image, MinecraftProfileTexture.Type type, Map<String, String> metadata) throws IOException {
|
||||
GameProfile profile = session.getProfile();
|
||||
|
||||
if (image == null) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import javax.annotation.Nullable;
|
|||
/**
|
||||
* Uploader for Multipart form data
|
||||
*
|
||||
* @author Adam Mummery-Smith
|
||||
* @author Adam Mummery-Smith
|
||||
* @deprecated Use httpmime multipart upload
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -59,7 +59,7 @@ public class ThreadMultipartPostUpload {
|
|||
URL url = new URL(urlString);
|
||||
|
||||
// Open a HTTP connection to the URL
|
||||
httpClient = (HttpURLConnection) url.openConnection();
|
||||
httpClient = (HttpURLConnection)url.openConnection();
|
||||
httpClient.setDoOutput(true);
|
||||
httpClient.setUseCaches(false);
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class ThreadMultipartPostUpload {
|
|||
Object paramData = data.getValue();
|
||||
|
||||
if (paramData instanceof URI) {
|
||||
Path uploadPath = Paths.get((URI) paramData);
|
||||
Path uploadPath = Paths.get((URI)paramData);
|
||||
|
||||
outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + uploadPath.getFileName() + "\"" + CRLF);
|
||||
outputStream.writeBytes("Content-Type: image/png" + CRLF + CRLF);
|
||||
|
|
|
@ -25,8 +25,7 @@ public abstract class ThreadOpenFile extends Thread {
|
|||
|
||||
private static String lastChosenFile = null;
|
||||
|
||||
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
||||
throws IllegalStateException {
|
||||
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) throws IllegalStateException {
|
||||
if (minecraft.isFullScreen()) {
|
||||
throw new IllegalStateException("Cannot open an awt window whilst minecraft is in full screen mode!");
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ import java.io.File;
|
|||
*/
|
||||
public class ThreadOpenFilePNG extends ThreadOpenFile {
|
||||
|
||||
public ThreadOpenFilePNG(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
||||
throws IllegalStateException {
|
||||
public ThreadOpenFilePNG(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback) throws IllegalStateException {
|
||||
super(minecraft, dialogTitle, callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ public class ForgeProxy {
|
|||
/**
|
||||
* Gets the mod armour texture for an associated item and slot.
|
||||
*
|
||||
* @param entity The entity to get armour for.
|
||||
* @param item The armour item
|
||||
* @param def Default return value if no mods present
|
||||
* @param slot The slot this armour piece is place in.
|
||||
* @param type unknown
|
||||
* @param entity The entity to get armour for.
|
||||
* @param item The armour item
|
||||
* @param def Default return value if no mods present
|
||||
* @param slot The slot this armour piece is place in.
|
||||
* @param type unknown
|
||||
* @return
|
||||
*/
|
||||
public static String getArmorTexture(Entity entity, ItemStack item, String def, EntityEquipmentSlot slot, @Nullable String type) {
|
||||
|
@ -40,10 +40,10 @@ public class ForgeProxy {
|
|||
/**
|
||||
* Gets the mod armour model for an associated item and slot.
|
||||
*
|
||||
* @param entity The entity to get armour for.
|
||||
* @param item The armour item
|
||||
* @param slot The slot this armour piece is place in.
|
||||
* @param def Default return value if no mods present
|
||||
* @param entity The entity to get armour for.
|
||||
* @param item The armour item
|
||||
* @param slot The slot this armour piece is place in.
|
||||
* @param def Default return value if no mods present
|
||||
*/
|
||||
public static ModelBiped getArmorModel(EntityLivingBase entity, ItemStack item, EntityEquipmentSlot slot, ModelBiped def) {
|
||||
if (forgeLoaded) {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class MineLittlePony {
|
|||
|
||||
LiteLoader.getInstance().registerExposable(config, null);
|
||||
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager();
|
||||
irrm.registerReloadListener(ponyManager);
|
||||
|
||||
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
|
||||
|
|
|
@ -14,14 +14,21 @@ import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
|||
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
|
||||
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 public boolean snuzzles = true;
|
||||
@Expose public boolean hd = true;
|
||||
@Expose public boolean showscale = true;
|
||||
@Expose public boolean fpsmagic = true;
|
||||
@Expose public boolean ponyskulls = true;
|
||||
@Expose
|
||||
public boolean sizes = true;
|
||||
@Expose
|
||||
public boolean snuzzles = true;
|
||||
@Expose
|
||||
public boolean hd = true;
|
||||
@Expose
|
||||
public boolean showscale = true;
|
||||
@Expose
|
||||
public boolean fpsmagic = true;
|
||||
@Expose
|
||||
public boolean ponyskulls = true;
|
||||
|
||||
public enum PonySettings implements Setting {
|
||||
SIZES,
|
||||
|
@ -32,15 +39,22 @@ public class PonyConfig extends SensibleConfig implements Exposable {
|
|||
PONYSKULLS;
|
||||
}
|
||||
|
||||
@Expose public boolean villagers = true;
|
||||
@Expose public boolean zombies = true;
|
||||
@Expose public boolean pigzombies = true;
|
||||
@Expose public boolean skeletons = true;
|
||||
@Expose public boolean illagers = true;
|
||||
@Expose public boolean guardians = true;
|
||||
@Expose
|
||||
public boolean villagers = true;
|
||||
@Expose
|
||||
public boolean zombies = true;
|
||||
@Expose
|
||||
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.
|
||||
*
|
||||
* @param ignorePony true to ignore whatever value the setting has.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param ponylevel
|
||||
*/
|
||||
public void setPonyLevel(PonyLevel ponylevel) {
|
||||
|
|
|
@ -28,7 +28,8 @@ import java.util.UUID;
|
|||
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 {
|
||||
|
@ -69,15 +70,15 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
|||
|
||||
if (pony.usesThinArms() != slim) {
|
||||
pony = new Pony(resource, slim);
|
||||
poniesCache.put(resource, pony);
|
||||
poniesCache.put(resource, pony);
|
||||
}
|
||||
|
||||
return pony;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates a pony for the given player.
|
||||
* Delegates to the background-ponies registry if no pony skins were available and client settings allows it.
|
||||
* Gets or creates a pony for the given player. Delegates to the background-ponies registry if no
|
||||
* pony skins were available and client settings allows it.
|
||||
*
|
||||
* @param player the player
|
||||
*/
|
||||
|
@ -111,10 +112,11 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
|||
*
|
||||
* 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 uuid id of a player or entity
|
||||
* @param uuid id of a player or entity
|
||||
*/
|
||||
public Pony getPony(ResourceLocation resource, UUID uuid) {
|
||||
Pony pony = getPony(resource, isSlimSkin(uuid));
|
||||
|
|
|
@ -17,8 +17,8 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
|||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Render manager responsible for replacing and restoring entity renderers when the client settings change.
|
||||
* Old values are persisted internally.
|
||||
* Render manager responsible for replacing and restoring entity renderers when the client settings
|
||||
* change. Old values are persisted internally.
|
||||
*/
|
||||
public class PonyRenderManager {
|
||||
|
||||
|
@ -65,11 +65,11 @@ public class PonyRenderManager {
|
|||
*
|
||||
* Replaces an entity renderer depending on whether we want ponies or not.
|
||||
*
|
||||
* @param state True if we want ponies (the original will be stored)
|
||||
* @param manager The render manager
|
||||
* @param type The type to replace
|
||||
* @param state True if we want ponies (the original will be stored)
|
||||
* @param manager The render manager
|
||||
* @param type The type to replace
|
||||
* @param renderer The replacement value
|
||||
* @param <T> The entity type
|
||||
* @param <T> The entity type
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Entity, V extends T> void switchRenderer(boolean state, RenderManager manager, Class<V> type, Render<T> renderer) {
|
||||
|
|
|
@ -4,7 +4,8 @@ import net.minecraft.client.network.NetworkPlayerInfo;
|
|||
|
||||
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();
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ public interface IGUIAction<T> {
|
|||
/**
|
||||
* Performs this action now.
|
||||
*
|
||||
* @param value New Value of the field being changed
|
||||
* @return Adjusted value the field must take on
|
||||
* @param value New Value of the field being changed
|
||||
* @return Adjusted value the field must take on
|
||||
*/
|
||||
T perform(T value);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ public class Slider extends GuiSlider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setEntryValue(int id, boolean value) { }
|
||||
public void setEntryValue(int id, boolean value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntryValue(int id, float value) {
|
||||
|
@ -32,7 +33,8 @@ public class Slider extends GuiSlider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setEntryValue(int id, String value) { }
|
||||
public void setEntryValue(int id, String value) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class MixinItemRenderer {
|
|||
//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"))
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public class ModelWrapper implements IModelWrapper {
|
|||
|
||||
/**
|
||||
* Returns the contained armour model.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public PonyArmor getArmor() {
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class PMAPI {
|
|||
public static void init() {
|
||||
for (Field field : PMAPI.class.getFields()) {
|
||||
try {
|
||||
ModelWrapper model = (ModelWrapper) field.get(null);
|
||||
ModelWrapper model = (ModelWrapper)field.get(null);
|
||||
model.init();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -2,70 +2,69 @@ package com.minelittlepony.model;
|
|||
|
||||
public final class PonyModelConstants {
|
||||
|
||||
public static final float
|
||||
PI = (float)Math.PI,
|
||||
public static final float 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;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ public interface IModel extends ICapitated {
|
|||
|
||||
/**
|
||||
* Sets up this model's initial values, like a constructor...
|
||||
* @param yOffset YPosition for this model. Always 0.
|
||||
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
|
||||
*
|
||||
* @param yOffset YPosition for this model. Always 0.
|
||||
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
|
||||
*/
|
||||
void init(float yOffset, float stretch);
|
||||
|
||||
|
@ -40,8 +41,8 @@ public interface IModel extends ICapitated {
|
|||
boolean isFlying();
|
||||
|
||||
/**
|
||||
* Returns true if the model is elytra flying. Elytra flying is different
|
||||
* from regular flying in that there are actual "wings" involved.
|
||||
* Returns true if the model is elytra flying. Elytra flying is different from regular flying in
|
||||
* that there are actual "wings" involved.
|
||||
*/
|
||||
boolean isElytraFlying();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.model.capabilities;
|
|||
public interface IModelPart {
|
||||
/**
|
||||
* Initialises all of the boxes in this modelpart.
|
||||
*
|
||||
* @param yOffset
|
||||
* @param stretch
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,7 @@ public interface IModelUnicorn extends IModel {
|
|||
|
||||
/**
|
||||
* Returns true if this model is currently using magic (horn is lit).
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isCasting();
|
||||
|
|
|
@ -55,10 +55,10 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
|
||||
protected int getProfession(Entity entity) {
|
||||
if (entity instanceof EntityVillager) {
|
||||
return ((EntityVillager) entity).getProfession();
|
||||
return ((EntityVillager)entity).getProfession();
|
||||
}
|
||||
if (entity instanceof EntityZombieVillager) {
|
||||
return ((EntityZombieVillager) entity).getProfession();
|
||||
return ((EntityZombieVillager)entity).getProfession();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,10 @@ package com.minelittlepony.pony.data;
|
|||
|
||||
/**
|
||||
* Interface for enums that can be parsed from an image trigger pixel value.
|
||||
*
|
||||
* @author Chris Albers
|
||||
*
|
||||
* @param <T>
|
||||
* @param <T>
|
||||
*/
|
||||
public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>> {
|
||||
/**
|
||||
|
@ -13,10 +14,10 @@ public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>>
|
|||
int getTriggerPixel();
|
||||
|
||||
/**
|
||||
* Gets the enum value corresponding to the given enum type and pixel value.
|
||||
* If none are found, the first parameter is returned as the default.
|
||||
* Gets the enum value corresponding to the given enum type and pixel value. If none are found, the
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -83,19 +83,19 @@ public class Pony {
|
|||
MineLittlePony.logger.debug("Obtained skin from resource location {}", resource);
|
||||
|
||||
return skinImage;
|
||||
} catch (IOException ignored) { }
|
||||
} catch (IOException ignored) {}
|
||||
|
||||
try {
|
||||
ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
||||
|
||||
if (texture instanceof MixinThreadDownloadImageData) {
|
||||
return ((MixinThreadDownloadImageData) texture).getBufferedImage();
|
||||
return ((MixinThreadDownloadImageData)texture).getBufferedImage();
|
||||
} else if (texture instanceof ThreadDownloadImageETag) {
|
||||
return ((ThreadDownloadImageETag) texture).getBufferedImage();
|
||||
return ((ThreadDownloadImageETag)texture).getBufferedImage();
|
||||
} else if (texture instanceof DynamicTextureImage) {
|
||||
return ((DynamicTextureImage) texture).getImage();
|
||||
return ((DynamicTextureImage)texture).getImage();
|
||||
}
|
||||
} catch (Exception ignored) { }
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
return new PonyData(image);
|
||||
|
|
|
@ -53,7 +53,7 @@ public enum TriggerPixels {
|
|||
return out;
|
||||
}
|
||||
|
||||
public <T extends Enum<T> & ITriggerPixelMapped<T>> void readFlags(boolean[] out, BufferedImage image) {
|
||||
public <T extends Enum<T> & ITriggerPixelMapped<T>> void readFlags(boolean[] out, BufferedImage image) {
|
||||
readFlag(out, Channel.RED, image);
|
||||
readFlag(out, Channel.GREEN, image);
|
||||
readFlag(out, Channel.BLUE, image);
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
this.textureOffsetX = x;
|
||||
this.textureOffsetY = y;
|
||||
super.setTextureOffset(x, y);
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
|
||||
public T mirror(boolean m) {
|
||||
mirror = m;
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
}
|
||||
|
||||
public T size(int x, int y) {
|
||||
return (T) setTextureSize(x, y);
|
||||
return (T)setTextureSize(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
modelOffsetX = x;
|
||||
modelOffsetY = y;
|
||||
modelOffsetZ = z;
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,12 +96,12 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
rotateAngleX = x;
|
||||
rotateAngleY = y;
|
||||
rotateAngleZ = z;
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions a given model in space by setting its offset values divided
|
||||
* by 16 to account for scaling applied inside the model.
|
||||
* Positions a given model in space by setting its offset values divided by 16 to account for
|
||||
* scaling applied inside the model.
|
||||
*/
|
||||
public static <T extends ModelRenderer> T at(T renderer, float x, float y, float z) {
|
||||
renderer.offsetX = x / 16;
|
||||
|
@ -129,12 +129,12 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
*/
|
||||
public T around(float x, float y, float z) {
|
||||
setRotationPoint(x, y, z);
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates a new child model based on its unique index.
|
||||
* New children will be of the same type and inherit the same textures and offsets of the original.
|
||||
* Gets or creates a new child model based on its unique index. New children will be of the same
|
||||
* type and inherit the same textures and offsets of the original.
|
||||
*/
|
||||
public T child(int index) {
|
||||
if (childModels == null || index >= childModels.size()) {
|
||||
|
@ -171,13 +171,13 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
setTextureOffset(tex.textureOffsetX, tex.textureOffsetY).addBox(offX, offY, offZ, width, height, depth);
|
||||
cubeList.get(cubeList.size() - 1).setBoxName(partName);
|
||||
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T addBox(float offX, float offY, float offZ, int width, int height, int depth) {
|
||||
addBox(offX, offY, offZ, width, height, depth, 0);
|
||||
return (T) this;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public class LevitatingItemRenderer {
|
|||
setColor(glowColor);
|
||||
|
||||
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
((IRenderItem) renderItem).useTransparency(true);
|
||||
((IRenderItem)renderItem).useTransparency(true);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(true);
|
||||
|
||||
scale(1.1, 1.1, 1.1);
|
||||
|
@ -44,7 +44,7 @@ public class LevitatingItemRenderer {
|
|||
translate(0.01F, -0.01F, -0.02F);
|
||||
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||
|
||||
((IRenderItem) renderItem).useTransparency(false);
|
||||
((IRenderItem)renderItem).useTransparency(false);
|
||||
PonySkullRenderer.ponyInstance.useTransparency(false);
|
||||
unsetColor();
|
||||
enableLighting();
|
||||
|
|
|
@ -30,8 +30,8 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
|||
private static final Map<Integer, ISkull> skullMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Resolves the games skull renderer to either a specialised pony skull renderer
|
||||
* or some other skull renderer depending on the ponyskulls state.
|
||||
* Resolves the games skull renderer to either a specialised pony skull renderer or some other skull
|
||||
* renderer depending on the ponyskulls state.
|
||||
*
|
||||
* Original/Existing renderer is stored to a backup variable as a fallback in case of mods.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
// TODO: A lot of this duplicates RenderPonyPlayer
|
||||
// and is the whole reason we had this scaling bug in the first place.
|
||||
// and is the whole reason we had this scaling bug in the first place.
|
||||
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony<T> {
|
||||
|
||||
protected final RenderPony<T> renderPony = new RenderPony<>(this);
|
||||
|
|
|
@ -28,13 +28,16 @@ public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements L
|
|||
* Renders this layer.
|
||||
*
|
||||
* @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 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 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);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
private EntityLivingBase renderShoulderEntity(AbstractClientPlayer player, @Nullable EntityLivingBase entity, NBTTagCompound shoulderTag, float headYaw, float headPitch, boolean left) {
|
||||
|
||||
if (entity == null || !entity.getUniqueID().equals(shoulderTag.getUniqueId("UUID"))) {
|
||||
entity = (EntityLivingBase) EntityList.createEntityFromNBT(shoulderTag, player.world);
|
||||
entity = (EntityLivingBase)EntityList.createEntityFromNBT(shoulderTag, player.world);
|
||||
// this isn't an entity.
|
||||
if (entity == null) {
|
||||
return null;
|
||||
|
|
|
@ -36,7 +36,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
|||
|
||||
pushMatrix();
|
||||
if (model instanceof IModel) {
|
||||
((IModel) model).transform(BodyPart.LEGS);
|
||||
((IModel)model).transform(BodyPart.LEGS);
|
||||
}
|
||||
|
||||
if (model.isChild) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
|
||||
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) {
|
||||
|
||||
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
|
||||
ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
|
||||
|
||||
ModelPonyArmor armour = getArmorModel(entity, itemstack, armorSlot, pony.getArmor().getArmorForSlot(armorSlot));
|
||||
armour.setModelAttributes(pony.getBody());
|
||||
|
@ -85,7 +85,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
}
|
||||
|
||||
private Tuple<ResourceLocation, Boolean> getArmorTexture(T entity, ItemStack itemstack, EntityEquipmentSlot slot, @Nullable String type) {
|
||||
ItemArmor item = (ItemArmor) itemstack.getItem();
|
||||
ItemArmor item = (ItemArmor)itemstack.getItem();
|
||||
String texture = item.getArmorMaterial().getName();
|
||||
|
||||
String domain = "minecraft";
|
||||
|
@ -170,7 +170,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
}
|
||||
|
||||
if (model instanceof IEquestrianArmor) {
|
||||
return ((IEquestrianArmor) model).getArmorForSlot(slot);
|
||||
return ((IEquestrianArmor)model).getArmorForSlot(slot);
|
||||
}
|
||||
|
||||
return def;
|
||||
|
|
|
@ -44,7 +44,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
double sin = MathHelper.sin(motionYaw * PI / 180);
|
||||
double cos = -MathHelper.cos(motionYaw * PI / 180);
|
||||
|
||||
float capeMotionY = (float) capeY * 10;
|
||||
float capeMotionY = (float)capeY * 10;
|
||||
|
||||
if (capeMotionY < -6) {
|
||||
capeMotionY = -6;
|
||||
|
@ -53,9 +53,9 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
capeMotionY = 32;
|
||||
}
|
||||
|
||||
float capeMotionX = (float) (capeX * sin + capeZ * cos) * 100;
|
||||
float capeMotionX = (float)(capeX * sin + capeZ * cos) * 100;
|
||||
|
||||
float diagMotion = (float) (capeX * cos - capeZ * sin) * 100;
|
||||
float diagMotion = (float)(capeX * cos - capeZ * sin) * 100;
|
||||
|
||||
if (capeMotionX < 0) {
|
||||
capeMotionX = 0;
|
||||
|
@ -65,7 +65,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
capeMotionY += MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * scale) * 6) * 32 * camera;
|
||||
|
||||
rotate(2 + capeMotionX / 12 + capeMotionY, 1, 0, 0);
|
||||
rotate( diagMotion / 2, 0, 0, 1);
|
||||
rotate(diagMotion / 2, 0, 0, 1);
|
||||
rotate(-diagMotion / 2, 0, 1, 0);
|
||||
rotate(180, 0, 0, 1);
|
||||
rotate(90, 1, 0, 0);
|
||||
|
|
|
@ -101,7 +101,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
|||
}
|
||||
|
||||
private ModelWrapper getModel() {
|
||||
return ((IRenderPony) renderer).getModelWrapper();
|
||||
return ((IRenderPony)renderer).getModelWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,7 +51,7 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
|||
|
||||
protected ResourceLocation getElytraTexture(T entity) {
|
||||
if (entity instanceof AbstractClientPlayer) {
|
||||
AbstractClientPlayer player = (AbstractClientPlayer) entity;
|
||||
AbstractClientPlayer player = (AbstractClientPlayer)entity;
|
||||
|
||||
ResourceLocation result;
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.minelittlepony.render.plane;
|
||||
|
||||
enum Face {
|
||||
NORTH, SOUTH,
|
||||
UP, DOWN,
|
||||
EAST, WEST;
|
||||
NORTH,
|
||||
SOUTH,
|
||||
UP,
|
||||
DOWN,
|
||||
EAST,
|
||||
WEST;
|
||||
}
|
|
@ -107,7 +107,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
public float prepareScale(AbstractClientPlayer player, float ticks) {
|
||||
|
||||
if (!player.isRiding() && !player.isPlayerSleeping()) {
|
||||
float x = player.width/2;
|
||||
float x = player.width / 2;
|
||||
float y = 0;
|
||||
|
||||
if (player.isSneaking()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager
|
|||
@Override
|
||||
protected void applyRotations(EntityZombieVillager entity, float move, float rotationYaw, float ticks) {
|
||||
if (entity.isConverting()) {
|
||||
rotationYaw += (float) (Math.cos(entity.ticksExisted * 3.25D) * (Math.PI / 4));
|
||||
rotationYaw += (float)(Math.cos(entity.ticksExisted * 3.25D) * (Math.PI / 4));
|
||||
}
|
||||
|
||||
super.applyRotations(entity, move, rotationYaw, ticks);
|
||||
|
|
|
@ -53,8 +53,7 @@ public abstract class SensibleConfig {
|
|||
public boolean setValue(Setting key, boolean value) {
|
||||
try {
|
||||
this.getClass().getField(key.name().toLowerCase()).setBoolean(this, value);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignored) {
|
||||
}
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignored) {}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class PostureFlight implements PonyPosture<AbstractClientPlayer> {
|
|||
float modelYaw = MathUtil.sensibleAngle(player.renderYawOffset);
|
||||
|
||||
// detecting that we're flying backwards and roll must be inverted
|
||||
if (Math.abs(MathUtil.sensibleAngle((float) Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) {
|
||||
if (Math.abs(MathUtil.sensibleAngle((float)Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) {
|
||||
roll *= -1;
|
||||
}
|
||||
|
||||
|
@ -53,11 +53,11 @@ public class PostureFlight implements PonyPosture<AbstractClientPlayer> {
|
|||
|
||||
@Override
|
||||
public void transform(AbstractPonyModel model, AbstractClientPlayer player, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) {
|
||||
model.motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ);
|
||||
model.motionPitch = (float)calculateIncline(player, motionX, motionY, motionZ);
|
||||
|
||||
GlStateManager.rotate(model.motionPitch, 1, 0, 0);
|
||||
|
||||
float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
||||
float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
||||
|
||||
roll = model.getMetadata().getInterpolator().interpolate("pegasusRoll", roll, 10);
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ public abstract class Box<T extends ModelRenderer> extends ModelBox {
|
|||
/**
|
||||
* Creates a new quad with the given spacial vertices.
|
||||
*/
|
||||
protected Quad quad(int startX, int width, int startY, int height, Vertex ...verts) {
|
||||
protected Quad quad(int startX, int width, int startY, int height, Vertex... verts) {
|
||||
return new Quad(verts,
|
||||
startX, startY,
|
||||
startX, startY,
|
||||
startX + width, startY + height,
|
||||
parent.textureWidth, parent.textureHeight);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue