当前位置: 首页>>代码示例>>Java>>正文


Java Ageable.setAgeLock方法代码示例

本文整理汇总了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);
}
 
开发者ID:CodingBadgers,项目名称:MineKart,代码行数:19,代码来源:AgeableMountData.java

示例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);
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:10,代码来源:EntityWrapper.java

示例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);
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:10,代码来源:EntityWrapper.java

示例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;
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:13,代码来源:AgeableAnimal.java

示例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;
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:59,代码来源:LivingEntityShop.java


注:本文中的org.bukkit.entity.Ageable.setAgeLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。