001 002 import java.util.Random; 003 004 public class be extends dz { 005 006 int a = 0; 007 boolean[] b = new boolean[4]; 008 int[] c = new int[4]; 009 010 protected be(int paramInt, mh parammh) { 011 super(paramInt, parammh); 012 } 013 014 private void i(fv paramfv, int paramInt1, int paramInt2, int paramInt3) { 015 int i = paramfv.b(paramInt1, paramInt2, paramInt3); 016 paramfv.a(paramInt1, paramInt2, paramInt3, bi + 1, i); 017 paramfv.b(paramInt1, paramInt2, paramInt3, paramInt1, paramInt2, paramInt3); 018 paramfv.g(paramInt1, paramInt2, paramInt3); 019 } 020 021 public void a(fv paramfv, int paramInt1, int paramInt2, int paramInt3, Random paramRandom) { 022 // hMod: Store originating block 023 Block blockFrom = new Block(this.bh, paramInt1, paramInt2, paramInt3); 024 025 int i = g(paramfv, paramInt1, paramInt2, paramInt3); 026 027 int j = 1; 028 if ((bt == mh.g) && (!paramfv.q.d)) { 029 j = 2; 030 } 031 032 int k = 1; 033 int n; 034 if (i > 0) { 035 int m = -100; 036 a = 0; 037 m = e(paramfv, paramInt1 - 1, paramInt2, paramInt3, m); 038 m = e(paramfv, paramInt1 + 1, paramInt2, paramInt3, m); 039 m = e(paramfv, paramInt1, paramInt2, paramInt3 - 1, m); 040 m = e(paramfv, paramInt1, paramInt2, paramInt3 + 1, m); 041 042 n = m + j; 043 if ((n >= 8) || (m < 0)) { 044 n = -1; 045 } 046 if (g(paramfv, paramInt1, paramInt2 + 1, paramInt3) >= 0) { 047 int i1 = g(paramfv, paramInt1, paramInt2 + 1, paramInt3); 048 if (i1 >= 8) { 049 n = i1; 050 } else { 051 n = i1 + 8; 052 } 053 } 054 if ((a >= 2) && (bt == mh.f)) { 055 if (paramfv.d(paramInt1, paramInt2 - 1, paramInt3)) { 056 n = 0; 057 } else if ((paramfv.c(paramInt1, paramInt2 - 1, paramInt3) == bt) && (paramfv.b(paramInt1, paramInt2, paramInt3) == 0)) { 058 n = 0; 059 } 060 } 061 if ((bt == mh.g) 062 && (i < 8) && (n < 8) 063 && (n > i) 064 && (paramRandom.nextInt(4) != 0)) { 065 n = i; 066 k = 0; 067 } 068 069 if (n != i) { 070 i = n; 071 if (i < 0) { 072 paramfv.e(paramInt1, paramInt2, paramInt3, 0); 073 } else { 074 paramfv.c(paramInt1, paramInt2, paramInt3, i); 075 paramfv.i(paramInt1, paramInt2, paramInt3, bi); 076 paramfv.h(paramInt1, paramInt2, paramInt3, bi); 077 } 078 } else if (k != 0) { 079 i(paramfv, paramInt1, paramInt2, paramInt3); 080 } 081 } else { 082 i(paramfv, paramInt1, paramInt2, paramInt3); 083 } 084 if (l(paramfv, paramInt1, paramInt2 - 1, paramInt3)) { 085 // hMod: downwards flow. 086 Block blockTo = new Block(0, paramInt1, paramInt2 - 1, paramInt3); 087 if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.FLOW, blockFrom, blockTo)) { 088 if (i >= 8) { 089 paramfv.b(paramInt1, paramInt2 - 1, paramInt3, bi, i); 090 } else { 091 paramfv.b(paramInt1, paramInt2 - 1, paramInt3, bi, i + 8); 092 } 093 } 094 } else if ((i >= 0) && ((i == 0) || (k(paramfv, paramInt1, paramInt2 - 1, paramInt3)))) { 095 boolean[] arrayOfBoolean = j(paramfv, paramInt1, paramInt2, paramInt3); 096 n = i + j; 097 if (i >= 8) { 098 n = 1; 099 } 100 if (n >= 8) { 101 return; 102 } 103 // hMod: sidewards flow. 104 if (arrayOfBoolean[0]) { 105 Block blockTo = new Block(0, paramInt1 - 1, paramInt2, paramInt3); 106 if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.FLOW, blockFrom, blockTo)) { 107 f(paramfv, paramInt1 - 1, paramInt2, paramInt3, n); 108 } 109 } 110 if (arrayOfBoolean[1]) { 111 Block blockTo = new Block(0, paramInt1 + 1, paramInt2, paramInt3); 112 if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.FLOW, blockFrom, blockTo)) { 113 f(paramfv, paramInt1 + 1, paramInt2, paramInt3, n); 114 } 115 } 116 if (arrayOfBoolean[2]) { 117 Block blockTo = new Block(0, paramInt1, paramInt2, paramInt3 - 1); 118 if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.FLOW, blockFrom, blockTo)) { 119 f(paramfv, paramInt1, paramInt2, paramInt3 - 1, n); 120 } 121 } 122 if (arrayOfBoolean[3]) { 123 Block blockTo = new Block(0, paramInt1, paramInt2, paramInt3 + 1); 124 if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.FLOW, blockFrom, blockTo)) { 125 f(paramfv, paramInt1, paramInt2, paramInt3 + 1, n); 126 } 127 } 128 } 129 } 130 131 private void f(fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { 132 if (l(paramfv, paramInt1, paramInt2, paramInt3)) { 133 int i = paramfv.a(paramInt1, paramInt2, paramInt3); 134 if (i > 0) { 135 if (bt == mh.g) { 136 h(paramfv, paramInt1, paramInt2, paramInt3); 137 } else { 138 hr.m[i].a_(paramfv, paramInt1, paramInt2, paramInt3, paramfv.b(paramInt1, paramInt2, paramInt3)); 139 } 140 } 141 paramfv.b(paramInt1, paramInt2, paramInt3, bi, paramInt4); 142 } 143 } 144 145 private int b(fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5) { 146 int i = 1000; 147 for (int j = 0; j < 4; j++) { 148 if (((j == 0) && (paramInt5 == 1)) 149 || ((j == 1) && (paramInt5 == 0)) 150 || ((j == 2) && (paramInt5 == 3)) || ((j == 3) && (paramInt5 == 2))) { 151 continue; 152 } 153 int k = paramInt1; 154 int m = paramInt2; 155 int n = paramInt3; 156 157 if (j == 0) { 158 k--; 159 } 160 if (j == 1) { 161 k++; 162 } 163 if (j == 2) { 164 n--; 165 } 166 if (j == 3) { 167 n++; 168 } 169 170 if (k(paramfv, k, m, n)) { 171 continue; 172 } 173 if ((paramfv.c(k, m, n) == bt) && (paramfv.b(k, m, n) == 0)) { 174 continue; 175 } 176 if (!k(paramfv, k, m - 1, n)) { 177 return paramInt4; 178 } 179 if (paramInt4 < 4) { 180 int i1 = b(paramfv, k, m, n, paramInt4 + 1, j); 181 if (i1 >= i) { 182 continue; 183 } 184 i = i1; 185 } 186 187 } 188 189 return i; 190 } 191 192 private boolean[] j(fv paramfv, int paramInt1, int paramInt2, int paramInt3) { 193 for (int i = 0; i < 4; i++) { 194 c[i] = 1000; 195 int j = paramInt1; 196 int k = paramInt2; 197 int m = paramInt3; 198 199 if (i == 0) { 200 j--; 201 } 202 if (i == 1) { 203 j++; 204 } 205 if (i == 2) { 206 m--; 207 } 208 if (i == 3) { 209 m++; 210 } 211 if (k(paramfv, j, k, m)) { 212 continue; 213 } 214 if ((paramfv.c(j, k, m) == bt) && (paramfv.b(j, k, m) == 0)) { 215 continue; 216 } 217 if (!k(paramfv, j, k - 1, m)) { 218 c[i] = 0; 219 } else { 220 c[i] = b(paramfv, j, k, m, 1, i); 221 } 222 223 } 224 225 int i = c[0]; 226 for (int j = 1; j < 4; j++) { 227 if (c[j] >= i) { 228 continue; 229 } 230 i = c[j]; 231 } 232 233 for (int j = 0; j < 4; j++) { 234 b[j] = (c[j] == i ? true : false); 235 } 236 return b; 237 } 238 239 private boolean k(fv paramfv, int paramInt1, int paramInt2, int paramInt3) { 240 int i = paramfv.a(paramInt1, paramInt2, paramInt3); 241 if ((i == hr.aE.bi) || (i == hr.aL.bi) || (i == hr.aD.bi) || (i == hr.aF.bi) || (i == hr.aX.bi)) { 242 return true; 243 } 244 if (i == 0) { 245 return false; 246 } 247 mh localmh = hr.m[i].bt; 248 return localmh.a(); 249 } 250 251 protected int e(fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { 252 int i = g(paramfv, paramInt1, paramInt2, paramInt3); 253 if (i < 0) { 254 return paramInt4; 255 } 256 if (i == 0) { 257 a += 1; 258 } 259 if (i >= 8) { 260 i = 0; 261 } 262 return (paramInt4 < 0) || (i < paramInt4) ? i : paramInt4; 263 } 264 265 private boolean l(fv paramfv, int paramInt1, int paramInt2, int paramInt3) { 266 // hMod: See if this liquid can destroy this block. 267 Block block = new Block(paramfv.a(paramInt1, paramInt2, paramInt3), paramInt1, paramInt2, paramInt3); 268 PluginLoader.HookResult ret = (PluginLoader.HookResult) etc.getLoader().callHook(PluginLoader.Hook.LIQUID_DESTROY, this.bh, block); 269 if (ret == PluginLoader.HookResult.PREVENT_ACTION) { 270 return false; 271 } else if (ret == PluginLoader.HookResult.ALLOW_ACTION) { 272 return true; 273 } 274 275 mh localmh = paramfv.c(paramInt1, paramInt2, paramInt3); 276 if (localmh == bt) { 277 return false; 278 } 279 if (localmh == mh.g) { 280 return false; 281 } 282 return !k(paramfv, paramInt1, paramInt2, paramInt3); 283 } 284 285 public void e(fv paramfv, int paramInt1, int paramInt2, int paramInt3) { 286 super.e(paramfv, paramInt1, paramInt2, paramInt3); 287 if (paramfv.a(paramInt1, paramInt2, paramInt3) == bi) { 288 paramfv.i(paramInt1, paramInt2, paramInt3, bi); 289 } 290 } 291 }