| 1 | package net.minecraft.client.util;
|
| 2 |
|
| 3 | import com.google.gson.JsonObject;
|
| 4 | import net.minecraft.client.renderer.GlStateManager;
|
| 5 | import net.minecraft.util.JsonUtils;
|
| 6 | import org.lwjgl.opengl.GL14;
|
| 7 |
|
| 8 | public class JsonBlendingMode
|
| 9 | {
|
| 10 | private static JsonBlendingMode field_148118_a = null;
|
| 11 | private final int field_148116_b;
|
| 12 | private final int field_148117_c;
|
| 13 | private final int field_148114_d;
|
| 14 | private final int field_148115_e;
|
| 15 | private final int field_148112_f;
|
| 16 | private final boolean field_148113_g;
|
| 17 | private final boolean field_148119_h;
|
| 18 |
|
| 19 | private JsonBlendingMode(boolean p_i45084_1_, boolean p_i45084_2_, int p_i45084_3_, int p_i45084_4_, int p_i45084_5_, int p_i45084_6_, int p_i45084_7_)
|
| 20 | {
|
| 21 | this.field_148113_g = p_i45084_1_;
|
| 22 | this.field_148116_b = p_i45084_3_;
|
| 23 | this.field_148114_d = p_i45084_4_;
|
| 24 | this.field_148117_c = p_i45084_5_;
|
| 25 | this.field_148115_e = p_i45084_6_;
|
| 26 | this.field_148119_h = p_i45084_2_;
|
| 27 | this.field_148112_f = p_i45084_7_;
|
| 28 | }
|
| 29 |
|
| 30 | public JsonBlendingMode()
|
| 31 | {
|
| 32 | this(false, true, 1, 0, 1, 0, 32774);
|
| 33 | }
|
| 34 |
|
| 35 | public JsonBlendingMode(int p_i45085_1_, int p_i45085_2_, int p_i45085_3_)
|
| 36 | {
|
| 37 | this(false, false, p_i45085_1_, p_i45085_2_, p_i45085_1_, p_i45085_2_, p_i45085_3_);
|
| 38 | }
|
| 39 |
|
| 40 | public JsonBlendingMode(int p_i45086_1_, int p_i45086_2_, int p_i45086_3_, int p_i45086_4_, int p_i45086_5_)
|
| 41 | {
|
| 42 | this(true, false, p_i45086_1_, p_i45086_2_, p_i45086_3_, p_i45086_4_, p_i45086_5_);
|
| 43 | }
|
| 44 |
|
| 45 | public void func_148109_a()
|
| 46 | {
|
| 47 | if (!this.equals(field_148118_a))
|
| 48 | {
|
| 49 | if (field_148118_a == null || this.field_148119_h != field_148118_a.func_148111_b())
|
| 50 | {
|
| 51 | field_148118_a = this;
|
| 52 |
|
| 53 | if (this.field_148119_h)
|
| 54 | {
|
| 55 | GlStateManager.disableBlend();
|
| 56 | return;
|
| 57 | }
|
| 58 |
|
| 59 | GlStateManager.enableBlend();
|
| 60 | }
|
| 61 |
|
| 62 | GL14.glBlendEquation(this.field_148112_f);
|
| 63 |
|
| 64 | if (this.field_148113_g)
|
| 65 | {
|
| 66 | GlStateManager.tryBlendFuncSeparate(this.field_148116_b, this.field_148114_d, this.field_148117_c, this.field_148115_e);
|
| 67 | }
|
| 68 | else
|
| 69 | {
|
| 70 | GlStateManager.blendFunc(this.field_148116_b, this.field_148114_d);
|
| 71 | }
|
| 72 | }
|
| 73 | }
|
| 74 |
|
| 75 | public boolean equals(Object p_equals_1_)
|
| 76 | {
|
| 77 | if (this == p_equals_1_)
|
| 78 | {
|
| 79 | return true;
|
| 80 | }
|
| 81 | else if (!(p_equals_1_ instanceof JsonBlendingMode))
|
| 82 | {
|
| 83 | return false;
|
| 84 | }
|
| 85 | else
|
| 86 | {
|
| 87 | JsonBlendingMode jsonblendingmode = (JsonBlendingMode)p_equals_1_;
|
| 88 | return this.field_148112_f != jsonblendingmode.field_148112_f ? false : (this.field_148115_e != jsonblendingmode.field_148115_e ? false : (this.field_148114_d != jsonblendingmode.field_148114_d ? false : (this.field_148119_h != jsonblendingmode.field_148119_h ? false : (this.field_148113_g != jsonblendingmode.field_148113_g ? false : (this.field_148117_c != jsonblendingmode.field_148117_c ? false : this.field_148116_b == jsonblendingmode.field_148116_b)))));
|
| 89 | }
|
| 90 | }
|
| 91 |
|
| 92 | public int hashCode()
|
| 93 | {
|
| 94 | int i = this.field_148116_b;
|
| 95 | i = 31 * i + this.field_148117_c;
|
| 96 | i = 31 * i + this.field_148114_d;
|
| 97 | i = 31 * i + this.field_148115_e;
|
| 98 | i = 31 * i + this.field_148112_f;
|
| 99 | i = 31 * i + (this.field_148113_g ? 1 : 0);
|
| 100 | i = 31 * i + (this.field_148119_h ? 1 : 0);
|
| 101 | return i;
|
| 102 | }
|
| 103 |
|
| 104 | public boolean func_148111_b()
|
| 105 | {
|
| 106 | return this.field_148119_h;
|
| 107 | }
|
| 108 |
|
| 109 | public static JsonBlendingMode func_148110_a(JsonObject p_148110_0_)
|
| 110 | {
|
| 111 | if (p_148110_0_ == null)
|
| 112 | {
|
| 113 | return new JsonBlendingMode();
|
| 114 | }
|
| 115 | else
|
| 116 | {
|
| 117 | int i = 32774;
|
| 118 | int j = 1;
|
| 119 | int k = 0;
|
| 120 | int l = 1;
|
| 121 | int i1 = 0;
|
| 122 | boolean flag = true;
|
| 123 | boolean flag1 = false;
|
| 124 |
|
| 125 | if (JsonUtils.isString(p_148110_0_, "func"))
|
| 126 | {
|
| 127 | i = func_148108_a(p_148110_0_.get("func").getAsString());
|
| 128 |
|
| 129 | if (i != 32774)
|
| 130 | {
|
| 131 | flag = false;
|
| 132 | }
|
| 133 | }
|
| 134 |
|
| 135 | if (JsonUtils.isString(p_148110_0_, "srcrgb"))
|
| 136 | {
|
| 137 | j = func_148107_b(p_148110_0_.get("srcrgb").getAsString());
|
| 138 |
|
| 139 | if (j != 1)
|
| 140 | {
|
| 141 | flag = false;
|
| 142 | }
|
| 143 | }
|
| 144 |
|
| 145 | if (JsonUtils.isString(p_148110_0_, "dstrgb"))
|
| 146 | {
|
| 147 | k = func_148107_b(p_148110_0_.get("dstrgb").getAsString());
|
| 148 |
|
| 149 | if (k != 0)
|
| 150 | {
|
| 151 | flag = false;
|
| 152 | }
|
| 153 | }
|
| 154 |
|
| 155 | if (JsonUtils.isString(p_148110_0_, "srcalpha"))
|
| 156 | {
|
| 157 | l = func_148107_b(p_148110_0_.get("srcalpha").getAsString());
|
| 158 |
|
| 159 | if (l != 1)
|
| 160 | {
|
| 161 | flag = false;
|
| 162 | }
|
| 163 |
|
| 164 | flag1 = true;
|
| 165 | }
|
| 166 |
|
| 167 | if (JsonUtils.isString(p_148110_0_, "dstalpha"))
|
| 168 | {
|
| 169 | i1 = func_148107_b(p_148110_0_.get("dstalpha").getAsString());
|
| 170 |
|
| 171 | if (i1 != 0)
|
| 172 | {
|
| 173 | flag = false;
|
| 174 | }
|
| 175 |
|
| 176 | flag1 = true;
|
| 177 | }
|
| 178 |
|
| 179 | return flag ? new JsonBlendingMode() : (flag1 ? new JsonBlendingMode(j, k, l, i1, i) : new JsonBlendingMode(j, k, i));
|
| 180 | }
|
| 181 | }
|
| 182 |
|
| 183 | private static int func_148108_a(String p_148108_0_)
|
| 184 | {
|
| 185 | String s = p_148108_0_.trim().toLowerCase();
|
| 186 | return s.equals("add") ? 32774 : (s.equals("subtract") ? 32778 : (s.equals("reversesubtract") ? 32779 : (s.equals("reverse_subtract") ? 32779 : (s.equals("min") ? 32775 : (s.equals("max") ? 32776 : 32774)))));
|
| 187 | }
|
| 188 |
|
| 189 | private static int func_148107_b(String p_148107_0_)
|
| 190 | {
|
| 191 | String s = p_148107_0_.trim().toLowerCase();
|
| 192 | s = s.replaceAll("_", "");
|
| 193 | s = s.replaceAll("one", "1");
|
| 194 | s = s.replaceAll("zero", "0");
|
| 195 | s = s.replaceAll("minus", "-");
|
| 196 | return s.equals("0") ? 0 : (s.equals("1") ? 1 : (s.equals("srccolor") ? 768 : (s.equals("1-srccolor") ? 769 : (s.equals("dstcolor") ? 774 : (s.equals("1-dstcolor") ? 775 : (s.equals("srcalpha") ? 770 : (s.equals("1-srcalpha") ? 771 : (s.equals("dstalpha") ? 772 : (s.equals("1-dstalpha") ? 773 : -1)))))))));
|
| 197 | }
|
| 198 | }
|
| 199 |
|