mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Rework the sourcesets slightly so I can include the parts of MineLP I need
This commit is contained in:
parent
f45dbf08e2
commit
842770d940
19 changed files with 15 additions and 552 deletions
|
@ -48,7 +48,10 @@ sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
external {
|
||||||
|
}
|
||||||
main {
|
main {
|
||||||
|
compileClasspath += external.output
|
||||||
refMap = project.refCore
|
refMap = project.refCore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class MineLittlePony {
|
public abstract class MineLittlePony {
|
||||||
public static Object getConfig() {
|
public static Object getConfig() {
|
||||||
return null;
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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<GlowRenderer> {
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<GlowRenderer> {
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<PlaneRenderer> {
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.minelittlepony.render.model;
|
|
||||||
|
|
||||||
enum Plane {
|
|
||||||
NORTH,
|
|
||||||
SOUTH,
|
|
||||||
UP,
|
|
||||||
DOWN,
|
|
||||||
EAST,
|
|
||||||
WEST
|
|
||||||
}
|
|
|
@ -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<PlaneRenderer> {
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<PonyRenderer> {
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
@ParametersAreNonnullByDefault
|
|
||||||
package com.minelittlepony.render.model;
|
|
||||||
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
|
@ -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<T extends AbstractBoxRenderer<T>> 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 extends ModelRenderer> 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 <K extends ModelRenderer> 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));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.model.anim;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
//#MineLittlePony#
|
||||||
public class BasicEasingInterpolator implements IInterpolator {
|
public class BasicEasingInterpolator implements IInterpolator {
|
||||||
|
|
||||||
private final Map<String, Float> properties = new HashMap<String, Float>();
|
private final Map<String, Float> properties = new HashMap<String, Float>();
|
7
src/external/java/com/minelittlepony/model/anim/IInterpolator.java
vendored
Normal file
7
src/external/java/com/minelittlepony/model/anim/IInterpolator.java
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package com.minelittlepony.model.anim;
|
||||||
|
|
||||||
|
// #MineLittlePony#
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IInterpolator {
|
||||||
|
float interpolate(String key, float to, float scalingFactor);
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.minelittlepony.util.math.MathUtil;
|
import com.minelittlepony.util.math.MathUtil;
|
||||||
|
|
||||||
|
//#MineLittlePony#
|
||||||
public abstract class MotionCompositor {
|
public abstract class MotionCompositor {
|
||||||
|
|
||||||
protected double calculateRoll(EntityPlayer player, double motionX, double motionY, double motionZ) {
|
protected double calculateRoll(EntityPlayer player, double motionX, double motionY, double motionZ) {
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.util.math;
|
||||||
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
//#MineLittlePony#
|
||||||
public class MathUtil {
|
public class MathUtil {
|
||||||
|
|
||||||
public static double clampLimit(double num, double limit) {
|
public static double clampLimit(double num, double limit) {
|
Loading…
Reference in a new issue