本文整理汇总了Java中net.minecraft.entity.Entity.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getClass方法的具体用法?Java Entity.getClass怎么用?Java Entity.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.getClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canEntityTick
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static boolean canEntityTick(Entity pEntity,World world){
if(pEntity==null||world.tileentityConfig==null) return false;
if(MinecraftServer.entityConfig.skipEntityTicks.getValue()){
EntityCache eCache=entityCache.get(pEntity.getClass());
if(eCache==null){
String teConfigPath=pEntity.getClass().getName().replace(".","-");
teConfigPath=teConfigPath.replaceAll("[^A-Za-z0-9\\-]",""); // Fix up odd class names to prevent YAML errors
eCache=new EntityCache(pEntity.getClass(),world.getWorldInfo().getWorldName().toLowerCase(),teConfigPath,world.entityConfig.getInt(teConfigPath+".tick-interval",1));
entityCache.put(pEntity.getClass(),eCache);
}
return eCache.tickInterval==1||(eCache.tickInterval>0&&(world.rand.nextInt(eCache.tickInterval)==0)); // rand skip tick
}
return true;
}
示例2: isEntityOnInternalWhitelist
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private static boolean isEntityOnInternalWhitelist(Entity_AA turret, Entity entity)
{
if (entity == turret) { return true; } // Not shooting at myself
else if (entity.getClass() == turret.getClass()) { return true; } // Not shooting at other turrets
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
if (player.getDisplayName().equals(turret.ownerName)) { return true; } // Not shooting at my owner
}
return false;
}
示例3: canHack
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public boolean canHack(Entity entity, EntityPlayer player) {
return entity.getClass() == EntityCow.class;
}
示例4: canHack
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public boolean canHack(Entity entity, EntityPlayer player) {
return entity.getClass() == EntityBat.class;
}
示例5: create
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static MovableEntity create(Entity ent) {
if (ent.getEntityWorld() == null) throw new NullPointerException("ent.getEntityWorld() for the entity " + ent.getClass());
if (ent.getPersistentID() == null) throw new NullPointerException("ent.getPersistentID() for the entity " + ent.getClass());
return new MovableEntity(ent.getEntityWorld().provider.getDimension(), ent.getPersistentID());
}