001    
002    import java.util.Random;
003    
004    public class bh extends hg {
005    
006        private int a;
007    
008        public bh(int paramInt1, int paramInt2) {
009            super(paramInt1);
010            bb = 1;
011            bc = 64;
012            a = paramInt2;
013        }
014    
015        public jl a(jl paramjl, fv paramfv, hl paramhl) {
016            float f1 = 1.0F;
017    
018            float f2 = paramhl.y + (paramhl.w - paramhl.y) * f1;
019            float f3 = paramhl.x + (paramhl.v - paramhl.x) * f1;
020    
021            double d1 = paramhl.m + (paramhl.p - paramhl.m) * f1;
022            double d2 = paramhl.n + (paramhl.q - paramhl.n) * f1 + 1.62D - paramhl.H;
023            double d3 = paramhl.o + (paramhl.r - paramhl.o) * f1;
024    
025            bu localbu1 = bu.b(d1, d2, d3);
026    
027            float f4 = iz.b(-f3 * 0.01745329F - 3.141593F);
028            float f5 = iz.a(-f3 * 0.01745329F - 3.141593F);
029            float f6 = -iz.b(-f2 * 0.01745329F);
030            float f7 = iz.a(-f2 * 0.01745329F);
031    
032            float f8 = f5 * f6;
033            float f9 = f7;
034            float f10 = f4 * f6;
035    
036            double d4 = 5.0D;
037            bu localbu2 = localbu1.c(f8 * d4, f9 * d4, f10 * d4);
038            ih localih = paramfv.a(localbu1, localbu2, a == 0);
039            if (localih == null) {
040                return paramjl;
041            }
042    
043            if (localih.a == jr.a) {
044                int i = localih.b;
045                int j = localih.c;
046                int k = localih.d;
047    
048                if (!paramfv.a(paramhl, i, j, k)) {
049                    return paramjl;
050                }
051    
052                // hMod: Click == placed when handling an empty bukkit!
053                Block blockClicked = new Block(paramfv.a(i, j, k), i, j, k);
054                blockClicked.setFaceClicked(Block.Face.fromId(localih.e));
055                Block blockPlaced = new Block(0, i, j, k);
056    
057                if (a == 0) {
058                    if ((paramfv.c(i, j, k) == mh.f) && (paramfv.b(i, j, k) == 0)) {
059                        // Filling a bucket with water!
060                        if (paramhl instanceof fy && (Boolean) etc.getLoader().callHook(PluginLoader.Hook.ITEM_USE, ((fy) paramhl).getPlayer(), blockPlaced, blockClicked, new Item(paramjl))) {
061                            return paramjl;
062                        }
063    
064                        paramfv.e(i, j, k, 0);
065                        return new jl(hg.av);
066                    }
067                    if ((paramfv.c(i, j, k) == mh.g) && (paramfv.b(i, j, k) == 0)) {
068                        // Filling a bucket with lava!
069                        if (paramhl instanceof fy && (Boolean) etc.getLoader().callHook(PluginLoader.Hook.ITEM_USE, ((fy) paramhl).getPlayer(), blockPlaced, blockClicked, new Item(paramjl))) {
070                            return paramjl;
071                        }
072    
073                        paramfv.e(i, j, k, 0);
074                        return new jl(hg.aw);
075                    }
076                } else {
077                    if (a < 0) {
078                        return new jl(hg.au);
079                    }
080                    if (localih.e == 0) {
081                        j--;
082                    }
083                    if (localih.e == 1) {
084                        j++;
085                    }
086                    if (localih.e == 2) {
087                        k--;
088                    }
089                    if (localih.e == 3) {
090                        k++;
091                    }
092                    if (localih.e == 4) {
093                        i--;
094                    }
095                    if (localih.e == 5) {
096                        i++;
097                    }
098    
099                    if ((paramfv.e(i, j, k)) || (!paramfv.c(i, j, k).a())) {
100                        if ((paramfv.q.d) && (a == hr.A.bi)) {
101                            paramfv.a(d1 + 0.5D, d2 + 0.5D, d3 + 0.5D, "random.fizz", 0.5F, 2.6F + (paramfv.l.nextFloat() - paramfv.l.nextFloat()) * 0.8F);
102                            for (int m = 0; m < 8; m++) {
103                                paramfv.a("largesmoke", i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D);
104                            }
105                        } else {
106                            // hMod: Bucket empty.
107                            blockPlaced = new Block(this.a, i, j, k);
108                            if (paramhl instanceof fy && (Boolean) etc.getLoader().callHook(PluginLoader.Hook.ITEM_USE, ((fy) paramhl).getPlayer(), blockPlaced, blockClicked, new Item(paramjl))) {
109                                return paramjl;
110                            }
111    
112                            paramfv.b(i, j, k, a, 0);
113                        }
114                        return new jl(hg.au);
115                    }
116                }
117    
118            } else if ((a == 0)
119                    && ((localih.g instanceof bx))) {
120                return new jl(hg.aE);
121            }
122    
123            return paramjl;
124        }
125    }