コード例 #1
0
 public void getLiq(World world, int x, int y, int z, int metadata) {
   int oldLevel = 0;
   if (liquidLevel < CAPACITY) {
     if (MachineRegistry.getMachine(world, x + 1, y, z) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x + 1, y, z);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x - 1, y, z) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x - 1, y, z);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x, y - 1, z) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y - 1, z);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x, y, z + 1) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z + 1);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
     if (MachineRegistry.getMachine(world, x, y, z - 1) == MachineRegistry.PIPE) {
       TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z - 1);
       if (tile != null && (tile.liquidID == liquidID || liquidID == -1) && tile.liquidLevel > 0) {
         liquidID = tile.liquidID;
         oldLevel = tile.liquidLevel;
         tile.liquidLevel =
             ReikaMathLibrary.extrema(tile.liquidLevel - tile.liquidLevel / 4 - 1, 0, "max");
         liquidLevel = ReikaMathLibrary.extrema(liquidLevel + oldLevel / 4 + 1, 0, "max");
       }
     }
   }
 }