static {
   for (EnumFacing f : EnumFacing.values()) {
     properties[f.ordinal()] =
         Properties.toUnlisted(
             PropertyInteger.create(f.getName(), 0, (1 << (cubeSize * cubeSize)) - 1));
   }
 }
Example #2
0
  private BlockPos flipPos(
      final BlockPos pos, final EnumFacing axis, final Vec3i dimensions, final MBlockPos flipped)
      throws FlipException {
    switch (axis) {
      case DOWN:
      case UP:
        return flipped.set(pos.getX(), dimensions.getY() - 1 - pos.getY(), pos.getZ());

      case NORTH:
      case SOUTH:
        return flipped.set(pos.getX(), pos.getY(), dimensions.getZ() - 1 - pos.getZ());

      case WEST:
      case EAST:
        return flipped.set(dimensions.getX() - 1 - pos.getX(), pos.getY(), pos.getZ());
    }

    throw new FlipException("'%s' is not a valid axis!", axis.getName());
  }
  @Override
  public boolean onItemUse(
      ItemStack stack,
      EntityPlayer player,
      World world,
      BlockPos pos,
      EnumFacing facing,
      float fx,
      float fy,
      float fz) {
    // TODO Auto-generated method stub
    if (!world.isRemote) {
      if (player.dimension != -1) {
        if (facing.getName().compareTo("up") == 0) {
          world.setBlockState(
              new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()),
              Blocks.flowing_water.getDefaultState());
        } else if (facing.getName().compareTo("down") == 0) {
          world.setBlockState(
              new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ()),
              Blocks.flowing_water.getDefaultState());
        } else if (facing.getName().compareTo("west") == 0) {
          world.setBlockState(
              new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()),
              Blocks.flowing_water.getDefaultState());
        } else if (facing.getName().compareTo("east") == 0) {
          world.setBlockState(
              new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()),
              Blocks.flowing_water.getDefaultState());
        } else if (facing.getName().compareTo("north") == 0) {
          world.setBlockState(
              new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1),
              Blocks.flowing_water.getDefaultState());
        } else if (facing.getName().compareTo("south") == 0) {
          world.setBlockState(
              new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1),
              Blocks.flowing_water.getDefaultState());
        }
      }
    }

    return true;
  }