mirror of
http://git.eaglercraft.rip/eaglercraft/eaglercraft-1.8.git
synced 2025-04-30 02:01:59 -05:00
23 lines
685 B
Java
23 lines
685 B
Java
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();
|
|
}
|
|
}
|
|
}
|