mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-16 18:54:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d67241f6e7 | ||
|
|
3740253590 |
No files matched your search
@@ -55,6 +55,9 @@ generateGradleTokenClass = codechicken.core.asm.Tags
|
|||||||
# Name of the token containing the project's current version to generate/replace.
|
# Name of the token containing the project's current version to generate/replace.
|
||||||
gradleTokenVersion = VERSION
|
gradleTokenVersion = VERSION
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# [DEPRECATED]
|
# [DEPRECATED]
|
||||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
|||||||
@@ -119,11 +119,9 @@ public class RedirectorTransformer implements IClassTransformer {
|
|||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (node.getOpcode() == Opcodes.INVOKESTATIC && node instanceof MethodInsnNode mNode) {
|
} else if (node instanceof MethodInsnNode mNode) {
|
||||||
if (redirectedMethods.contains(mNode.name) && mNode.owner.equals(RenderStateClass)) {
|
if (node.getOpcode() == Opcodes.INVOKESTATIC && redirectedSimpleMethods.contains(mNode.name)
|
||||||
mNode.name = mNode.name + "Static";
|
&& mNode.owner.equals(RenderStateClass)) {
|
||||||
changed = true;
|
|
||||||
} else if (redirectedSimpleMethods.contains(mNode.name) && mNode.owner.equals(RenderStateClass)) {
|
|
||||||
mn.instructions.insertBefore(
|
mn.instructions.insertBefore(
|
||||||
mNode,
|
mNode,
|
||||||
new MethodInsnNode(
|
new MethodInsnNode(
|
||||||
@@ -132,8 +130,15 @@ public class RedirectorTransformer implements IClassTransformer {
|
|||||||
"instance",
|
"instance",
|
||||||
"()Lcodechicken/lib/render/CCRenderState;"));
|
"()Lcodechicken/lib/render/CCRenderState;"));
|
||||||
mNode.setOpcode(Opcodes.INVOKEVIRTUAL);
|
mNode.setOpcode(Opcodes.INVOKEVIRTUAL);
|
||||||
|
mNode.name = mNode.name + "Instance";
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
} else if (node.getOpcode() == Opcodes.INVOKEVIRTUAL && mNode.owner.equals(RenderStateClass)
|
||||||
|
&& (redirectedSimpleMethods.contains(mNode.name)
|
||||||
|
|| redirectedMethods.contains(mNode.name))) {
|
||||||
|
// Handle mods that updated to previously new API
|
||||||
|
mNode.name = mNode.name + "Instance";
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,15 +64,15 @@ public class Canvas9Seg {
|
|||||||
|
|
||||||
public void draw(CCRenderState state, int x, int y, int w, int h) {
|
public void draw(CCRenderState state, int x, int y, int w, int h) {
|
||||||
CCRenderState.changeTexture(tex);
|
CCRenderState.changeTexture(tex);
|
||||||
state.reset();
|
state.resetInstance();
|
||||||
state.startDrawing();
|
state.startDrawingInstance();
|
||||||
|
|
||||||
int[] sw = new int[] { x, x + seg_w[0], x + w - seg_w[2], x + w };
|
int[] sw = new int[] { x, x + seg_w[0], x + w - seg_w[2], x + w };
|
||||||
int[] sh = new int[] { y, y + seg_h[0], y + h - seg_h[2], y + h };
|
int[] sh = new int[] { y, y + seg_h[0], y + h - seg_h[2], y + h };
|
||||||
|
|
||||||
for (int seg = 0; seg < 9; seg++) drawSeg(sw, sh, seg);
|
for (int seg = 0; seg < 9; seg++) drawSeg(sw, sh, seg);
|
||||||
|
|
||||||
state.draw();
|
state.drawInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(int x, int y, int w, int h) {
|
public void draw(int x, int y, int w, int h) {
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ public class LightMatrix implements CCRenderState.IVertexOperation {
|
|||||||
float[] a = ao(lc.side);
|
float[] a = ao(lc.side);
|
||||||
float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd);
|
float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd);
|
||||||
int[] b = brightness(lc.side);
|
int[] b = brightness(lc.side);
|
||||||
state.setColour(ColourRGBA.multiplyC(state.colour, f));
|
state.setColourInstance(ColourRGBA.multiplyC(state.colour, f));
|
||||||
state.setBrightness((int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF);
|
state.setBrightnessInstance((int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class LightModel implements CCRenderState.IVertexOperation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
state.setColour(apply(state.colour, state.normal));
|
state.setColourInstance(apply(state.colour, state.normal));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class PlanarLightMatrix extends PlanarLightModel {
|
|||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
super.operate(state);
|
super.operate(state);
|
||||||
state.setBrightness(brightness(state.side));
|
state.setBrightnessInstance(brightness(state.side));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class PlanarLightModel implements CCRenderState.IVertexOperation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
state.setColour(ColourRGBA.multiply(state.colour, colours[state.side]));
|
state.setColourInstance(ColourRGBA.multiply(state.colour, colours[state.side]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class SimpleBrightnessModel implements CCRenderState.IVertexOperation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
state.setBrightness(sample(state.side));
|
state.setBrightnessInstance(sample(state.side));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class BlockRenderer {
|
|||||||
|
|
||||||
// public static void renderFullBlock(int sideMask) {
|
// public static void renderFullBlock(int sideMask) {
|
||||||
public static void renderFullBlock(CCRenderState state, int sideMask) {
|
public static void renderFullBlock(CCRenderState state, int sideMask) {
|
||||||
state.setModel(fullBlock);
|
state.setModelInstance(fullBlock);
|
||||||
renderFaces(state, sideMask);
|
renderFaces(state, sideMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +171,8 @@ public class BlockRenderer {
|
|||||||
public static void renderFaces(CCRenderState state, int sideMask) {
|
public static void renderFaces(CCRenderState state, int sideMask) {
|
||||||
if (sideMask == 0x3F) return;
|
if (sideMask == 0x3F) return;
|
||||||
for (int s = 0; s < 6; s++) if ((sideMask & 1 << s) == 0) {
|
for (int s = 0; s < 6; s++) if ((sideMask & 1 << s) == 0) {
|
||||||
state.setVertexRange(s * 4, (s + 1) * 4);
|
state.setVertexRangeInstance(s * 4, (s + 1) * 4);
|
||||||
state.render();
|
state.renderInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,10 +191,10 @@ public class BlockRenderer {
|
|||||||
public static void renderCuboid(CCRenderState state, Cuboid6 bounds, int sideMask) {
|
public static void renderCuboid(CCRenderState state, Cuboid6 bounds, int sideMask) {
|
||||||
if (sideMask == 0x3F) return;
|
if (sideMask == 0x3F) return;
|
||||||
|
|
||||||
state.setModel(face);
|
state.setModelInstance(face);
|
||||||
for (int s = 0; s < 6; s++) if ((sideMask & 1 << s) == 0) {
|
for (int s = 0; s < 6; s++) if ((sideMask & 1 << s) == 0) {
|
||||||
face.loadCuboidFace(bounds, s);
|
face.loadCuboidFace(bounds, s);
|
||||||
state.render();
|
state.renderInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -467,8 +467,8 @@ public class CCModel implements CCRenderState.IVertexSource, Copyable<CCModel> {
|
|||||||
* @param ops Operations to apply
|
* @param ops Operations to apply
|
||||||
*/
|
*/
|
||||||
public void render(CCRenderState state, int start, int end, CCRenderState.IVertexOperation... ops) {
|
public void render(CCRenderState state, int start, int end, CCRenderState.IVertexOperation... ops) {
|
||||||
state.setPipeline(this, start, end, ops);
|
state.setPipelineInstance(this, start, end, ops);
|
||||||
state.render();
|
state.renderInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(int start, int end, CCRenderState.IVertexOperation... ops) {
|
public void render(int start, int end, CCRenderState.IVertexOperation... ops) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class CCRenderPipeline {
|
|||||||
|
|
||||||
public void render() {
|
public void render() {
|
||||||
rebuild();
|
rebuild();
|
||||||
renderState.render();
|
renderState.renderInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class CCRenderState {
|
|||||||
/**
|
/**
|
||||||
* Management class for a vertex attrute such as colour, normal etc This class should handle the loading of the
|
* Management class for a vertex attrute such as colour, normal etc This class should handle the loading of the
|
||||||
* attrute from an array provided by IVertexSource.getAttributes or the computation of this attrute from others
|
* attrute from an array provided by IVertexSource.getAttributes or the computation of this attrute from others
|
||||||
*
|
*
|
||||||
* @param <T> The array type for this attrute eg. int[], Vector3[]
|
* @param <T> The array type for this attrute eg. int[], Vector3[]
|
||||||
*/
|
*/
|
||||||
public abstract static class VertexAttribute<T> implements IVertexOperation {
|
public abstract static class VertexAttribute<T> implements IVertexOperation {
|
||||||
@@ -146,7 +146,7 @@ public class CCRenderState {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an array of vertex attrutes
|
* Gets an array of vertex attrutes
|
||||||
*
|
*
|
||||||
* @param attr The vertex attrute to get
|
* @param attr The vertex attrute to get
|
||||||
* @param <T> The attrute array type
|
* @param <T> The attrute array type
|
||||||
* @return An array, or null if not computed
|
* @return An array, or null if not computed
|
||||||
@@ -193,8 +193,8 @@ public class CCRenderState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
if (normalRef != null) state.setNormal(normalRef[state.vertexIndex]);
|
if (normalRef != null) state.setNormalInstance(normalRef[state.vertexIndex]);
|
||||||
else state.setNormal(Rotation.axes[state.side]);
|
else state.setNormalInstance(Rotation.axes[state.side]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static VertexAttribute<int[]> colourAttrib = new VertexAttribute<>() {
|
public static VertexAttribute<int[]> colourAttrib = new VertexAttribute<>() {
|
||||||
@@ -214,8 +214,9 @@ public class CCRenderState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
if (colourRef != null) state.setColour(ColourRGBA.multiply(state.baseColour, colourRef[state.vertexIndex]));
|
if (colourRef != null)
|
||||||
else state.setColour(state.baseColour);
|
state.setColourInstance(ColourRGBA.multiply(state.baseColour, colourRef[state.vertexIndex]));
|
||||||
|
else state.setColourInstance(state.baseColour);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static VertexAttribute<int[]> lightingAttrib = new VertexAttribute<>() {
|
public static VertexAttribute<int[]> lightingAttrib = new VertexAttribute<>() {
|
||||||
@@ -241,7 +242,7 @@ public class CCRenderState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
state.setColour(ColourRGBA.multiply(state.colour, colourRef[state.vertexIndex]));
|
state.setColourInstance(ColourRGBA.multiply(state.colour, colourRef[state.vertexIndex]));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static VertexAttribute<int[]> sideAttrib = new VertexAttribute<>() {
|
public static VertexAttribute<int[]> sideAttrib = new VertexAttribute<>() {
|
||||||
@@ -326,11 +327,15 @@ public class CCRenderState {
|
|||||||
public boolean hasBrightness;
|
public boolean hasBrightness;
|
||||||
public int brightness;
|
public int brightness;
|
||||||
|
|
||||||
// attrute storage
|
// attribute storage
|
||||||
public int side;
|
public int side;
|
||||||
public LC lc = new LC();
|
public LC lc = new LC();
|
||||||
|
|
||||||
public void reset() {
|
public static void reset() {
|
||||||
|
instance().resetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetInstance() {
|
||||||
model = null;
|
model = null;
|
||||||
pipeline.reset();
|
pipeline.reset();
|
||||||
useNormals = hasNormal = hasBrightness = hasColour = false;
|
useNormals = hasNormal = hasBrightness = hasColour = false;
|
||||||
@@ -338,27 +343,27 @@ public class CCRenderState {
|
|||||||
baseColour = alphaOverride = -1;
|
baseColour = alphaOverride = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPipeline(IVertexOperation... ops) {
|
public void setPipelineInstance(IVertexOperation... ops) {
|
||||||
pipeline.setPipeline(ops);
|
pipeline.setPipeline(ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setPipelineStatic(IVertexOperation... ops) {
|
public static void setPipeline(IVertexOperation... ops) {
|
||||||
instance().setPipeline(ops);
|
instance().setPipelineInstance(ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPipeline(IVertexSource model, int start, int end, IVertexOperation... ops) {
|
public void setPipelineInstance(IVertexSource model, int start, int end, IVertexOperation... ops) {
|
||||||
pipeline.reset();
|
pipeline.reset();
|
||||||
setModel(model, start, end);
|
setModelInstance(model, start, end);
|
||||||
pipeline.setPipeline(ops);
|
pipeline.setPipeline(ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setPipelineStatic(IVertexSource model, int start, int end, IVertexOperation... ops) {
|
public static void setPipeline(IVertexSource model, int start, int end, IVertexOperation... ops) {
|
||||||
instance().setPipeline(model, start, end, ops);
|
instance().setPipelineInstance(model, start, end, ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindModel(IVertexSource model) {
|
public void bindModelInstance(IVertexSource model) {
|
||||||
if (this.model != model) {
|
if (this.model != model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
pipeline.rebuild();
|
pipeline.rebuild();
|
||||||
@@ -366,74 +371,74 @@ public class CCRenderState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void bindModelStatic(IVertexSource model) {
|
public static void bindModel(IVertexSource model) {
|
||||||
instance().bindModel(model);
|
instance().bindModelInstance(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModel(IVertexSource source) {
|
public void setModelInstance(IVertexSource source) {
|
||||||
setModel(source, 0, source.getVertices().length);
|
setModelInstance(source, 0, source.getVertices().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setModelStatic(IVertexSource source) {
|
public static void setModel(IVertexSource source) {
|
||||||
instance().setModel(source);
|
instance().setModelInstance(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModel(IVertexSource source, int start, int end) {
|
public void setModelInstance(IVertexSource source, int start, int end) {
|
||||||
bindModel(source);
|
bindModelInstance(source);
|
||||||
setVertexRange(start, end);
|
setVertexRangeInstance(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setModelStatic(IVertexSource source, int start, int end) {
|
public static void setModel(IVertexSource source, int start, int end) {
|
||||||
instance().setModel(source, start, end);
|
instance().setModelInstance(source, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVertexRange(int start, int end) {
|
public void setVertexRangeInstance(int start, int end) {
|
||||||
firstVertexIndex = start;
|
firstVertexIndex = start;
|
||||||
lastVertexIndex = end;
|
lastVertexIndex = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setVertexRangeStatic(int start, int end) {
|
public static void setVertexRange(int start, int end) {
|
||||||
instance().setVertexRange(start, end);
|
instance().setVertexRangeInstance(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(IVertexOperation... ops) {
|
public void renderInstance(IVertexOperation... ops) {
|
||||||
setPipeline(ops);
|
setPipelineInstance(ops);
|
||||||
render();
|
renderInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void renderStatic(IVertexOperation... ops) {
|
public static void render(IVertexOperation... ops) {
|
||||||
instance().render(ops);
|
instance().renderInstance(ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render() {
|
public void renderInstance() {
|
||||||
Vertex5[] verts = model.getVertices();
|
Vertex5[] verts = model.getVertices();
|
||||||
for (vertexIndex = firstVertexIndex; vertexIndex < lastVertexIndex; vertexIndex++) {
|
for (vertexIndex = firstVertexIndex; vertexIndex < lastVertexIndex; vertexIndex++) {
|
||||||
model.prepareVertex(this);
|
model.prepareVertex(this);
|
||||||
vert.set(verts[vertexIndex]);
|
vert.set(verts[vertexIndex]);
|
||||||
runPipeline();
|
runPipelineInstance();
|
||||||
writeVert();
|
writeVertInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void renderStatic() {
|
public static void render() {
|
||||||
instance().render();
|
instance().renderInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPipeline() {
|
public void runPipelineInstance() {
|
||||||
pipeline.operate();
|
pipeline.operate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void runPipelineStatic() {
|
public static void runPipeline() {
|
||||||
instance().runPipeline();
|
instance().runPipelineInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeVert() {
|
public void writeVertInstance() {
|
||||||
if (hasNormal) Tessellator.instance.setNormal((float) normal.x, (float) normal.y, (float) normal.z);
|
if (hasNormal) Tessellator.instance.setNormal((float) normal.x, (float) normal.y, (float) normal.z);
|
||||||
if (hasColour) Tessellator.instance.setColorRGBA(
|
if (hasColour) Tessellator.instance.setColorRGBA(
|
||||||
colour >>> 24,
|
colour >>> 24,
|
||||||
@@ -445,71 +450,83 @@ public class CCRenderState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void writeVertStatic() {
|
public static void writeVert() {
|
||||||
instance().writeVert();
|
instance().writeVertInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNormal(double x, double y, double z) {
|
public void setNormalInstance(double x, double y, double z) {
|
||||||
hasNormal = true;
|
hasNormal = true;
|
||||||
normal.set(x, y, z);
|
normal.set(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setNormalStatic(double x, double y, double z) {
|
public static void setNormal(double x, double y, double z) {
|
||||||
instance().setNormal(x, y, z);
|
instance().setNormalInstance(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNormal(Vector3 n) {
|
public void setNormalInstance(Vector3 n) {
|
||||||
hasNormal = true;
|
hasNormal = true;
|
||||||
normal.set(n);
|
normal.set(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setNormalStatic(Vector3 n) {
|
public static void setNormal(Vector3 n) {
|
||||||
instance().setNormal(n);
|
instance().setNormalInstance(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColour(int c) {
|
public void setColourInstance(int c) {
|
||||||
hasColour = true;
|
hasColour = true;
|
||||||
colour = c;
|
colour = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setColourStatic(int c) {
|
public static void setColour(int c) {
|
||||||
instance().setColour(c);
|
instance().setColourInstance(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBrightness(int b) {
|
public void setBrightnessInstance(int b) {
|
||||||
hasBrightness = true;
|
hasBrightness = true;
|
||||||
brightness = b;
|
brightness = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setBrightnessStatic(int b) {
|
public static void setBrightness(int b) {
|
||||||
instance().setBrightness(b);
|
instance().setBrightnessInstance(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBrightness(IBlockAccess world, int x, int y, int z) {
|
public void setBrightnessInstance(IBlockAccess world, int x, int y, int z) {
|
||||||
setBrightness(world.getBlock(x, y, z).getMixedBrightnessForBlock(world, x, y, z));
|
setBrightnessInstance(world.getBlock(x, y, z).getMixedBrightnessForBlock(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setBrightnessStatic(IBlockAccess world, int x, int y, int z) {
|
public static void setBrightness(IBlockAccess world, int x, int y, int z) {
|
||||||
instance().setBrightness(world, x, y, z);
|
instance().setBrightnessInstance(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pullLightmap() {
|
public static void pullLightmap() {
|
||||||
setBrightness((int) OpenGlHelper.lastBrightnessY << 16 | (int) OpenGlHelper.lastBrightnessX);
|
instance().pullLightmapInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pushLightmap() {
|
public void pullLightmapInstance() {
|
||||||
|
setBrightnessInstance((int) OpenGlHelper.lastBrightnessY << 16 | (int) OpenGlHelper.lastBrightnessX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void pushLightmap() {
|
||||||
|
instance().pushLightmapInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pushLightmapInstance() {
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness & 0xFFFF, brightness >>> 16);
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness & 0xFFFF, brightness >>> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compact helper for setting dynamic rendering context. Uses normals and doesn't compute lighting
|
* Compact helper for setting dynamic rendering context. Uses normals and doesn't compute lighting
|
||||||
*/
|
*/
|
||||||
public void setDynamic() {
|
public static void setDynamic() {
|
||||||
|
instance().setDynamicInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDynamicInstance() {
|
||||||
useNormals = true;
|
useNormals = true;
|
||||||
computeLighting = false;
|
computeLighting = false;
|
||||||
}
|
}
|
||||||
@@ -522,16 +539,16 @@ public class CCRenderState {
|
|||||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDrawing() {
|
public void startDrawingInstance() {
|
||||||
startDrawing(7);
|
startDrawingInstance(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void startDrawingStatic() {
|
public static void startDrawing() {
|
||||||
instance().startDrawing();
|
instance().startDrawingInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDrawing(int mode) {
|
public void startDrawingInstance(int mode) {
|
||||||
Tessellator.instance.startDrawing(mode);
|
Tessellator.instance.startDrawing(mode);
|
||||||
if (hasColour) Tessellator.instance.setColorRGBA(
|
if (hasColour) Tessellator.instance.setColorRGBA(
|
||||||
colour >>> 24,
|
colour >>> 24,
|
||||||
@@ -542,11 +559,15 @@ public class CCRenderState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void startDrawingStatic(int mode) {
|
public static void startDrawing(int mode) {
|
||||||
instance().startDrawing(mode);
|
instance().startDrawingInstance(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw() {
|
public static void draw() {
|
||||||
|
Tessellator.instance.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawInstance() {
|
||||||
Tessellator.instance.draw();
|
Tessellator.instance.draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ public class ColourMultiplier implements CCRenderState.IVertexOperation {
|
|||||||
@Override
|
@Override
|
||||||
public boolean load(CCRenderState state) {
|
public boolean load(CCRenderState state) {
|
||||||
if (colour == -1) {
|
if (colour == -1) {
|
||||||
state.setColour(-1);
|
state.setColourInstance(-1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public class ColourMultiplier implements CCRenderState.IVertexOperation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operate(CCRenderState state) {
|
public void operate(CCRenderState state) {
|
||||||
state.setColour(ColourRGBA.multiply(state.colour, colour));
|
state.setColourInstance(ColourRGBA.multiply(state.colour, colour));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ public class RenderUtils {
|
|||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
Fluid fluid = stack.getFluid();
|
Fluid fluid = stack.getFluid();
|
||||||
state.setColour(fluid.getColor(stack) << 8 | alpha);
|
state.setColourInstance(fluid.getColor(stack) << 8 | alpha);
|
||||||
TextureUtils.bindAtlas(fluid.getSpriteNumber());
|
TextureUtils.bindAtlas(fluid.getSpriteNumber());
|
||||||
return TextureUtils.safeIcon(fluid.getIcon(stack));
|
return TextureUtils.safeIcon(fluid.getIcon(stack));
|
||||||
}
|
}
|
||||||
@@ -300,9 +300,9 @@ public class RenderUtils {
|
|||||||
else bound.max.y = bound.min.y + (bound.max.y - bound.min.y) * density;
|
else bound.max.y = bound.min.y + (bound.max.y - bound.min.y) * density;
|
||||||
|
|
||||||
IIcon tex = prepareFluidRender(state, stack, alpha);
|
IIcon tex = prepareFluidRender(state, stack, alpha);
|
||||||
state.startDrawing();
|
state.startDrawingInstance();
|
||||||
renderFluidCuboid(state, bound, tex, res);
|
renderFluidCuboid(state, bound, tex, res);
|
||||||
state.draw();
|
state.drawInstance();
|
||||||
postFluidRender();
|
postFluidRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,14 +323,14 @@ public class RenderUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IIcon tex = prepareFluidRender(state, stack, alpha);
|
IIcon tex = prepareFluidRender(state, stack, alpha);
|
||||||
state.startDrawing();
|
state.startDrawingInstance();
|
||||||
renderFluidQuad(
|
renderFluidQuad(
|
||||||
new Vector3(rect.x, rect.y + rect.h, 0),
|
new Vector3(rect.x, rect.y + rect.h, 0),
|
||||||
new Vector3(rect.w, 0, 0),
|
new Vector3(rect.w, 0, 0),
|
||||||
new Vector3(0, -rect.h, 0),
|
new Vector3(0, -rect.h, 0),
|
||||||
tex,
|
tex,
|
||||||
res);
|
res);
|
||||||
state.draw();
|
state.drawInstance();
|
||||||
postFluidRender();
|
postFluidRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user