001    
002    public class iq extends hg {
003    
004        private mh a;
005    
006        public iq(int paramInt, mh parammh) {
007            super(paramInt);
008            a = parammh;
009            bc = 64;
010            bb = 1;
011        }
012    
013        public boolean a(jl paramjl, hl paramhl, fv paramfv, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
014            if (paramInt4 != 1) {
015                return false;
016            }
017            paramInt2++;
018            hr localhr;
019            if (a == mh.c) {
020                localhr = hr.aE;
021            } else {
022                localhr = hr.aL;
023            }
024            if (!localhr.a(paramfv, paramInt1, paramInt2, paramInt3)) {
025                return false;
026            }
027    
028            // hMod: Doors onItemUse
029            Block blockClicked = new Block(paramfv.a(paramInt1, paramInt2, paramInt3), paramInt1, paramInt2, paramInt3);
030            blockClicked.setFaceClicked(Block.Face.fromId(paramInt4));
031            Block blockPlaced = new Block(paramfv.a(paramInt1, paramInt2 + 1, paramInt3), paramInt1, paramInt2 + 1, paramInt3);
032    
033            // Call the hook
034            if (paramhl instanceof fy) {
035                Player player = ((fy) paramhl).getPlayer();
036                if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.ITEM_USE, player, blockPlaced, blockClicked, new Item(paramjl))) {
037                    return false;
038                }
039            }
040            int i = iz.b((paramhl.v + 180.0F) * 4.0F / 360.0F - 0.5D) & 0x3;
041    
042            int j = 0;
043            int k = 0;
044            if (i == 0) {
045                k = 1;
046            }
047            if (i == 1) {
048                j = -1;
049            }
050            if (i == 2) {
051                k = -1;
052            }
053            if (i == 3) {
054                j = 1;
055            }
056    
057            int m = (paramfv.d(paramInt1 - j, paramInt2, paramInt3 - k) ? 1 : 0) + (paramfv.d(paramInt1 - j, paramInt2 + 1, paramInt3 - k) ? 1 : 0);
058            int n = (paramfv.d(paramInt1 + j, paramInt2, paramInt3 + k) ? 1 : 0) + (paramfv.d(paramInt1 + j, paramInt2 + 1, paramInt3 + k) ? 1 : 0);
059    
060            int i1 = (paramfv.a(paramInt1 - j, paramInt2, paramInt3 - k) == localhr.bi) || (paramfv.a(paramInt1 - j, paramInt2 + 1, paramInt3 - k) == localhr.bi) ? 1 : 0;
061            int i2 = (paramfv.a(paramInt1 + j, paramInt2, paramInt3 + k) == localhr.bi) || (paramfv.a(paramInt1 + j, paramInt2 + 1, paramInt3 + k) == localhr.bi) ? 1 : 0;
062    
063            int i3 = 0;
064            if ((i1 != 0) && (i2 == 0)) {
065                i3 = 1;
066            } else if (n > m) {
067                i3 = 1;
068            }
069    
070            if (i3 != 0) {
071                i = i - 1 & 0x3;
072                i += 4;
073            }
074    
075            paramfv.e(paramInt1, paramInt2, paramInt3, localhr.bi);
076            paramfv.c(paramInt1, paramInt2, paramInt3, i);
077    
078            paramfv.e(paramInt1, paramInt2 + 1, paramInt3, localhr.bi);
079            paramfv.c(paramInt1, paramInt2 + 1, paramInt3, i + 8);
080    
081            paramjl.a -= 1;
082            return true;
083        }
084    }