Navigation Menu

Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Commit

Permalink
fix custom colors for 12w22a
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Rupe committed May 31, 2012
1 parent d65772e commit 21b754d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/com/pclewis/mcpatcher/mod/CustomColors.java
Expand Up @@ -20,6 +20,7 @@ public class CustomColors extends Mod {
private boolean haveFontColor;
private boolean renderStringReturnsInt;
private boolean haveNewWorld;
private boolean renderBlockFallingSandTakes4Ints;
private String getColorFromDamageDescriptor;
private int getColorFromDamageParams;

Expand All @@ -39,6 +40,7 @@ public CustomColors(MinecraftVersion minecraftVersion) {
haveFontColor = minecraftVersion.compareTo("11w49a") >= 0;
haveNewWorld = minecraftVersion.compareTo("12w18a") >= 0;
renderStringReturnsInt = minecraftVersion.compareTo("1.2.4") >= 0;
renderBlockFallingSandTakes4Ints = minecraftVersion.compareTo("12w22a") >= 0;

configPanel = new ConfigPanel();

Expand Down Expand Up @@ -2748,7 +2750,8 @@ private class RenderBlocksMod extends RedstoneWireClassMod {
classSignatures.add(new ConstSignature(0.1875));
classSignatures.add(new ConstSignature(0.01));

final MethodRef renderBlockFallingSand = new MethodRef(getDeobfClass(), "renderBlockFallingSand", "(LBlock;LWorld;III)V");
final MethodRef renderBlockFallingSand = new MethodRef(getDeobfClass(), "renderBlockFallingSand", "(LBlock;LWorld;III" + (renderBlockFallingSandTakes4Ints ? "I" : "") + ")V");
final int renderBlockFallingSandOffset = renderBlockFallingSandTakes4Ints ? 1 : 0;
final MethodRef setColorOpaque_F = new MethodRef("Tessellator", "setColorOpaque_F", "(FFF)V");
final MethodRef renderBlockFluids = new MethodRef(getDeobfClass(), "renderBlockFluids", "(LBlock;III)Z");

Expand Down Expand Up @@ -2797,13 +2800,13 @@ public String getMatchExpression() {
return buildExpression(
BinaryRegex.begin(),
push(0.5f),
FSTORE, 6,
FSTORE, 6 + renderBlockFallingSandOffset,
FCONST_1,
FSTORE, 7,
FSTORE, 7 + renderBlockFallingSandOffset,
push(0.8f),
FSTORE, 8,
FSTORE, 8 + renderBlockFallingSandOffset,
push(0.6f),
FSTORE, 9
FSTORE, 9 + renderBlockFallingSandOffset
);
}
}.setMethod(renderBlockFallingSand));
Expand Down Expand Up @@ -2858,15 +2861,15 @@ public String getDescription() {
public String getMatchExpression() {
return buildExpression(
// tessellator.setColorOpaque_F($1 * f5, $1 * f5, $1 * f5);
ALOAD, 10,
ALOAD, 10 + renderBlockFallingSandOffset,
BinaryRegex.capture(BytecodeMatcher.anyFLOAD),
FLOAD, 12,
FLOAD, 12 + renderBlockFallingSandOffset,
FMUL,
BinaryRegex.backReference(1),
FLOAD, 12,
FLOAD, 12 + renderBlockFallingSandOffset,
FMUL,
BinaryRegex.backReference(1),
FLOAD, 12,
FLOAD, 12 + renderBlockFallingSandOffset,
FMUL,
reference(INVOKEVIRTUAL, setColorOpaque_F)
);
Expand Down Expand Up @@ -2894,21 +2897,21 @@ public byte[] getReplacementBytes() throws IOException {
extraCode,

// tessellator.setColorOpaque_F(Colorizer.setColor[0] * f5, Colorizer.setColor[1] * f5, Colorizer.setColor[2] * f5);
ALOAD, 10,
ALOAD, 10 + renderBlockFallingSandOffset,
reference(GETSTATIC, new FieldRef(MCPatcherUtils.COLORIZER_CLASS, "setColor", "[F")),
ICONST_0,
FALOAD,
FLOAD, 12,
FLOAD, 12 + renderBlockFallingSandOffset,
FMUL,
reference(GETSTATIC, new FieldRef(MCPatcherUtils.COLORIZER_CLASS, "setColor", "[F")),
ICONST_1,
FALOAD,
FLOAD, 12,
FLOAD, 12 + renderBlockFallingSandOffset,
FMUL,
reference(GETSTATIC, new FieldRef(MCPatcherUtils.COLORIZER_CLASS, "setColor", "[F")),
ICONST_2,
FALOAD,
FLOAD, 12,
FLOAD, 12 + renderBlockFallingSandOffset,
FMUL,
reference(INVOKEVIRTUAL, setColorOpaque_F)
);
Expand Down

0 comments on commit 21b754d

Please sign in to comment.