本文整理汇总了Java中org.bukkit.entity.Ageable.setAgeLock方法的典型用法代码示例。如果您正苦于以下问题:Java Ageable.setAgeLock方法的具体用法?Java Ageable.setAgeLock怎么用?Java Ageable.setAgeLock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Ageable
的用法示例。
在下文中一共展示了Ageable.setAgeLock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyMountData
import org.bukkit.entity.Ageable; //导入方法依赖的package包/类
@Override
public void applyMountData(Entity entity) {
super.applyMountData(entity);
if (!(entity instanceof Ageable)) {
return;
}
Ageable ageable = (Ageable) entity;
if (adult) {
ageable.setAdult();
} else {
ageable.setBaby();
}
ageable.setAgeLock(true);
}
示例2: restoreAgeable
import org.bukkit.entity.Ageable; //导入方法依赖的package包/类
private void restoreAgeable(final Ageable entity) {
if (!this.aged.adult) {
entity.setBaby();
}
if (this.aged.locked) {
entity.setAgeLock(this.aged.locked);
}
entity.setAge(this.aged.age);
}
示例3: restoreAgeable
import org.bukkit.entity.Ageable; //导入方法依赖的package包/类
private void restoreAgeable(Ageable entity) {
if (!this.aged.adult) {
entity.setBaby();
}
entity.setAgeLock(this.aged.locked);
if (this.aged.age > 0) {
entity.setAge(this.aged.age);
}
}
示例4: apply
import org.bukkit.entity.Ageable; //导入方法依赖的package包/类
@Override
public boolean apply(Entity entity) {
PreCon.notNull(entity);
PreCon.isValid(entity instanceof Ageable, "org.bukkit.entity.Ageable expected.");
Ageable ageable = (Ageable)entity;
ageable.setAge(_age);
ageable.setAgeLock(_ageLock);
return true;
}
示例5: spawn
import org.bukkit.entity.Ageable; //导入方法依赖的package包/类
@Override
public boolean spawn() {
// check if our current old entity is still valid:
if (this.isActive()) return true;
if (entity != null) {
// clean up metadata before replacing the currently stored entity with a new one:
this.removeShopkeeperMetadata(entity);
}
// prepare location:
World world = Bukkit.getWorld(shopkeeper.getWorldName());
Location location = new Location(world, shopkeeper.getX() + 0.5D, shopkeeper.getY() + 0.5D, shopkeeper.getZ() + 0.5D);
// find old shopkeeper entity, else spawn a new one:
if (!this.searchOldEntity(location)) {
// TODO check if the block is passable before spawning there?
// try to bypass entity-spawn blocking plugins:
EntityType entityType = this.getEntityType();
ShopkeepersPlugin.getInstance().forceCreatureSpawn(location, entityType);
entity = (LivingEntity) world.spawnEntity(location, entityType);
uuid = entity.getUniqueId().toString();
}
if (this.isActive()) {
// assign metadata for easy identification by other plugins:
this.assignShopkeeperMetadata(entity);
this.setName(shopkeeper.getName());
// configure some entity attributes:
entity.eject(); // some entities might automatically mount on nearby entities (like baby zombies on chicken)
entity.setRemoveWhenFarAway(false);
entity.setCanPickupItems(false);
// disable breeding:
if (entity instanceof Ageable) {
Ageable ageable = ((Ageable) entity);
ageable.setBreed(false);
ageable.setAgeLock(true);
}
// remove potion effects:
for (PotionEffect potionEffect : entity.getActivePotionEffects()) {
entity.removePotionEffect(potionEffect.getType());
}
// overwrite AI:
this.overwriteAI();
// apply sub type:
this.applySubType();
// success:
return true;
} else {
// failure:
entity = null;
return false;
}
}