mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 19:49:54 +00:00
Clean up Utils.getTile to not use try/catch
This commit is contained in:
1 parent
9f1b1cc474
commit
e28ad8424c
1 file changed
+6
-7
@@ -206,14 +206,13 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static <T extends TileEntity> T getTile(IBlockAccess world, int x, int y, int z, Class<T> tileClass) {
|
||||
T tileEntity = null;
|
||||
try {
|
||||
tileEntity = tileClass.cast(world.getTileEntity(x, y, z));
|
||||
} catch (ClassCastException ex) {
|
||||
Proxies.log.warning("Failed to cast a tile entity to a " + tileClass.getName() + " at " + x + '/' + y + '/' + z);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileClass.isInstance(tileEntity)) {
|
||||
return tileClass.cast(tileEntity);
|
||||
} else {
|
||||
Proxies.log.warning("Failed to cast a tile entity {" + tileEntity + "} to a {" + tileClass.getName() + "} at " + x + '/' + y + '/' + z);
|
||||
return null;
|
||||
}
|
||||
|
||||
return tileEntity;
|
||||
}
|
||||
|
||||
public static int addRGBComponents(int colour, int r, int g, int b) {
|
||||
|
||||
Reference in new issue
Block a user