@Override public boolean onWanded(EntityPlayer player, ItemStack wand) { if(player == null) return false; if(player.isSneaking()) { if(!player.world.isRemote) { orientation = orientation.rotateY(); sync(); } return true; } else return super.onWanded(player, wand); }
@Override protected Set<BlockPos> getAdditionalPartPositions(BlockPos pos, EnumFacing facing) { return ImmutableSet.of(pos.offset(facing.rotateY()), pos.offset(facing.rotateYCCW())); }
private EnumFacing rotateFacing(int turns, EnumFacing facing) { for (int i = 0; i < turns; i++) { facing = facing.rotateY(); } return facing; }
EnumFacing rotate(VertexTransform xForm, EnumFacing dir) { if (xForm instanceof VertexRotationFacing) { double angle = ((VertexRotationFacing) xForm).getAngle(); if (angle < ROTATION_AMOUNT * 0.5 || angle >= ROTATION_AMOUNT * 3.5) { return dir; } else if (angle >= ROTATION_AMOUNT * 0.5 && angle < ROTATION_AMOUNT * 1.5) { return dir.rotateY(); } else if (angle >= ROTATION_AMOUNT * 1.5 && angle < ROTATION_AMOUNT * 2.5) { return dir.getOpposite(); } else if (angle >= ROTATION_AMOUNT * 2.5 && angle < ROTATION_AMOUNT * 3.5) { return dir.rotateYCCW(); } } return dir; }
@Override protected Set<BlockPos> getAdditionalPartPositions(BlockPos pos, EnumFacing facing) { return ImmutableSet.of(pos.up(), pos.offset(facing.rotateY()), pos.offset(facing.rotateYCCW())); }
public BlockPos getOpposite(BlockPos pos, IBlockState state) { EnumFacing facing = state.getValue(FACING); BlockHalf half = state.getValue(HALF); return pos.offset(half == BlockHalf.MAIN ? facing.rotateYCCW() : facing.rotateY()); }
protected @Nonnull BlockPos getNeighbor(@Nonnull BlockPos pos, @Nonnull Random rand) { EnumFacing face = NNList.FACING.get(rand.nextInt(NNList.FACING.size())); if (face.getAxis() != Axis.Y && rand.nextBoolean()) { return pos.offset(face).offset(face.rotateY()); } else { return pos.offset(face); } }
private static void removeIfHasConnectedSide(List<PipeMount> mountCanidates) { boolean sides[] = new boolean[6]; for (PipeMount mount : mountCanidates) { sides[mount.dir.ordinal()] = true; } for (int i = 2; i < 6; i++) { EnumFacing dir = EnumFacing.getFront(i); EnumFacing rot = dir.rotateY(); if (sides[dir.ordinal()] && sides[rot.ordinal()]) { reduceToOnePerSide(mountCanidates, dir, dir.rotateYCCW()); reduceToOnePerSide(mountCanidates, rot, rot.rotateY()); } } }
@Override public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, placer.getHorizontalFacing().rotateY().rotateY()).withProperty(PART, EnumPart.fromMeta(placer.getRNG().nextInt(2)));//TODO }
private BlockPos getOtherTableBlock(IBlockState tablePart, BlockPos tablePartPos) { return tablePartPos.offset(tablePart.getValue(ISLEFTSIDE) ? tablePart.getValue(FACING).rotateYCCW() : tablePart.getValue(FACING).rotateY()); }
@Override public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return this.getDefaultState().withProperty(FACING_BIAS, placer.getHorizontalFacing().rotateY()); }
@Override public void placeAdditionalParts(World world, BlockPos pos, EnumFacing facing) { placeSideBlock(world, pos, pos.offset(facing.rotateY()), facing.getOpposite()); placeSideBlock(world, pos, pos.offset(facing.rotateYCCW()), facing); }
@Override public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing facing) { if (facing != EnumFacing.UP && facing != EnumFacing.DOWN) return ((EnumFacing) state.getValue(FACING)).getAxis() == facing.rotateY().getAxis() ? BlockFaceShape.MIDDLE_POLE : BlockFaceShape.UNDEFINED; else return BlockFaceShape.UNDEFINED; }
@Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { EnumFacing facing = state.getValue(FACING); EnumFacing offset = state.getValue(HINGE) == BlockDoor.EnumHingePosition.LEFT ? facing.rotateY() : facing.rotateYCCW(); IBlockState adjacentBlock = worldIn.getBlockState(pos.offset(offset)); return state.withProperty(POLE, !(adjacentBlock.getBlock() instanceof BlockUpgradedGate)); }
/** * Move the structure right. */ private void moveRightClicked() { Settings.instance.moveTo(new BlockPos(0, 0, 0).offset(this.mc.player.getHorizontalFacing().rotateY())); }
@Override public void placeAdditionalParts(World world, BlockPos pos, EnumFacing facing) { world.setBlockState(pos.up(), AWStructureBlocks.TOTEM_PART.getDefaultState().withProperty(VISIBLE, false)); WorldTools.getTile(world, pos.up(), TileTotemPart.class).ifPresent(t -> t.setMainBlockPos(pos)); placeWingBlock(world, pos, pos.offset(facing.rotateY()), facing.getOpposite()); placeWingBlock(world, pos, pos.offset(facing.rotateYCCW()), facing); }
private boolean canJoeSee(EntityLivingBase ent) { Vec3d entPos = new Vec3d(ent.posX, ent.posY + ent.getEyeHeight(), ent.posZ); for (EnumFacing facing1 : new EnumFacing[] { facing, facing.rotateY(), facing.rotateYCCW() }) { if (this.world.rayTraceBlocks(new Vec3d(getPos().getX() + faceMidPoints[facing1.ordinal()][0], getPos().getY() + faceMidPoints[facing1.ordinal()][1], getPos().getZ() + faceMidPoints[facing1.ordinal()][2]), entPos) == null) return true; } return false; }