本文整理汇总了Java中net.minecraft.tileentity.TileEntity.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntity.getClass方法的具体用法?Java TileEntity.getClass怎么用?Java TileEntity.getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntity
的用法示例。
在下文中一共展示了TileEntity.getClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canTileEntityTick
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public static boolean canTileEntityTick(TileEntity tileEntity, World world)
{
if (tileEntity == null || world.tileentityConfig == null) return false;
if (MinecraftServer.tileEntityConfig.skipTileEntityTicks.getValue())
{
TileEntityCache teCache = tileEntityCache.get(tileEntity.getClass());
if (teCache == null)
{
String teConfigPath = tileEntity.getClass().getName().replace(".", "-");
teConfigPath = teConfigPath.replaceAll("[^A-Za-z0-9\\-]", ""); // Fix up odd class names to prevent YAML errors
teCache = new TileEntityCache(tileEntity.getClass(), world.getWorldInfo().getWorldName().toLowerCase(), teConfigPath, world.tileentityConfig.getBoolean(teConfigPath + ".tick-no-players", false), world.tileentityConfig.getInt(teConfigPath + ".tick-interval", 1));
tileEntityCache.put(tileEntity.getClass(), teCache);
}
// Tick with no players near?
if (!teCache.tickNoPlayers && !world.isActiveBlockCoord(tileEntity.xCoord, tileEntity.zCoord))
{
return false;
}
return teCache.tickInterval==1||(teCache.tickInterval>0&&(world.rand.nextInt(teCache.tickInterval)==0)); // rand skip tick
}
return true;
}
示例2: create
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public static Tile create(TileEntity tile) {
if (tile.getWorld() == null) throw new NullPointerException("tile.getWorld() for the tile " + tile.getClass());
if (tile.getPos() == null) throw new NullPointerException("tile.getPos() for the tile " + tile.getClass());
return new Tile(tile.getWorld().provider.getDimension(), tile.getPos());
}