mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-17 10:24:23 +01:00
Fixed crash due to undefined classes when MineLP is not present
This commit is contained in:
parent
d6fd6dd166
commit
2534053305
3 changed files with 64 additions and 0 deletions
36
src/main/java/com/minelittlepony/util/render/Box.java
Normal file
36
src/main/java/com/minelittlepony/util/render/Box.java
Normal 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);
|
||||
}
|
||||
}
|
9
src/main/java/com/minelittlepony/util/render/Quad.java
Normal file
9
src/main/java/com/minelittlepony/util/render/Quad.java
Normal 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);
|
||||
}
|
||||
}
|
19
src/main/java/com/minelittlepony/util/render/Vertex.java
Normal file
19
src/main/java/com/minelittlepony/util/render/Vertex.java
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue