热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

net.minecraft.entity.ai.attributes.AbstractAttributeMap类的使用及代码示例

本文整理了Java中net.minecraft.entity.ai.attributes.AbstractAttributeMap类的一些代码示例,展示了A

本文整理了Java中net.minecraft.entity.ai.attributes.AbstractAttributeMap类的一些代码示例,展示了AbstractAttributeMap类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractAttributeMap类的具体详情如下:
包路径:net.minecraft.entity.ai.attributes.AbstractAttributeMap
类名称:AbstractAttributeMap

AbstractAttributeMap介绍

暂无

代码示例

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private void registerAttributes(EntityPlayer player) {
player.getAttributeMap().registerAttribute(AndroidAttributes.attributeGlitchTime);
player.getAttributeMap().registerAttribute(AndroidAttributes.attributeBatteryUse);
}

代码示例来源:origin: Vazkii/Botania

AbstractAttributeMap attributes = newHorse.getAttributeMap();
IAttributeInstance movementSpeed = attributes.getAttributeInstance(SharedMonsterAttributes.MOVEMENT_SPEED);
movementSpeed.setBaseValue(oldAttributes.getAttributeInstance(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue());
movementSpeed.applyModifier(new AttributeModifier("Ermergerd Virus D:", movementSpeed.getBaseValue(), 0));
IAttributeInstance health = attributes.getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH);
health.setBaseValue(oldAttributes.getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).getBaseValue());
health.applyModifier(new AttributeModifier("Ermergerd Virus D:", health.getBaseValue(), 0));
IAttributeInstance jumpHeight = attributes.getAttributeInstance(AbstractHorse.JUMP_STRENGTH);
jumpHeight.setBaseValue(oldAttributes.getAttributeInstance(AbstractHorse.JUMP_STRENGTH).getBaseValue());
jumpHeight.applyModifier(new AttributeModifier("Ermergerd Virus D:", jumpHeight.getBaseValue() * 0.5, 0));

代码示例来源:origin: Vazkii/Botania

@Override
public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {
if(!player.world.isRemote) {
Multimap attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().applyAttributeModifiers(attributes);
}
}

代码示例来源:origin: SleepyTrousers/EnderIO

private static void handleAttributes(@Nonnull EntityEvent event) {
if (event.getEntity() instanceof EntityPlayer) {
final AbstractAttributeMap map = ((EntityLivingBase) event.getEntity()).getAttributeMap();
if (NullHelper.untrust(map.getAttributeInstance(AOE_XZ)) == null) {
map.registerAttribute(AOE_XZ).setBaseValue(0);
map.registerAttribute(AOE_Y).setBaseValue(0);
map.registerAttribute(AOE_XYZ).setBaseValue(0);
}
}
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

/**
* Refresh the attribute map by removing from the old item and applying the current item
* @param attributeMap the map to refresh
* @param oldItem the old item whose attributes will be removed
* @param currentItem the current item whose attributes will be applied
*/
public static void refreshAttributes(AbstractAttributeMap attributeMap, ItemStack oldItem, ItemStack currentItem) {
if(!oldItem.isEmpty())
attributeMap.removeAttributeModifiers(oldItem.getAttributeModifiers(EntityEquipmentSlot.MAINHAND));
if(!currentItem.isEmpty())
attributeMap.applyAttributeModifiers(currentItem.getAttributeModifiers(EntityEquipmentSlot.OFFHAND));
}

代码示例来源:origin: Vazkii/Botania

@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
if(!player.world.isRemote) {
Multimap attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().removeAttributeModifiers(attributes);
}
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private void applyAttribute(NpcBase npc, String attributeName, double baseValue) {
IAttributeInstance attribute = npc.getAttributeMap().getAttributeInstanceByName(attributeName);
if (attribute != null) {
attribute.setBaseValue(baseValue);
if (attribute.getAttribute() == SharedMonsterAttributes.MAX_HEALTH) {
npc.setHealth((float) baseValue);
}
}
}

代码示例来源:origin: TeamLapen/Vampirism

private void applyEntityAttributes() {
//Checking if already registered, since this method has to be called multiple times due to SpongeForge not recreating the player, but resetting the attribute map
if (player.getAttributeMap().getAttributeInstance(VReference.sunDamage) == null) {
player.getAttributeMap().registerAttribute(VReference.sunDamage).setBaseValue(Balance.vp.SUNDAMAGE_DAMAGE);
}
if (player.getAttributeMap().getAttributeInstance(VReference.bloodExhaustion) == null) {
player.getAttributeMap().registerAttribute(VReference.bloodExhaustion).setBaseValue(Balance.vp.BLOOD_EXHAUSTION_BASIC_MOD);
}
if (player.getAttributeMap().getAttributeInstance(VReference.biteDamage) == null) {
player.getAttributeMap().registerAttribute(VReference.biteDamage).setBaseValue(Balance.vp.BITE_DMG);
}
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public void updateStatModifyers(IBioticStat stat) {
int unlockedLevel = getUnlockedLevel(stat);
Multimap multimap = stat.attributes(this, unlockedLevel);
if (multimap != null) {
if (isAndroid()) {
if (unlockedLevel > 0) {
if (stat.isEnabled(this, unlockedLevel)) {
player.getAttributeMap().applyAttributeModifiers(multimap);
} else {
player.getAttributeMap().removeAttributeModifiers(multimap);
}
} else {
player.getAttributeMap().removeAttributeModifiers(multimap);
}
} else {
player.getAttributeMap().removeAttributeModifiers(multimap);
}
}
}

代码示例来源:origin: Vazkii/Botania

@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
if(!player.world.isRemote) {
Multimap attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().removeAttributeModifiers(attributes);
}
}

代码示例来源:origin: SleepyTrousers/EnderIO

getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(ZooConfig.fallenMountHealth.get());
getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.2);
final IAttributeInstance jumpStrength = getAttributeMap().getAttributeInstanceByName("horse.jumpStrength");
if (jumpStrength != null) {
jumpStrength.setBaseValue(0.5);

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_SPEED);
}

