當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。