当前位置: 首页>>代码示例>>Java>>正文


Java SharedMonsterAttributes类代码示例

本文整理汇总了Java中net.minecraft.entity.SharedMonsterAttributes的典型用法代码示例。如果您正苦于以下问题:Java SharedMonsterAttributes类的具体用法?Java SharedMonsterAttributes怎么用?Java SharedMonsterAttributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SharedMonsterAttributes类属于net.minecraft.entity包,在下文中一共展示了SharedMonsterAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setChild

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
/**
 * Set whether this zombie is a child.
 */
public void setChild(boolean childZombie)
{
    this.getDataManager().set(IS_CHILD, Boolean.valueOf(childZombie));

    if (this.worldObj != null && !this.worldObj.isRemote)
    {
        IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
        iattributeinstance.removeModifier(BABY_SPEED_BOOST);

        if (childZombie)
        {
            iattributeinstance.applyModifier(BABY_SPEED_BOOST);
        }
    }

    this.setChildSize(childZombie);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityZombie.java

示例2: setChild

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
/**
 * Set whether this zombie is a child.
 */
public void setChild(boolean childZombie)
{
    this.getDataWatcher().updateObject(12, Byte.valueOf((byte)(childZombie ? 1 : 0)));

    if (this.worldObj != null && !this.worldObj.isRemote)
    {
        IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        iattributeinstance.removeModifier(babySpeedBoostModifier);

        if (childZombie)
        {
            iattributeinstance.applyModifier(babySpeedBoostModifier);
        }
    }

    this.setChildSize(childZombie);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:EntityZombie.java

示例3: applyEntityAttributes

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
protected void applyEntityAttributes()
{
    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D);

    if (this.isTamed())
    {
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D);
    }
    else
    {
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(8.0D);
    }

    this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(2.0D);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:EntityWolf.java

示例4: setAttackTarget

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
/**
 * Sets the active target the Task system uses for tracking
 */
public void setAttackTarget(@Nullable EntityLivingBase entitylivingbaseIn)
{
    super.setAttackTarget(entitylivingbaseIn);
    IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);

    if (entitylivingbaseIn == null)
    {
        this.targetChangeTime = 0;
        this.dataManager.set(SCREAMING, Boolean.valueOf(false));
        iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
    }
    else
    {
        this.targetChangeTime = this.ticksExisted;
        this.dataManager.set(SCREAMING, Boolean.valueOf(true));

        if (!iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST))
        {
            iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:EntityEnderman.java

示例5: onExecutionTick

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
@Override
public void onExecutionTick(EntityPlayer player, int progress)
{
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 2F);
	Vec3d look = player.getLookVec().scale(3);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player);
	if (assumedToBeLookedAt != null)
	{
		assumedToBeLookedAt.hurtResistantTime = 0;
		assumedToBeLookedAt.attackEntityFrom(DamageSource.causePlayerDamage(player), Math.max(1, (float) player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() / 10));
		player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 0.1F);
		Vec3d targetPos = assumedToBeLookedAt.getPositionVector();
		player.world.spawnParticle(EnumParticleTypes.CRIT, targetPos.x + player.world.rand.nextDouble() / 2 - player.world.rand.nextDouble() / 2, targetPos.y + assumedToBeLookedAt.getEyeHeight() + player.world.rand.nextDouble() / 2 - player.world.rand.nextDouble() / 2, targetPos.z + player.world.rand.nextDouble() / 2 - player.world.rand.nextDouble() / 2, 0, 0, 0);
		if (!player.world.isRemote)
		{
			ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
			is.damageItem(1, player);
		}
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:23,代码来源:Stab.java

示例6: getItemAttributeModifiers

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
    Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);

    if (equipmentSlot == this.armorType && this.knockbackReduction != 0)
    {
        multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(knockbackUUID, "Knockback modifier", (double)this.knockbackReduction, 0));
    }

    return multimap;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:12,代码来源:ItemArmorTF2.java

