Fixed crash due to undefined classes when MineLP is not present

This commit is contained in:
Sollace 2019-01-26 10:21:17 +02:00
parent d6fd6dd166
commit 2534053305
3 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,36 @@
package com.minelittlepony.util.render;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
public abstract class Box<T extends ModelRenderer> extends ModelBox {
protected final T parent;
public Box(T renderer, int texU, int texV, float x, float y, float z, int dx, int dy, int dz, float delta) {
super(renderer, texU, texV, x, y, z, dx, dy, dz, delta);
parent = renderer;
}
public Box(T renderer, int texU, int texV, float x, float y, float z, int dx, int dy, int dz, float delta, boolean mirror) {
super(renderer, texU, texV, x, y, z, dx, dy, dz, delta, mirror);
parent = renderer;
}
/**
* Creates a new vertex mapping the given (x, y, z) coordinates to a texture offset.
*/
protected Vertex vert(float x, float y, float z, int texX, int texY) {
return new Vertex(x, y, z, texX, texY);
}
/**
* Creates a new quad with the given spacial vertices.
*/
protected Quad quad(int startX, int width, int startY, int height, Vertex ...verts) {
return new Quad(verts,
startX, startY,
startX + width, startY + height,
parent.textureWidth, parent.textureHeight);
}
}

View file

@ -0,0 +1,9 @@
package com.minelittlepony.util.render;
import net.minecraft.client.model.TexturedQuad;
public class Quad extends TexturedQuad {
Quad(Vertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) {
super(vertices, texcoordU1, texcoordV1, texcoordU2, texcoordV2, textureWidth, textureHeight);
}
}

View file

@ -0,0 +1,19 @@
package com.minelittlepony.util.render;
import net.minecraft.client.model.PositionTextureVertex;
public class Vertex extends PositionTextureVertex {
public Vertex(float x, float y, float z, float texX, float texY) {
super(x, y, z, texX, texY);
}
private Vertex(Vertex old, float texX, float texY) {
super(old, texX, texY);
}
@Override
public Vertex setTexturePosition(float texX, float texY) {
return new Vertex(this, texX, texY);
}
}