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

推荐阅读
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • andr ... [详细]
  • 实体映射最强工具类:MapStruct真香 ... [详细]
  • 本文介绍如何在Linux Mint系统上搭建Rust开发环境,包括安装IntelliJ IDEA、Rust工具链及必要的插件。通过详细步骤,帮助开发者快速上手。 ... [详细]
  • 深入理解Redis的数据结构与对象系统
    本文详细探讨了Redis中的数据结构和对象系统的实现,包括字符串、列表、集合、哈希表和有序集合等五种核心对象类型,以及它们所使用的底层数据结构。通过分析源码和相关文献,帮助读者更好地理解Redis的设计原理。 ... [详细]
  • 本文详细介绍了 Java 中的 org.apache.hadoop.registry.client.impl.zk.ZKPathDumper 类,提供了丰富的代码示例和使用指南。通过这些示例,读者可以更好地理解如何在实际项目中利用 ZKPathDumper 类进行注册表树的转储操作。 ... [详细]
  • XNA 3.0 游戏编程:从 XML 文件加载数据
    本文介绍如何在 XNA 3.0 游戏项目中从 XML 文件加载数据。我们将探讨如何将 XML 数据序列化为二进制文件,并通过内容管道加载到游戏中。此外,还会涉及自定义类型读取器和写入器的实现。 ... [详细]
  • 本文详细介绍了如何构建一个高效的UI管理系统,集中处理UI页面的打开、关闭、层级管理和页面跳转等问题。通过UIManager统一管理外部切换逻辑,实现功能逻辑分散化和代码复用,支持多人协作开发。 ... [详细]
  • 在 Swift 编程中,遇到错误提示“一元运算符 '!' 不能应用于 '()' 类型的操作数”,通常是因为尝试对没有返回值的方法或函数应用逻辑非运算符。本文将详细解释该错误的原因,并提供解决方案。 ... [详细]
  • 本文详细介绍了Java中的访问器(getter)和修改器(setter),探讨了它们在保护数据完整性、增强代码可维护性方面的重要作用。通过具体示例,展示了如何正确使用这些方法来控制类属性的访问和更新。 ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • 解决JAX-WS动态客户端工厂弃用问题并迁移到XFire
    在处理Java项目中的JAR包冲突时,我们遇到了JaxWsDynamicClientFactory被弃用的问题,并成功将其迁移到org.codehaus.xfire.client。本文详细介绍了这一过程及解决方案。 ... [详细]
  • 使用GDI的一些AIP函数我们可以轻易的绘制出简 ... [详细]
  • 本文介绍了Android开发中Intent的基本概念及其在不同Activity之间的数据传递方式,详细展示了如何通过Intent实现Activity间的跳转和数据传输。 ... [详细]
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社区 版权所有