本文整理匯總了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());
}