private int a(World world, BlockPosition blockposition, int i, EnumDirection enumdirection) { int j = 1000; Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); while (iterator.hasNext()) { EnumDirection enumdirection1 = (EnumDirection) iterator.next(); if (enumdirection1 != enumdirection) { BlockPosition blockposition1 = blockposition.shift(enumdirection1); IBlockData iblockdata = world.getType(blockposition1); if ((!g(world, blockposition1, iblockdata)) && ((iblockdata.getBlock().getMaterial() != this.material) || (((Integer) iblockdata.get(LEVEL)).intValue() > 0))) { if (!g(world, blockposition1.down(), iblockdata)) { return i; } if (i < 4) { int k = a(world, blockposition1, i + 1, enumdirection1.opposite()); if (k < j) { j = k; } } } } } return j; }
public IBlockData getPlacedState( World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { IBlockData iblockdata = getBlockData().set(POWERED, Boolean.valueOf(false)); if (a(world, blockposition, enumdirection.opposite())) { return iblockdata.set( FACING, EnumLeverPosition.a(enumdirection, entityliving.getDirection())); } Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); EnumDirection enumdirection1; do { if (!iterator.hasNext()) { if (World.a(world, blockposition.down())) { return iblockdata.set( FACING, EnumLeverPosition.a(EnumDirection.UP, entityliving.getDirection())); } return iblockdata; } enumdirection1 = (EnumDirection) iterator.next(); } while ((enumdirection1 == enumdirection) || (!a(world, blockposition, enumdirection1.opposite()))); return iblockdata.set(FACING, EnumLeverPosition.a(enumdirection1, entityliving.getDirection())); }
public static EnumLeverPosition a(EnumDirection enumdirection, EnumDirection enumdirection1) { switch (BlockLever.SyntheticClass_1.a[enumdirection.ordinal()]) { case 1: switch (BlockLever.SyntheticClass_1.c[enumdirection1.k().ordinal()]) { case 1: return DOWN_X; case 2: return DOWN_Z; } throw new IllegalArgumentException( "Invalid entityFacing " + enumdirection1 + " for facing " + enumdirection); case 2: switch (BlockLever.SyntheticClass_1.c[enumdirection1.k().ordinal()]) { case 1: return UP_X; case 2: return UP_Z; } throw new IllegalArgumentException( "Invalid entityFacing " + enumdirection1 + " for facing " + enumdirection); case 3: return NORTH; case 4: return SOUTH; case 5: return WEST; case 6: return EAST; } throw new IllegalArgumentException("Invalid facing: " + enumdirection); }
private Set<EnumDirection> f(World world, BlockPosition blockposition) { int i = 1000; EnumSet enumset = EnumSet.noneOf(EnumDirection.class); Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); while (iterator.hasNext()) { EnumDirection enumdirection = (EnumDirection) iterator.next(); BlockPosition blockposition1 = blockposition.shift(enumdirection); IBlockData iblockdata = world.getType(blockposition1); if ((!g(world, blockposition1, iblockdata)) && ((iblockdata.getBlock().getMaterial() != this.material) || (((Integer) iblockdata.get(LEVEL)).intValue() > 0))) { int j; int j; if (g(world, blockposition1.down(), world.getType(blockposition1.down()))) { j = a(world, blockposition1, 1, enumdirection.opposite()); } else { j = 0; } if (j < i) { enumset.clear(); } if (j <= i) { enumset.add(enumdirection); i = j; } } } return enumset; }
public IBlockData fromLegacyData(int var1) { EnumDirection var2 = EnumDirection.getById(var1); if (var2.getAxis() == EnumDirection.EnumAxis.Y) { var2 = EnumDirection.NORTH; } return this.getBlockData().set(a, var2); }
public void doPhysics(World var1, BlockPosition var2, IBlockData var3, Block var4) { EnumDirection var5 = (EnumDirection) var3.get(a); if (!var1.getType(var2.shift(var5.opposite())).getBlock().getMaterial().isBuildable()) { this.dropNaturallyForSure(var1, var2, var3, 0); var1.setAir(var2); } super.doPhysics(var1, var2, var3, var4); }
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { if (((Boolean) iblockdata.get(POWERED)).booleanValue()) { world.applyPhysics(blockposition, this); EnumDirection enumdirection = ((EnumLeverPosition) iblockdata.get(FACING)).c(); world.applyPhysics(blockposition.shift(enumdirection.opposite()), this); } super.remove(world, blockposition, iblockdata); }
// $FF: synthetic class static class SyntheticClass_1 { // $FF: synthetic field static final int[] a = new int[EnumDirection.values().length]; static { try { a[EnumDirection.NORTH.ordinal()] = 1; } catch (NoSuchFieldError var4) {; } try { a[EnumDirection.SOUTH.ordinal()] = 2; } catch (NoSuchFieldError var3) {; } try { a[EnumDirection.WEST.ordinal()] = 3; } catch (NoSuchFieldError var2) {; } try { a[EnumDirection.EAST.ordinal()] = 4; } catch (NoSuchFieldError var1) {; } } }
class SwitchHelperDirection3 { public static final int[] a = new int[EnumDirection.values().length]; static { try { SwitchHelperDirection3.a[EnumDirection.NORTH.ordinal()] = 1; } catch (NoSuchFieldError nosuchfielderror) {; } try { SwitchHelperDirection3.a[EnumDirection.SOUTH.ordinal()] = 2; } catch (NoSuchFieldError nosuchfielderror1) {; } try { SwitchHelperDirection3.a[EnumDirection.WEST.ordinal()] = 3; } catch (NoSuchFieldError nosuchfielderror2) {; } try { SwitchHelperDirection3.a[EnumDirection.EAST.ordinal()] = 4; } catch (NoSuchFieldError nosuchfielderror3) {; } } }
private void a(TileEntityIronChest tileentitychest, EnumDirection enumdirection) { if (tileentitychest.x()) { this.a = false; } else if (this.a) { switch (SwitchHelperTileEntityChest.a[enumdirection.ordinal()]) { case 1: if (this.f != tileentitychest) { this.a = false; } break; case 2: if (this.i != tileentitychest) { this.a = false; } break; case 3: if (this.g != tileentitychest) { this.a = false; } break; case 4: if (this.h != tileentitychest) { this.a = false; } } } }
public boolean canPlace(World world, BlockPosition blockposition) { EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; for (int j = 0; j < i; j++) { EnumDirection enumdirection = aenumdirection[j]; if (a(world, blockposition, enumdirection)) { return true; } } return false; }
public boolean interact( World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { if (world.isClientSide) { return true; } boolean powered = ((Boolean) iblockdata.get(POWERED)).booleanValue(); org.bukkit.block.Block block = world .getWorld() .getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); int old = powered ? 15 : 0; int current = !powered ? 15 : 0; BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); world.getServer().getPluginManager().callEvent(eventRedstone); if ((eventRedstone.getNewCurrent() > 0 ? 1 : 0) != (powered ? 0 : 1)) { return true; } iblockdata = iblockdata.a(POWERED); world.setTypeAndData(blockposition, iblockdata, 3); world.makeSound( blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D, "random.click", 0.3F, ((Boolean) iblockdata.get(POWERED)).booleanValue() ? 0.6F : 0.5F); world.applyPhysics(blockposition, this); EnumDirection enumdirection1 = ((EnumLeverPosition) iblockdata.get(FACING)).c(); world.applyPhysics(blockposition.shift(enumdirection1.opposite()), this); return true; }
public void updateShape(IBlockAccess var1, BlockPosition var2) { EnumDirection var3 = (EnumDirection) var1.getType(var2).get(a); float var4 = 0.28125F; float var5 = 0.78125F; float var6 = 0.0F; float var7 = 1.0F; float var8 = 0.125F; this.setSizes(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); switch (BlockWallSign.SyntheticClass_1.a[var3.ordinal()]) { case 1: this.setSizes(var6, var4, 1.0F - var8, var7, var5, 1.0F); break; case 2: this.setSizes(var6, var4, 0.0F, var7, var5, var8); break; case 3: this.setSizes(1.0F - var8, var4, var6, 1.0F, var5, var7); break; case 4: this.setSizes(0.0F, var4, var6, var8, var5, var7); } }
protected TileEntityIronChest a(EnumDirection enumdirection) { BlockPosition blockposition = this.position.shift(enumdirection); if (this.b(blockposition)) { TileEntity tileentity = this.world.getTileEntity(blockposition); if (tileentity instanceof TileEntityIronChest) { TileEntityIronChest tileentitychest = (TileEntityIronChest) tileentity; tileentitychest.a(this, enumdirection.opposite()); return tileentitychest; } } return null; }
public static int a(EnumDirection enumdirection) { switch (SyntheticClass_1.a[enumdirection.ordinal()]) { case 1: return 0; case 2: return 5; case 3: return 4; case 4: return 3; case 5: return 2; case 6: return 1; } return -1; }
protected WorldGenMonumentPiece( int i, EnumDirection enumdirection, WorldGenMonumentStateTracker worldgenmonumentstatetracker, int j, int k, int l) { super(i); this.m = enumdirection; this.k = worldgenmonumentstatetracker; int i1 = worldgenmonumentstatetracker.a; int j1 = i1 % 5; int k1 = i1 / 5 % 5; int l1 = i1 / 25; if (enumdirection != EnumDirection.NORTH && enumdirection != EnumDirection.SOUTH) { this.l = new StructureBoundingBox(0, 0, 0, l * 8 - 1, k * 4 - 1, j * 8 - 1); } else { this.l = new StructureBoundingBox(0, 0, 0, j * 8 - 1, k * 4 - 1, l * 8 - 1); } switch (SwitchHelperDirection5.a[enumdirection.ordinal()]) { case 1: this.l.a(j1 * 8, l1 * 4, -(k1 + l) * 8 + 1); break; case 2: this.l.a(j1 * 8, l1 * 4, k1 * 8); break; case 3: this.l.a(-(k1 + l) * 8 + 1, l1 * 4, j1 * 8); break; default: this.l.a(k1 * 8, l1 * 4, j1 * 8); } }
public EnumDirection getDirection() { return EnumDirection.fromType2( MathHelper.floor((double) (this.yaw * 4.0F / 360.0F) + 0.5D) & 3); }
public IBlockData fromLegacyData(int i) { return this.getBlockData() .set(BlockSkull.FACING, EnumDirection.fromType1(i & 7)) .set(BlockSkull.NODROP, Boolean.valueOf((i & 8) > 0)); }
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.i(); IPosition iposition = BlockDispenser.a(isourceblock); EnumDirection enumdirection = BlockDispenser.b(isourceblock.f()); IProjectile iprojectile = this.a(world, iposition); // iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) // enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.b(), // this.a()); // CraftBukkit start ItemStack itemstack1 = itemstack.a(1); org.bukkit.block.Block block = world .getWorld() .getBlockAt( isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); BlockDispenseEvent event = new BlockDispenseEvent( block, craftItem.clone(), new org.bukkit.util.Vector( (double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ())); if (!BlockDispenser.eventFired) { world.getServer().getPluginManager().callEvent(event); } if (event.isCancelled()) { itemstack.count++; return itemstack; } if (!event.getItem().equals(craftItem)) { itemstack.count++; // Chain to handler for new item ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { idispensebehavior.a(isourceblock, eventStack); return itemstack; } } iprojectile.shoot( event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.b(), this.a()); ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource( (TileEntityDispenser) isourceblock.getTileEntity()); // CraftBukkit end world.addEntity((Entity) iprojectile); // itemstack.a(1); // CraftBukkit - Handled during event processing return itemstack; }
public boolean canPlace(World world, BlockPosition blockposition, EnumDirection enumdirection) { return a(world, blockposition, enumdirection.opposite()); }
static { try { c[EnumDirection.EnumAxis.X.ordinal()] = 1; } catch (NoSuchFieldError localNoSuchFieldError1) { } try { c[EnumDirection.EnumAxis.Z.ordinal()] = 2; } catch (NoSuchFieldError localNoSuchFieldError2) { } b = new int[BlockLever.EnumLeverPosition.values().length]; try { b[BlockLever.EnumLeverPosition.EAST.ordinal()] = 1; } catch (NoSuchFieldError localNoSuchFieldError3) { } try { b[BlockLever.EnumLeverPosition.WEST.ordinal()] = 2; } catch (NoSuchFieldError localNoSuchFieldError4) { } try { b[BlockLever.EnumLeverPosition.SOUTH.ordinal()] = 3; } catch (NoSuchFieldError localNoSuchFieldError5) { } try { b[BlockLever.EnumLeverPosition.NORTH.ordinal()] = 4; } catch (NoSuchFieldError localNoSuchFieldError6) { } try { b[BlockLever.EnumLeverPosition.UP_Z.ordinal()] = 5; } catch (NoSuchFieldError localNoSuchFieldError7) { } try { b[BlockLever.EnumLeverPosition.UP_X.ordinal()] = 6; } catch (NoSuchFieldError localNoSuchFieldError8) { } try { b[BlockLever.EnumLeverPosition.DOWN_X.ordinal()] = 7; } catch (NoSuchFieldError localNoSuchFieldError9) { } try { b[BlockLever.EnumLeverPosition.DOWN_Z.ordinal()] = 8; } catch (NoSuchFieldError localNoSuchFieldError10) { } a = new int[EnumDirection.values().length]; try { a[EnumDirection.DOWN.ordinal()] = 1; } catch (NoSuchFieldError localNoSuchFieldError11) { } try { a[EnumDirection.UP.ordinal()] = 2; } catch (NoSuchFieldError localNoSuchFieldError12) { } try { a[EnumDirection.NORTH.ordinal()] = 3; } catch (NoSuchFieldError localNoSuchFieldError13) { } try { a[EnumDirection.SOUTH.ordinal()] = 4; } catch (NoSuchFieldError localNoSuchFieldError14) { } try { a[EnumDirection.WEST.ordinal()] = 5; } catch (NoSuchFieldError localNoSuchFieldError15) { } try { a[EnumDirection.EAST.ordinal()] = 6; } catch (NoSuchFieldError localNoSuchFieldError16) { } }
public IBlockData fromLegacyData(int i) { return this.getBlockData().set(BlockPumpkin.FACING, EnumDirection.fromType2(i)); }