diff --git a/build.gradle b/build.gradle index 9ce52f17..8909894e 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,10 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 sourceSets { + external { + } main { + compileClasspath += external.output refMap = project.refCore } } diff --git a/src/api/java/com/minelittlepony/MineLittlePony.java b/src/api/java/com/minelittlepony/MineLittlePony.java index 25f05b3c..7608ec7e 100644 --- a/src/api/java/com/minelittlepony/MineLittlePony.java +++ b/src/api/java/com/minelittlepony/MineLittlePony.java @@ -4,8 +4,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class MineLittlePony { +public abstract class MineLittlePony { public static Object getConfig() { - return null; + throw new RuntimeException(); } } diff --git a/src/api/java/com/minelittlepony/model/anim/IInterpolator.java b/src/api/java/com/minelittlepony/model/anim/IInterpolator.java deleted file mode 100644 index ad271b70..00000000 --- a/src/api/java/com/minelittlepony/model/anim/IInterpolator.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.minelittlepony.model.anim; - -/** - * Interpolator function for handling transitions between animation states. - */ -@FunctionalInterface -public interface IInterpolator { - /** - * Interpolates a value between the requested final destination and what it was last. - * - * @param key Identifier to track previous values - * @param to The new values - * @param scalingFactor Scaling factor to control how quickly values change - */ - float interpolate(String key, float to, float scalingFactor); -} diff --git a/src/api/java/com/minelittlepony/render/model/GlowRenderer.java b/src/api/java/com/minelittlepony/render/model/GlowRenderer.java deleted file mode 100644 index 0e9becb5..00000000 --- a/src/api/java/com/minelittlepony/render/model/GlowRenderer.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.minelittlepony.render.model; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBase; - -import org.lwjgl.opengl.GL11; - -import com.minelittlepony.util.render.AbstractBoxRenderer; -import com.minelittlepony.util.render.Color; - -public class GlowRenderer extends AbstractBoxRenderer { - - int tint; - float alpha = 1; - - public GlowRenderer(ModelBase model, int x, int y) { - super(model, x, y); - } - - public GlowRenderer setAlpha(float alpha) { - this.alpha = alpha; - - return this; - } - - public GlowRenderer setTint(int tint) { - this.tint = tint; - - return this; - } - - public void applyTint(float alpha) { - Color.glColor(tint, alpha); - } - - @Override - public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - cubeList.add(new ModelGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, alpha)); - } - - @Override - public void render(float scale) { - GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); - Minecraft.getMinecraft().entityRenderer.disableLightmap(); - super.render(scale); - GL11.glPopAttrib(); - } - - @Override - protected GlowRenderer copySelf() { - return new GlowRenderer(baseModel, textureOffsetX, textureOffsetY); - } -} diff --git a/src/api/java/com/minelittlepony/render/model/ModelGlow.java b/src/api/java/com/minelittlepony/render/model/ModelGlow.java deleted file mode 100644 index 54289295..00000000 --- a/src/api/java/com/minelittlepony/render/model/ModelGlow.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.minelittlepony.render.model; - -import net.minecraft.client.renderer.BufferBuilder; - -import com.minelittlepony.util.render.Box; -import com.minelittlepony.util.render.Quad; -import com.minelittlepony.util.render.Vertex; - -/** - * Like a normal box, but with the top narrowed a bit. - */ -public class ModelGlow extends Box { - - private final float alpha; - - private Quad[] quadList; - - public ModelGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, float alpha) { - super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale); - - this.alpha = alpha; - - float xMax = xMin + w + scale; - float yMax = yMin + h + scale; - float zMax = zMin + d + scale; - - xMin -= scale; - yMin -= scale; - zMin -= scale; - - if (renderer.mirror) { - float v = xMax; - xMax = xMin; - xMin = v; - } - - float tipInset = 0.4f; - - float tipXmin = xMin + w * tipInset; - float tipZmin = zMin + d * tipInset; - float tipXMax = xMax - w * tipInset; - float tipZMax = zMax - d * tipInset; - - // w:west e:east d:down u:up s:south n:north - Vertex wds = vert(tipXmin, yMin, tipZmin, 0, 0); - Vertex eds = vert(tipXMax, yMin, tipZmin, 0, 8); - Vertex eus = vert(xMax, yMax, zMin, 8, 8); - Vertex wus = vert(xMin, yMax, zMin, 8, 0); - Vertex wdn = vert(tipXmin, yMin, tipZMax, 0, 0); - Vertex edn = vert(tipXMax, yMin, tipZMax, 0, 8); - Vertex eun = vert(xMax, yMax, zMax, 8, 8); - 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) - }; - - if (renderer.mirror) { - for (Quad i : quadList) { - i.flipFace(); - } - } - } - - @Override - public void render(BufferBuilder buffer, float scale) { - parent.applyTint(alpha); - - for (Quad i : quadList) { - i.draw(buffer, scale); - } - } -} diff --git a/src/api/java/com/minelittlepony/render/model/ModelPlane.java b/src/api/java/com/minelittlepony/render/model/ModelPlane.java deleted file mode 100644 index 444325a2..00000000 --- a/src/api/java/com/minelittlepony/render/model/ModelPlane.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.minelittlepony.render.model; - -import net.minecraft.client.renderer.BufferBuilder; - -import com.minelittlepony.util.render.Box; -import com.minelittlepony.util.render.Quad; -import com.minelittlepony.util.render.Vertex; - -import javax.annotation.Nonnull; - -public class ModelPlane extends Box { - - private Quad quad; - - public boolean hidden = false; - - public ModelPlane(PlaneRenderer renderer, int textureX, int textureY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, Plane face) { - super(renderer, textureX, textureY, xMin, yMin, zMin, w, h, d, scale, false); - - float xMax = xMin + w + scale; - float yMax = yMin + h + scale; - float zMax = zMin + d + scale; - - xMin -= scale; - yMin -= scale; - zMin -= scale; - - if (renderer.mirror) { - float v = xMax; - xMax = xMin; - xMin = v; - } - - if (renderer.mirrory) { - float v = yMax; - yMax = yMin; - yMin = v; - } - - if (renderer.mirrorz) { - float v = zMax; - zMax = zMin; - zMin = v; - } - - // w:west e:east d:down u:up s:south n:north - Vertex wds = vert(xMin, yMin, zMin, 0, 0); - Vertex eds = vert(xMax, yMin, zMin, 0, 8); - Vertex eus = vert(xMax, yMax, zMin, 8, 8); - Vertex wus = vert(xMin, yMax, zMin, 8, 0); - Vertex wdn = vert(xMin, yMin, zMax, 0, 0); - Vertex edn = vert(xMax, yMin, zMax, 0, 8); - Vertex eun = vert(xMax, yMax, zMax, 8, 8); - Vertex wun = vert(xMin, yMax, zMax, 8, 0); - - if (face == Plane.EAST) { - quad = quad(textureX, d, textureY, h, edn, eds, eus, eun); - } - if (face == Plane.WEST) { - quad = quad(textureX, d, textureY, h, wds, wdn, wun, wus); - } - if (face == Plane.UP) { - quad = quad(textureX, w, textureY, d, edn, wdn, wds, eds); - } - if (face == Plane.DOWN) { - quad = quad(textureX, w, textureY, d, eus, wus, wun, eun); - } - if (face == Plane.SOUTH) { - quad = quad(textureX, w, textureY, h, eds, wds, wus, eus); - } - if (face == Plane.NORTH) { - quad = quad(textureX, w, textureY, h, wdn, edn, eun, wun); - } - - if (renderer.mirror || renderer.mirrory || renderer.mirrorz) { - quad.flipFace(); - } - } - - @Override - public void render(@Nonnull BufferBuilder buffer, float scale) { - if (!hidden) quad.draw(buffer, scale); - } -} diff --git a/src/api/java/com/minelittlepony/render/model/Plane.java b/src/api/java/com/minelittlepony/render/model/Plane.java deleted file mode 100644 index 9e509117..00000000 --- a/src/api/java/com/minelittlepony/render/model/Plane.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.minelittlepony.render.model; - -enum Plane { - NORTH, - SOUTH, - UP, - DOWN, - EAST, - WEST -} \ No newline at end of file diff --git a/src/api/java/com/minelittlepony/render/model/PlaneRenderer.java b/src/api/java/com/minelittlepony/render/model/PlaneRenderer.java deleted file mode 100644 index e738e396..00000000 --- a/src/api/java/com/minelittlepony/render/model/PlaneRenderer.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.minelittlepony.render.model; - -import net.minecraft.client.model.ModelBase; - -import com.minelittlepony.util.render.AbstractBoxRenderer; - -public class PlaneRenderer extends AbstractBoxRenderer { - - public boolean mirrory, mirrorz; - - public PlaneRenderer(ModelBase model) { - super(model); - } - - public PlaneRenderer(ModelBase model, int x, int y) { - super(model, x, y); - } - - /** - * Flips the Z bit. Any calls to add a plane will be mirrored until this is called again. - */ - public PlaneRenderer flipZ() { - mirrorz = !mirrorz; - return this; - } - - - /** - * Flips the Y bit. Any calls to add a plane will be mirrored until this is called again. - */ - public PlaneRenderer flipY() { - mirrory = !mirrory; - return this; - } - - @Override - protected PlaneRenderer copySelf() { - return new PlaneRenderer(baseModel, textureOffsetX, textureOffsetY); - } - - private PlaneRenderer addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Plane face) { - cubeList.add(new ModelPlane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face)); - return this; - } - - public PlaneRenderer top(float offX, float offY, float offZ, int width, int depth, float scale) { - return addPlane(offX, offY, offZ, width, 0, depth, scale, Plane.UP); - } - - public PlaneRenderer bottom(float offX, float offY, float offZ, int width, int depth, float scale) { - return addPlane(offX, offY, offZ, width, 0, depth, scale, Plane.DOWN); - } - - public PlaneRenderer west(float offX, float offY, float offZ, int height, int depth, float scale) { - return addPlane(offX, offY, offZ, 0, height, depth, scale, Plane.WEST); - } - - public PlaneRenderer east(float offX, float offY, float offZ, int height, int depth, float scale) { - return addPlane(offX, offY, offZ, 0, height, depth, scale, Plane.EAST); - } - - public PlaneRenderer north(float offX, float offY, float offZ, int width, int height, float scale) { - return addPlane(offX, offY, offZ - scale * 2, width, height, 0, scale, Plane.NORTH); - } - - public PlaneRenderer south(float offX, float offY, float offZ, int width, int height, float scale) { - return addPlane(offX, offY, offZ + scale * 2, width, height, 0, scale, Plane.SOUTH); - } -} diff --git a/src/api/java/com/minelittlepony/render/model/PonyRenderer.java b/src/api/java/com/minelittlepony/render/model/PonyRenderer.java deleted file mode 100644 index d656eb10..00000000 --- a/src/api/java/com/minelittlepony/render/model/PonyRenderer.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.minelittlepony.render.model; - -import net.minecraft.client.model.ModelBase; - -import com.minelittlepony.util.render.AbstractBoxRenderer; - -public class PonyRenderer extends AbstractBoxRenderer { - - public PonyRenderer(ModelBase model) { - super(model); - } - - public PonyRenderer(ModelBase model, int texX, int texY) { - super(model, texX, texY); - } - - @Override - protected PonyRenderer copySelf() { - return new PonyRenderer(baseModel, textureOffsetX, textureOffsetY); - } -} diff --git a/src/api/java/com/minelittlepony/render/model/package-info.java b/src/api/java/com/minelittlepony/render/model/package-info.java deleted file mode 100644 index 79bb8ff0..00000000 --- a/src/api/java/com/minelittlepony/render/model/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault -package com.minelittlepony.render.model; - -import mcp.MethodsReturnNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/api/java/com/minelittlepony/util/render/AbstractBoxRenderer.java b/src/api/java/com/minelittlepony/util/render/AbstractBoxRenderer.java deleted file mode 100644 index 2bce7b9b..00000000 --- a/src/api/java/com/minelittlepony/util/render/AbstractBoxRenderer.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.minelittlepony.util.render; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelBox; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.TextureOffset; - -@SuppressWarnings("unchecked") -public abstract class AbstractBoxRenderer> extends ModelRenderer { - - protected final ModelBase baseModel; - - protected int textureOffsetX; - protected int textureOffsetY; - - protected float modelOffsetX; - protected float modelOffsetY; - protected float modelOffsetZ; - - public AbstractBoxRenderer(ModelBase model) { - super(model); - baseModel = model; - } - - public AbstractBoxRenderer(ModelBase model, int texX, int texY) { - super(model, texX, texY); - baseModel = model; - } - - /** - * Called to create a new instance of this renderer (used for child renderers) - */ - protected abstract T copySelf(); - - @Override - public T setTextureOffset(int x, int y) { - this.textureOffsetX = x; - this.textureOffsetY = y; - super.setTextureOffset(x, y); - return (T) this; - } - - /** - * Flips the mirror flag. All faces are mirrored until this is called again. - */ - public T flip() { - return mirror(!mirror); - } - - public T mirror(boolean m) { - mirror = m; - return (T) this; - } - - /** - * Sets the texture offset - */ - public T tex(int x, int y) { - return setTextureOffset(x, y); - } - - /** - * Sets the texture size for this renderer. - */ - public T size(int w, int h) { - return (T) setTextureSize(w, h); - } - - /** - * Positions this model in space. - */ - public T at(float x, float y, float z) { - return (T)at(this, x, y, z); - } - - /** - * Sets an offset to be used on all shapes and children created through this renderer. - */ - public T offset(float x, float y, float z) { - modelOffsetX = x; - modelOffsetY = y; - modelOffsetZ = z; - return (T) this; - } - - /** - * Adjusts the rotation center of the given renderer by the given amounts in each direction. - */ - public static void shiftRotationPoint(ModelRenderer renderer, float x, float y, float z) { - renderer.rotationPointX += x; - renderer.rotationPointY += y; - renderer.rotationPointZ += z; - } - - /** - * Sets this renderer's rotation angles. - */ - public T rotate(float x, float y, float z) { - rotateAngleX = x; - rotateAngleY = y; - rotateAngleZ = z; - 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. - */ - public static T at(T renderer, float x, float y, float z) { - renderer.offsetX = x / 16; - renderer.offsetY = y / 16; - renderer.offsetZ = z / 16; - return renderer; - } - - /** - * Rotates this model to align itself with the angles of another. - */ - public void rotateTo(ModelRenderer other) { - rotate(other.rotateAngleX, other.rotateAngleY, other.rotateAngleZ); - } - - /** - * Shifts this model to align its center with the center of another. - */ - public T rotateAt(ModelRenderer other) { - return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ); - } - - /** - * Sets the rotation point. - */ - public T around(float x, float y, float z) { - setRotationPoint(x, y, z); - 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. - */ - public T child(int index) { - if (childModels == null || index >= childModels.size()) { - return child(); - } - return (T)childModels.get(index); - } - - /** - * Returns a brand new child under this renderer. - */ - public T child() { - T copy = copySelf(); - child(copy.offset(modelOffsetX, modelOffsetY, modelOffsetZ)); - copy.textureHeight = textureHeight; - copy.textureWidth = textureWidth; - return copy; - } - - /** - * Adds a new child renderer and returns itself for chaining. - */ - public T child(K child) { - addChild(child); - return (T)this; - } - - @Override - public T addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth) { - partName = boxName + "." + partName; - - TextureOffset tex = baseModel.getTextureOffset(partName); - - setTextureOffset(tex.textureOffsetX, tex.textureOffsetY).addBox(offX, offY, offZ, width, height, depth); - cubeList.get(cubeList.size() - 1).setBoxName(partName); - - 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; - } - - @Override - public T addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) { - addBox(offX, offY, offZ, width, height, depth, 0, mirrored); - return (T)this; - } - - @Override - public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { - addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror); - } - - /** - * Creates a textured box. - */ - public T box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { - return addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror); - } - - private T addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - createBox(modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored); - return (T)this; - } - - protected void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - cubeList.add(new ModelBox(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, mirrored)); - } -} diff --git a/src/api/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java b/src/external/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java similarity index 97% rename from src/api/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java rename to src/external/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java index 9354e201..b62defd0 100644 --- a/src/api/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java +++ b/src/external/java/com/minelittlepony/model/anim/BasicEasingInterpolator.java @@ -3,6 +3,7 @@ package com.minelittlepony.model.anim; import java.util.HashMap; import java.util.Map; +//#MineLittlePony# public class BasicEasingInterpolator implements IInterpolator { private final Map properties = new HashMap(); diff --git a/src/external/java/com/minelittlepony/model/anim/IInterpolator.java b/src/external/java/com/minelittlepony/model/anim/IInterpolator.java new file mode 100644 index 00000000..dea22f74 --- /dev/null +++ b/src/external/java/com/minelittlepony/model/anim/IInterpolator.java @@ -0,0 +1,7 @@ +package com.minelittlepony.model.anim; + +// #MineLittlePony# +@FunctionalInterface +public interface IInterpolator { + float interpolate(String key, float to, float scalingFactor); +} diff --git a/src/api/java/com/minelittlepony/transform/MotionCompositor.java b/src/external/java/com/minelittlepony/transform/MotionCompositor.java similarity index 98% rename from src/api/java/com/minelittlepony/transform/MotionCompositor.java rename to src/external/java/com/minelittlepony/transform/MotionCompositor.java index 2a008197..53740605 100644 --- a/src/api/java/com/minelittlepony/transform/MotionCompositor.java +++ b/src/external/java/com/minelittlepony/transform/MotionCompositor.java @@ -5,6 +5,7 @@ import net.minecraft.util.math.MathHelper; import com.minelittlepony.util.math.MathUtil; +//#MineLittlePony# public abstract class MotionCompositor { protected double calculateRoll(EntityPlayer player, double motionX, double motionY, double motionZ) { diff --git a/src/api/java/com/minelittlepony/util/math/MathUtil.java b/src/external/java/com/minelittlepony/util/math/MathUtil.java similarity index 97% rename from src/api/java/com/minelittlepony/util/math/MathUtil.java rename to src/external/java/com/minelittlepony/util/math/MathUtil.java index 83824908..2a97c1d8 100644 --- a/src/api/java/com/minelittlepony/util/math/MathUtil.java +++ b/src/external/java/com/minelittlepony/util/math/MathUtil.java @@ -2,6 +2,7 @@ package com.minelittlepony.util.math; import net.minecraft.util.math.MathHelper; +//#MineLittlePony# public class MathUtil { public static double clampLimit(double num, double limit) { diff --git a/src/api/java/com/minelittlepony/util/render/Box.java b/src/external/java/com/minelittlepony/util/render/Box.java similarity index 100% rename from src/api/java/com/minelittlepony/util/render/Box.java rename to src/external/java/com/minelittlepony/util/render/Box.java diff --git a/src/api/java/com/minelittlepony/util/render/Color.java b/src/external/java/com/minelittlepony/util/render/Color.java similarity index 100% rename from src/api/java/com/minelittlepony/util/render/Color.java rename to src/external/java/com/minelittlepony/util/render/Color.java diff --git a/src/api/java/com/minelittlepony/util/render/Quad.java b/src/external/java/com/minelittlepony/util/render/Quad.java similarity index 100% rename from src/api/java/com/minelittlepony/util/render/Quad.java rename to src/external/java/com/minelittlepony/util/render/Quad.java diff --git a/src/api/java/com/minelittlepony/util/render/Vertex.java b/src/external/java/com/minelittlepony/util/render/Vertex.java similarity index 100% rename from src/api/java/com/minelittlepony/util/render/Vertex.java rename to src/external/java/com/minelittlepony/util/render/Vertex.java