use of com.builtbroken.mc.api.IHasMass in project Engine by VoltzEngine-Project.
the class MassRegistry method getMass.
@Override
public double getMass(World world, int x, int y, int z) {
double mass;
if (world != null) {
// Checks if the chunk is loaded
if (world instanceof WorldServer) {
ChunkProviderServer providerServer = ((WorldServer) world).theChunkProviderServer;
if (!providerServer.chunkExists(x >> 4, z >> 4)) {
return -1;
}
}
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IHasMass) {
mass = ((IHasMass) tile).getMass();
if (mass >= 0) {
return mass;
}
}
mass = getMass(block, meta);
return mass >= 0 ? mass : getMass(block);
}
return -1;
}
use of com.builtbroken.mc.api.IHasMass in project Engine by VoltzEngine-Project.
the class MassRegistry method getMass.
@Override
public double getMass(World world, int x, int y, int z) {
double mass;
if (world != null) {
//Checks if the chunk is loaded
if (world instanceof WorldServer) {
ChunkProviderServer providerServer = ((WorldServer) world).theChunkProviderServer;
if (!providerServer.chunkExists(x >> 4, z >> 4)) {
return -1;
}
}
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IHasMass) {
mass = ((IHasMass) tile).getMass();
if (mass >= 0) {
return mass;
}
}
mass = getMass(block, meta);
return mass >= 0 ? mass : getMass(block);
}
return -1;
}
Aggregations