mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-28 02:48:14 -05:00
Update #48 - Added some features from OptiFine
This commit is contained in:
22
sources/main/java/net/optifine/util/TileEntityUtils.java
Normal file
22
sources/main/java/net/optifine/util/TileEntityUtils.java
Normal file
@ -0,0 +1,22 @@
|
||||
package net.optifine.util;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IWorldNameable;
|
||||
|
||||
public class TileEntityUtils {
|
||||
public static String getTileEntityName(IBlockAccess blockAccess, BlockPos blockPos) {
|
||||
TileEntity tileentity = blockAccess.getTileEntity(blockPos);
|
||||
return getTileEntityName(tileentity);
|
||||
}
|
||||
|
||||
public static String getTileEntityName(TileEntity te) {
|
||||
if (!(te instanceof IWorldNameable)) {
|
||||
return null;
|
||||
} else {
|
||||
IWorldNameable iworldnameable = (IWorldNameable) te;
|
||||
return !iworldnameable.hasCustomName() ? null : iworldnameable.getName();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user