本文整理汇总了Java中net.minecraft.entity.ai.attributes.BaseAttributeMap类的典型用法代码示例。如果您正苦于以下问题:Java BaseAttributeMap类的具体用法?Java BaseAttributeMap怎么用?Java BaseAttributeMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseAttributeMap类属于net.minecraft.entity.ai.attributes包,在下文中一共展示了BaseAttributeMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_151475_a
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
for (int i = 0; i < p_151475_1_.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));
if (iattributeinstance != null)
{
applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
}
else
{
logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
}
}
}
示例2: applyAttributesModifiersToEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public void applyAttributesModifiersToEntity(EntityLivingBase p_111185_1_, BaseAttributeMap p_111185_2_, int p_111185_3_)
{
Iterator iterator = this.field_111188_I.entrySet().iterator();
while (iterator.hasNext())
{
Entry entry = (Entry)iterator.next();
IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());
if (iattributeinstance != null)
{
AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
iattributeinstance.removeModifier(attributemodifier);
iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + p_111185_3_, this.func_111183_a(p_111185_3_, attributemodifier), attributemodifier.getOperation()));
}
}
}
示例3: rateDamage
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public static double rateDamage(ItemStack is)
{
if (is == null) {
return 0.0D;
}
Multimap attrs = is.getItem().getAttributeModifiers(is);
if (attrs == null) {
return 0.0D;
}
BaseAttributeMap test = new ServersideAttributeMap();
test.applyAttributeModifiers(attrs);
IAttributeInstance attr = test.getAttributeInstance(SharedMonsterAttributes.attackDamage);
if (attr == null) {
return 0.0D;
}
return attr.getAttributeValue();
}
示例4: func_151475_a
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
for (int var2 = 0; var2 < p_151475_1_.tagCount(); ++var2)
{
NBTTagCompound var3 = p_151475_1_.getCompoundTagAt(var2);
IAttributeInstance var4 = p_151475_0_.getAttributeInstanceByName(var3.getString("Name"));
if (var4 != null)
{
applyModifiersToAttributeInstance(var4, var3);
}
else
{
logger.warn("Ignoring unknown attribute \'" + var3.getString("Name") + "\'");
}
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:18,代码来源:SharedMonsterAttributes.java
示例5: applyAttributesModifiersToEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3)
{
Iterator var4 = this.field_111188_I.entrySet().iterator();
while (var4.hasNext())
{
Entry var5 = (Entry)var4.next();
IAttributeInstance var6 = par2BaseAttributeMap.getAttributeInstance((IAttribute)var5.getKey());
if (var6 != null)
{
AttributeModifier var7 = (AttributeModifier)var5.getValue();
var6.removeModifier(var7);
var6.applyModifier(new AttributeModifier(var7.getID(), this.getName() + " " + par3, this.func_111183_a(par3, var7), var7.getOperation()));
}
}
}
示例6: applyAttributesModifiersToEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
@Override
public void applyAttributesModifiersToEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) {
super.applyAttributesModifiersToEntity(entity, attrMap, amplifier);
if(entity instanceof EntityGolemBase) {
EntityGolemBase golem = (EntityGolemBase) entity;
IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
if(inst.getModifier(SPEED_INC_PERCENT.getID()) != null) {
inst.applyModifier(SPEED_INC_PERCENT);
}
inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth);
if(inst.getModifier(HEALTH_INC_PERCENT.getID()) != null) {
inst.applyModifier(HEALTH_INC_PERCENT);
}
inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage);
if(inst.getModifier(DAMAGE_INC_PERCENT.getID()) != null) {
inst.applyModifier(DAMAGE_INC_PERCENT);
}
}
}
示例7: removeAttributesModifiersFromEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
@Override
public void removeAttributesModifiersFromEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) {
super.removeAttributesModifiersFromEntity(entity, attrMap, amplifier);
if(entity instanceof EntityGolemBase) {
EntityGolemBase golem = (EntityGolemBase) entity;
IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
if(inst.getModifier(SPEED_INC_PERCENT.getID()) != null) {
inst.removeModifier(SPEED_INC_PERCENT);
}
inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth);
if(inst.getModifier(HEALTH_INC_PERCENT.getID()) != null) {
inst.removeModifier(HEALTH_INC_PERCENT);
}
inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage);
if(inst.getModifier(DAMAGE_INC_PERCENT.getID()) != null) {
inst.removeModifier(DAMAGE_INC_PERCENT);
}
}
}
示例8: func_111260_a
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public static void func_111260_a(BaseAttributeMap par0BaseAttributeMap, NBTTagList par1NBTTagList, ILogAgent par2ILogAgent)
{
for (int i = 0; i < par1NBTTagList.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = (NBTTagCompound)par1NBTTagList.tagAt(i);
AttributeInstance attributeinstance = par0BaseAttributeMap.getAttributeInstanceByName(nbttagcompound.getString("Name"));
if (attributeinstance != null)
{
func_111258_a(attributeinstance, nbttagcompound);
}
else if (par2ILogAgent != null)
{
par2ILogAgent.logWarning("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
}
}
}
示例9: applyAttributesModifiersToEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3)
{
Iterator iterator = this.field_111188_I.entrySet().iterator();
while (iterator.hasNext())
{
Entry entry = (Entry)iterator.next();
AttributeInstance attributeinstance = par2BaseAttributeMap.getAttributeInstance((Attribute)entry.getKey());
if (attributeinstance != null)
{
AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
attributeinstance.removeModifier(attributemodifier);
attributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + par3, this.func_111183_a(par3, attributemodifier), attributemodifier.getOperation()));
}
}
}
示例10: getAttributeMap
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public BaseAttributeMap getAttributeMap()
{
if (this.attributeMap == null)
{
this.attributeMap = new ServersideAttributeMap();
}
return this.attributeMap;
}
示例11: writeBaseAttributeMapToNBT
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
/**
* Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
*/
public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_)
{
NBTTagList nbttaglist = new NBTTagList();
for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes())
{
nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
}
return nbttaglist;
}
示例12: removeAttributesModifiersFromEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
{
IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey());
if (iattributeinstance != null)
{
iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
}
}
}
示例13: applyAttributesModifiersToEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier)
{
for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
{
IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());
if (iattributeinstance != null)
{
AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
iattributeinstance.removeModifier(attributemodifier);
iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation()));
}
}
}
示例14: removeAttributesModifiersFromEntity
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
super.removeAttributesModifiersFromEntity(entityLivingBaseIn, p_111187_2_, amplifier);
if (entityLivingBaseIn.getHealth() > entityLivingBaseIn.getMaxHealth())
{
entityLivingBaseIn.setHealth(entityLivingBaseIn.getMaxHealth());
}
}
示例15: handleEntityProperties
import net.minecraft.entity.ai.attributes.BaseAttributeMap; //导入依赖的package包/类
/**
* Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
* sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
* maxHealth and knockback resistance as well as reinforcement spawning chance.
*/
public void handleEntityProperties(S20PacketEntityProperties packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null)
{
if (!(entity instanceof EntityLivingBase))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
}
else
{
BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap();
for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
{
IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());
if (iattributeinstance == null)
{
iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute)null, s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
iattributeinstance.removeAllModifiers();
for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
{
iattributeinstance.applyModifier(attributemodifier);
}
}
}
}
}