热门标签 | 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()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 本文详细介绍了 Java 中的 org.apache.hadoop.registry.client.impl.zk.ZKPathDumper 类,提供了丰富的代码示例和使用指南。通过这些示例,读者可以更好地理解如何在实际项目中利用 ZKPathDumper 类进行注册表树的转储操作。 ... [详细]
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • andr ... [详细]
  • 实体映射最强工具类:MapStruct真香 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文详细介绍了如何构建一个高效的UI管理系统,集中处理UI页面的打开、关闭、层级管理和页面跳转等问题。通过UIManager统一管理外部切换逻辑,实现功能逻辑分散化和代码复用,支持多人协作开发。 ... [详细]
  • 本文详细介绍了Java中的访问器(getter)和修改器(setter),探讨了它们在保护数据完整性、增强代码可维护性方面的重要作用。通过具体示例,展示了如何正确使用这些方法来控制类属性的访问和更新。 ... [详细]
  • 并发编程:深入理解设计原理与优化
    本文探讨了并发编程中的关键设计原则,特别是Java内存模型(JMM)的happens-before规则及其对多线程编程的影响。文章详细介绍了DCL双重检查锁定模式的问题及解决方案,并总结了不同处理器和内存模型之间的关系,旨在为程序员提供更深入的理解和最佳实践。 ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • 解决JAX-WS动态客户端工厂弃用问题并迁移到XFire
    在处理Java项目中的JAR包冲突时,我们遇到了JaxWsDynamicClientFactory被弃用的问题,并成功将其迁移到org.codehaus.xfire.client。本文详细介绍了这一过程及解决方案。 ... [详细]
  • dotnet 通过 Elmish.WPF 使用 F# 编写 WPF 应用
    本文来安利大家一个有趣而且强大的库,通过F#和C#混合编程编写WPF应用,可以在WPF中使用到F#强大的数据处理能力在GitHub上完全开源Elmis ... [详细]
  • 本文介绍如何在Linux Mint系统上搭建Rust开发环境,包括安装IntelliJ IDEA、Rust工具链及必要的插件。通过详细步骤,帮助开发者快速上手。 ... [详细]
  • JavaScript 基础语法指南
    本文详细介绍了 JavaScript 的基础语法,包括变量、数据类型、运算符、语句和函数等内容,旨在为初学者提供全面的入门指导。 ... [详细]
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社区 版权所有