热门标签 | 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();
}
}

推荐阅读
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 本文介绍了一个Java猜拳小游戏的代码,通过使用Scanner类获取用户输入的拳的数字,并随机生成计算机的拳,然后判断胜负。该游戏可以选择剪刀、石头、布三种拳,通过比较两者的拳来决定胜负。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文介绍了Java高并发程序设计中线程安全的概念与synchronized关键字的使用。通过一个计数器的例子,演示了多线程同时对变量进行累加操作时可能出现的问题。最终值会小于预期的原因是因为两个线程同时对变量进行写入时,其中一个线程的结果会覆盖另一个线程的结果。为了解决这个问题,可以使用synchronized关键字来保证线程安全。 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • Java中包装类的设计原因以及操作方法
    本文主要介绍了Java中设计包装类的原因以及操作方法。在Java中,除了对象类型,还有八大基本类型,为了将基本类型转换成对象,Java引入了包装类。文章通过介绍包装类的定义和实现,解答了为什么需要包装类的问题,并提供了简单易用的操作方法。通过本文的学习,读者可以更好地理解和应用Java中的包装类。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文介绍了Swing组件的用法,重点讲解了图标接口的定义和创建方法。图标接口用来将图标与各种组件相关联,可以是简单的绘画或使用磁盘上的GIF格式图像。文章详细介绍了图标接口的属性和绘制方法,并给出了一个菱形图标的实现示例。该示例可以配置图标的尺寸、颜色和填充状态。 ... [详细]
  • Android系统源码分析Zygote和SystemServer启动过程详解
    本文详细解析了Android系统源码中Zygote和SystemServer的启动过程。首先介绍了系统framework层启动的内容,帮助理解四大组件的启动和管理过程。接着介绍了AMS、PMS等系统服务的作用和调用方式。然后详细分析了Zygote的启动过程,解释了Zygote在Android启动过程中的决定作用。最后通过时序图展示了整个过程。 ... [详细]
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社区 版权所有