示例7: setAttributeModifiers

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
public static void setAttributeModifiers(EntityLivingBase entity, int level)
{
	AttributeModifier attackDamage = new AttributeModifier(ATTACK_DAMAGE, "attackDamage", level * 0.1, 1);
	AttributeModifier maxHealth = new AttributeModifier(MAX_HEALTH, "maxHealth", level * 0.2, 1);
	
	if (!entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).hasModifier(attackDamage))
		entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).applyModifier(attackDamage);
	
	if (!entity.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).hasModifier(maxHealth))
	{
		entity.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).applyModifier(maxHealth);
		entity.setHealth(entity.getMaxHealth());
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:15,代码来源:EventEntityJoinWorld.java

示例8: applyEntityAttributes

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
@Override
protected void applyEntityAttributes() {
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(60.0D);
	this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(15.0D);
	this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0.1D);
	this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3D);
	this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(6.0D);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:10,代码来源:EntitySniper.java

示例9: applyEntityAttributes

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
protected void applyEntityAttributes()
{
    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0D);
    this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(100.0D);
    this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(6.0D);
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:8,代码来源:EntityDummy.java

示例10: unregister

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
public void unregister() {
	Iterator<IRecipe> it = CraftingManager.getInstance().getRecipeList().iterator();
	
	while (it.hasNext()) {
		IRecipe recipe = it.next();
		ItemStack output = recipe.getRecipeOutput();
		if (output != null && output.getItem() != null) {
			if (output.isItemEqual(new ItemStack(Items.IRON_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 6, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.GOLDEN_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 5, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.DIAMOND_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 8, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.WOODEN_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 4, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.STONE_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 5, 0), EntityEquipmentSlot.MAINHAND);
			}
		}
	}
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:31,代码来源:CraftingRegistry.java

示例11: PotionAle

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
public PotionAle() {
    super(false, new Color(125,78,24).getRGB());
    setPotionName("Ale");
    setIconIndex(0,0);
    setBeneficial();
    registerPotionAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE,"6795bd8a-4239-454e-81a1-2d69b1316d66",0.8,2);
    registerPotionAttributeModifier(Attributes.PHYSICAL_DAMAGE_RATE,"caa69b2b-ac4f-42b6-887b-a35d2fcea3c9",0.8,2);
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:9,代码来源:PotionAle.java

示例12: applyEntityAttributes

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
protected void applyEntityAttributes()
{
    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(6.0D);
    this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);
    this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(16.0D);
    this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0D);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:EntityGuardian.java

示例13: attackEntityAsMob

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
public boolean attackEntityAsMob(Entity entityIn)
{
    float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
    int i = 0;

    if (entityIn instanceof EntityLivingBase)
    {
        f += EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)entityIn).getCreatureAttribute());
        i += EnchantmentHelper.getKnockbackModifier(this);
    }

    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

    if (flag)
    {
        if (i > 0)
        {
            entityIn.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F));
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
        }

        int j = EnchantmentHelper.getFireAspectModifier(this);

        if (j > 0)
        {
            entityIn.setFire(j * 4);
        }

        this.applyEnchantments(this, entityIn);
    }

    return flag;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:35,代码来源:EntityMob.java

示例14: attackEntityAsMob

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
public boolean attackEntityAsMob(Entity entityIn)
{
    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)((int)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue()));

    if (flag)
    {
        this.applyEnchantments(this, entityIn);
    }

    return flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:EntityPolarBear.java

示例15: onInitialSpawn

import net.minecraft.entity.SharedMonsterAttributes; //导入依赖的package包/类
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) {
	setItemStackToSlot(this.isLeftHanded() ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND, new ItemStack(HarshenItems.PROPS, 1, 0));
	try {
		setItemStackToSlot(this.isLeftHanded() ? EntityEquipmentSlot.MAINHAND : EntityEquipmentSlot.OFFHAND, new ItemStack(JsonToNBT.getTagFromJson("{id:\"minecraft:shield\",Count:1b,tag:{BlockEntityTag:{Patterns:[{Pattern:\"ss\",Color:6},{Pattern:\"flo\",Color:1}],Base:8}},Damage:0s}")));
	} catch (NBTException e) {
		e.printStackTrace();
	}
       this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, 1));
       this.setLeftHanded(false);
	return livingdata;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:13,代码来源:EntitySoullessKnight.java


注:本文中的net.minecraft.entity.SharedMonsterAttributes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。