代码示例来源:origin: SleepyTrousers/EnderIO

default void applyAttributes(@Nonnull EntityLivingBase entity, @Nonnull IValue baseHealth, @Nonnull IValue baseAttack) {
entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(baseHealth.get());
IAttributeInstance ai = entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE);
if (NullHelper.untrust(ai) == null) {
entity.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
ai = entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE);
}
ai.setBaseValue(baseAttack.get());
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void onUpdate() {
ItemStack prev = prevWeapon;
ItemStack cur = getHeldItemMainhand();
if (!ItemStack.areItemStacksEqual(cur, prev)) {
if (!prev.isEmpty()) {
getAttributeMap().removeAttributeModifiers(prev.getAttributeModifiers(EntityEquipmentSlot.MAINHAND));
}
if (!cur.isEmpty()) {
getAttributeMap().applyAttributeModifiers(cur.getAttributeModifiers(EntityEquipmentSlot.MAINHAND));
}
prevWeapon = cur.copy();
}
if (chargedLocation != null && chargedLocation.chargeItems(new NNList<>(cur))) {
killerJoe.markDirty();
}
ticksSinceLastSwing++;
}

代码示例来源:origin: Vazkii/Botania

e.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(MAX_HP * playerCount);
if (hard)
e.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ARMOR).setBaseValue(15);

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private void clearAllStatAttributeModifiers() {
for (IBioticStat stat : MatterOverdrive.STAT_REGISTRY.getStats()) {
int unlockedLevel = getUnlockedLevel(stat);
Multimap multimap = stat.attributes(this, unlockedLevel);
if (multimap != null) {
player.getAttributeMap().removeAttributeModifiers(multimap);
}
}
}

代码示例来源:origin: Vazkii/Botania

@Override
public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {
if(!player.world.isRemote) {
Multimap attributes = HashMultimap.create();
fillModifiers(attributes, stack);
player.getAttributeMap().applyAttributeModifiers(attributes);
}
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

/**
* Register the custom attributes
*/
@SubscribeEvent
public void onLivingConstructor(EntityEvent.EntityConstructing constructing){
if(constructing.getEntity() instanceof EntityLivingBase){
AbstractAttributeMap attributeMap = ((EntityLivingBase) constructing.getEntity()).getAttributeMap();
attributeMap.registerAttribute(Attributes.armourPenetrate);
attributeMap.registerAttribute(Attributes.daze);
if(constructing.getEntity() instanceof EntityPlayer){
attributeMap.registerAttribute(Attributes.extendedReach).setBaseValue(-2.2);//Reduce bare hands range
}
attributeMap.registerAttribute(Attributes.attackSpeed);
attributeMap.registerAttribute(Attributes.mountedBonus);
}
}

代码示例来源:origin: CoFH/CoFHCore

@Override
public void onUpdate() {
ItemStack itemstack = previousItem;
ItemStack itemstack1 = getHeldItem(EnumHand.MAIN_HAND);
if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) {
if (!itemstack.isEmpty()) {
getAttributeMap().removeAttributeModifiers(itemstack.getAttributeModifiers(EntityEquipmentSlot.MAINHAND));
}
if (!itemstack1.isEmpty()) {
getAttributeMap().applyAttributeModifiers(itemstack1.getAttributeModifiers(EntityEquipmentSlot.MAINHAND));
}
myName = "[CoFH]" + (!itemstack1.isEmpty() ? " using " + itemstack1.getDisplayName() : "");
}
previousItem = itemstack1.isEmpty() ? ItemStack.EMPTY : itemstack1.copy();
interactionManager.updateBlockRemoving();
//This was commented out beforehand fyi.
//if (itemInUse != null) {
// tickItemInUse(itemstack);
//}
}

代码示例来源:origin: ata4/dragon-mounts

protected double getFollowRange() {
return dragon.getAttributeMap().getAttributeInstance(FOLLOW_RANGE)
.getAttributeValue();
}
}

推荐阅读
author-avatar
史祥旋_247
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有