001    
002    import java.util.Random;
003    
004    public class mc extends hr {
005    
006        private int[] a = new int[256];
007        private int[] b = new int[256];
008    
009        protected mc(int paramInt1, int paramInt2) {
010            super(paramInt1, paramInt2, mh.l);
011    
012            a(hr.x.bi, 5, 20);
013            a(hr.J.bi, 5, 5);
014            a(hr.K.bi, 30, 60);
015            a(hr.an.bi, 30, 20);
016            a(hr.am.bi, 15, 100);
017            a(hr.ab.bi, 30, 60);
018    
019            a(true);
020        }
021    
022        private void a(int paramInt1, int paramInt2, int paramInt3) {
023            a[paramInt1] = paramInt2;
024            b[paramInt1] = paramInt3;
025        }
026    
027        public fa d(fv paramfv, int paramInt1, int paramInt2, int paramInt3) {
028            return null;
029        }
030    
031        public boolean a() {
032            return false;
033        }
034    
035        public int a(Random paramRandom) {
036            return 0;
037        }
038    
039        public int b() {
040            return 10;
041        }
042    
043        public void a(fv paramfv, int paramInt1, int paramInt2, int paramInt3, Random paramRandom) {
044            int i = paramfv.a(paramInt1, paramInt2 - 1, paramInt3) == hr.bb.bi ? 1 : 0;
045    
046            int j = paramfv.b(paramInt1, paramInt2, paramInt3);
047            if (j < 15) {
048                paramfv.c(paramInt1, paramInt2, paramInt3, j + 1);
049                paramfv.i(paramInt1, paramInt2, paramInt3, bi);
050            }
051            if ((i == 0) && (!g(paramfv, paramInt1, paramInt2, paramInt3))) {
052                if ((!paramfv.d(paramInt1, paramInt2 - 1, paramInt3)) || (j > 3)) {
053                    paramfv.e(paramInt1, paramInt2, paramInt3, 0);
054                }
055                return;
056            }
057            // hMod: cast to fix decompiler error.
058            if ((i == 0) && (!b((la) paramfv, paramInt1, paramInt2 - 1, paramInt3))
059                    && (j == 15) && (paramRandom.nextInt(4) == 0)) {
060                paramfv.e(paramInt1, paramInt2, paramInt3, 0);
061                return;
062            }
063    
064            if ((j % 2 == 0) && (j > 2)) {
065                a(paramfv, paramInt1 + 1, paramInt2, paramInt3, 300, paramRandom);
066                a(paramfv, paramInt1 - 1, paramInt2, paramInt3, 300, paramRandom);
067                a(paramfv, paramInt1, paramInt2 - 1, paramInt3, 250, paramRandom);
068                a(paramfv, paramInt1, paramInt2 + 1, paramInt3, 250, paramRandom);
069                a(paramfv, paramInt1, paramInt2, paramInt3 - 1, 300, paramRandom);
070                a(paramfv, paramInt1, paramInt2, paramInt3 + 1, 300, paramRandom);
071    
072                for (int k = paramInt1 - 1; k <= paramInt1 + 1; k++) {
073                    for (int m = paramInt3 - 1; m <= paramInt3 + 1; m++) {
074                        for (int n = paramInt2 - 1; n <= paramInt2 + 4; n++) {
075                            if ((k == paramInt1) && (n == paramInt2) && (m == paramInt3)) {
076                                continue;
077                            }
078                            int i1 = 100;
079                            if (n > paramInt2 + 1) {
080                                i1 += (n - (paramInt2 + 1)) * 100;
081                            }
082    
083                            int i2 = h(paramfv, k, n, m);
084                            if ((i2 > 0) && (paramRandom.nextInt(i1) <= i2)) {
085                                // hMod: dynamic spreading of fire.{
086                                // avg call amount per placed block of fire ~ 4
087                                Block block = new Block(paramfv.a(k, n, m), k, n, m);
088                                block.setStatus(3);
089                                if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.IGNITE, block, null)) {
090                                    paramfv.e(k, n, m, bi);
091                                }
092                            }
093                        }
094                    }
095                }
096            }
097        }
098    
099        private void a(fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4, Random paramRandom) {
100            int i = b[paramfv.a(paramInt1, paramInt2, paramInt3)];
101            if (paramRandom.nextInt(paramInt4) < i) {
102                int j = paramfv.a(paramInt1, paramInt2, paramInt3) == hr.am.bi ? 1 : 0;
103                if (paramRandom.nextInt(2) == 0) {
104                    // hMod: VERY SLOW dynamic spreading of fire.
105                    Block block = new Block(paramfv.a(paramInt1, paramInt2, paramInt3), paramInt1, paramInt2, paramInt3);
106                    block.setStatus(3);
107                    if (!(Boolean) etc.getLoader().callHook(PluginLoader.Hook.IGNITE, block, null)) {
108                        paramfv.e(paramInt1, paramInt2, paramInt3, bi);
109                    }
110                } else {
111                    paramfv.e(paramInt1, paramInt2, paramInt3, 0);
112                }
113                if (j != 0) {
114                    hr.am.a(paramfv, paramInt1, paramInt2, paramInt3, 0);
115                }
116            }
117        }
118    
119        private boolean g(fv paramfv, int paramInt1, int paramInt2, int paramInt3) {
120            // hMod: cast down to fix decompiler error.(6 times)
121            if (b((la) paramfv, paramInt1 + 1, paramInt2, paramInt3)) {
122                return true;
123            }
124            if (b((la) paramfv, paramInt1 - 1, paramInt2, paramInt3)) {
125                return true;
126            }
127            if (b((la) paramfv, paramInt1, paramInt2 - 1, paramInt3)) {
128                return true;
129            }
130            if (b((la) paramfv, paramInt1, paramInt2 + 1, paramInt3)) {
131                return true;
132            }
133            if (b((la) paramfv, paramInt1, paramInt2, paramInt3 - 1)) {
134                return true;
135            }
136            return b((la) paramfv, paramInt1, paramInt2, paramInt3 + 1);
137        }
138    
139        private int h(fv paramfv, int paramInt1, int paramInt2, int paramInt3) {
140            int i = 0;
141            if (!paramfv.e(paramInt1, paramInt2, paramInt3)) {
142                return 0;
143            }
144    
145            i = f(paramfv, paramInt1 + 1, paramInt2, paramInt3, i);
146            i = f(paramfv, paramInt1 - 1, paramInt2, paramInt3, i);
147            i = f(paramfv, paramInt1, paramInt2 - 1, paramInt3, i);
148            i = f(paramfv, paramInt1, paramInt2 + 1, paramInt3, i);
149            i = f(paramfv, paramInt1, paramInt2, paramInt3 - 1, i);
150            i = f(paramfv, paramInt1, paramInt2, paramInt3 + 1, i);
151    
152            return i;
153        }
154    
155        public boolean d() {
156            return false;
157        }
158    
159        public boolean b(la paramla, int paramInt1, int paramInt2, int paramInt3) {
160            return a[paramla.a(paramInt1, paramInt2, paramInt3)] > 0;
161        }
162    
163        public int f(fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
164            int i = a[paramfv.a(paramInt1, paramInt2, paramInt3)];
165            if (i > paramInt4) {
166                return i;
167            }
168            return paramInt4;
169        }
170    
171        public boolean a(fv paramfv, int paramInt1, int paramInt2, int paramInt3) {
172            return (paramfv.d(paramInt1, paramInt2 - 1, paramInt3)) || (g(paramfv, paramInt1, paramInt2, paramInt3));
173        }
174    
175        public void b(fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
176            if ((!paramfv.d(paramInt1, paramInt2 - 1, paramInt3)) && (!g(paramfv, paramInt1, paramInt2, paramInt3))) {
177                paramfv.e(paramInt1, paramInt2, paramInt3, 0);
178                return;
179            }
180        }
181    
182        public void e(fv paramfv, int paramInt1, int paramInt2, int paramInt3) {
183            if ((paramfv.a(paramInt1, paramInt2 - 1, paramInt3) == hr.ap.bi)
184                    && (hr.be.b_(paramfv, paramInt1, paramInt2, paramInt3))) {
185                return;
186            }
187    
188            if ((!paramfv.d(paramInt1, paramInt2 - 1, paramInt3)) && (!g(paramfv, paramInt1, paramInt2, paramInt3))) {
189                paramfv.e(paramInt1, paramInt2, paramInt3, 0);
190                return;
191            }
192            paramfv.i(paramInt1, paramInt2, paramInt3, bi);
193        }
194    }