下面列出了org.bukkit.entity.AbstractHorse#net.minecraft.entity.boss.EntityWither 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static Entity newNyanEntity(World world) {
final int nextInt = random.nextInt(100);
if(nextInt < 25) {
return new EntityCow(world);
}
if(nextInt < 50) {
return new EntityOvergrownSheep(world);
}
if(nextInt < 75) {
return new EntityExplodingChicken(world);
}
if(nextInt < 95) {
return new EntityOcelot(world);
}
if(nextInt < 99) {
return new EntityGiantZombie(world);
}
return new EntityWither(world);
}
public boolean setLeashHolder(Entity holder) {
if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityLiving)) {
return false;
}
if (holder == null) {
return unleash();
}
if (holder.isDead()) {
return false;
}
unleash();
((EntityLiving) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
return true;
}
/**
* These entities are excluded from Activation range checks.
*
* @param entity
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) {
if (config == null && DimensionManager.getWorld(0) != null) {
config = DimensionManager.getWorld(0).spigotConfig;
} else {
return true;
}
return ((entity.activationType == 3 && config.miscActivationRange == 0)
|| (entity.activationType == 2 && config.animalActivationRange == 0)
|| (entity.activationType == 1 && config.monsterActivationRange == 0)
|| entity instanceof EntityPlayer
|| entity instanceof EntityThrowable
|| entity instanceof MultiPartEntityPart
|| entity instanceof EntityWither
|| entity instanceof EntityFireball
|| entity instanceof EntityFallingBlock
|| entity instanceof EntityWeatherEffect
|| entity instanceof EntityTNTPrimed
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworkRocket
|| (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.CREATURE, false))
&& !entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !entity.isCreatureType(EnumCreatureType.MONSTER, false)
&& !entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false)
);
}
/**
* These entities are excluded from Activation range checks.
*
* @param entity
* @param world
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
// Cauldron start - another fix for Proxy Worlds
if (config == null && DimensionManager.getWorld(0) != null)
{
config = DimensionManager.getWorld(0).spigotConfig;
}
else
{
return true;
}
// Cauldron end
if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|| ( entity.activationType == 2 && config.animalActivationRange == 0 )
|| ( entity.activationType == 1 && config.monsterActivationRange == 0 )
|| (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
|| entity instanceof EntityThrowable
|| entity instanceof EntityDragon
|| entity instanceof EntityDragonPart
|| entity instanceof EntityWither
|| entity instanceof EntityFireball
|| entity instanceof EntityWeatherEffect
|| entity instanceof EntityTNTPrimed
|| entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworkRocket
|| entity instanceof EntityVillager
// Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
|| (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
&& !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
&& !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
{
return true;
}
return false;
}
public CraftWither(CraftServer server, EntityWither entity) {
super(server, entity);
}
@Override
public EntityWither getHandle() {
return (EntityWither) entity;
}