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


Java EntityEquipmentSlot类代码示例

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


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

示例1: damageShield

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
protected void damageShield(float damage)
{
    if (damage >= 3.0F && this.activeItemStack.getItem() == Items.SHIELD)
    {
        int i = 1 + MathHelper.floor(damage);
        this.activeItemStack.damageItem(i, this);

        if (this.activeItemStack.func_190926_b())
        {
            EnumHand enumhand = this.getActiveHand();

            if (enumhand == EnumHand.MAIN_HAND)
            {
                this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, ItemStack.field_190927_a);
            }
            else
            {
                this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.field_190927_a);
            }

            this.activeItemStack = ItemStack.field_190927_a;
            this.playSound(SoundEvents.ITEM_SHIELD_BREAK, 0.8F, 0.8F + this.world.rand.nextFloat() * 0.4F);
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:26,代码来源:EntityPlayer.java

示例2: getAttributeModifiers

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
	Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);

	if (slot == EntityEquipmentSlot.MAINHAND && getData(stack) != ItemFromData.BLANK_DATA && stack.hasTagCompound()) {
		int heads=Math.min((int)TF2Attribute.getModifier("Kill Count", stack, 0, null), stack.getTagCompound().getInteger("Heads"));
		multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
				new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier",
						this.getWeaponDamage(stack, null, null) * this.getWeaponPelletCount(stack, null) - 1, 0));
		multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(
				ATTACK_SPEED_MODIFIER, "Weapon modifier", -4 + (1000D / this.getFiringSpeed(stack, null)), 0));
		float addHealth = TF2Attribute.getModifier("Health", stack, 0, null)+heads * TF2Attribute.getModifier("Max Health Kill", stack, 0, null);
		if (addHealth != 0)
			multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(),
					new AttributeModifier(HEALTH_MODIFIER, "Weapon modifier", addHealth, 0));
		float addSpeed = TF2Attribute.getModifier("Speed", stack, 1 + heads * TF2Attribute.getModifier("Speed Kill", stack, 0, null), null);
		if (addSpeed != 1)
			multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(),
					new AttributeModifier(SPEED_MODIFIER, "Weapon modifier", addSpeed - 1, 2));
	}
	return multimap;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:23,代码来源:ItemWeapon.java

示例3: addAttributeModifier

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
public void addAttributeModifier(String attributeName, AttributeModifier modifier, EntityEquipmentSlot equipmentSlot)
{
    if (this.stackTagCompound == null)
    {
        this.stackTagCompound = new NBTTagCompound();
    }

    if (!this.stackTagCompound.hasKey("AttributeModifiers", 9))
    {
        this.stackTagCompound.setTag("AttributeModifiers", new NBTTagList());
    }

    NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);
    NBTTagCompound nbttagcompound = SharedMonsterAttributes.writeAttributeModifierToNBT(modifier);
    nbttagcompound.setString("AttributeName", attributeName);

    if (equipmentSlot != null)
    {
        nbttagcompound.setString("Slot", equipmentSlot.getName());
    }

    nbttaglist.appendTag(nbttagcompound);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:ItemStack.java

示例4: distributeDamage

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
@Override
public float distributeDamage(float damage, @Nonnull EntityPlayer player, @Nonnull DamageSource source, boolean addStat) {
    AbstractPlayerDamageModel damageModel = PlayerDataManager.getDamageModel(player);
    for (Pair<EntityEquipmentSlot, EnumPlayerPart[]> pair : getPartList()) {
        EntityEquipmentSlot slot = pair.getLeft();
        damage = ArmorUtils.applyArmor(player, player.getItemStackFromSlot(slot), source, damage, slot);
        if (damage <= 0F)
            return 0F;
        damage = ArmorUtils.applyEnchantmentModifiers(player.getItemStackFromSlot(slot), source, damage);
        if (damage <= 0F)
            return 0F;

        damage = distributeDamageOnParts(damage, damageModel, pair.getRight(), player, addStat);
        if (damage == 0F)
            break;
    }
    return damage;
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:19,代码来源:DamageDistribution.java

示例5: onStruckByLightning

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.world.isRemote && !this.isDead)
    {
        EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
        entitypigzombie.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
        entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitypigzombie.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitypigzombie.setCustomNameTag(this.getCustomNameTag());
            entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.world.spawnEntityInWorld(entitypigzombie);
        this.setDead();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:EntityPig.java

示例6: getSearchedItemCount

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
private int getSearchedItemCount() {
        TileEntity te = world.getTileEntity(pos);
        if (te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)) {
//        if (world.getTileEntity(pos) instanceof IInventory) {
            IItemHandler handler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
            int itemCount = 0;
//            IInventory inventory = (IInventory) world.getTileEntity(pos);
            ItemStack searchStack = ItemPneumaticArmor.getSearchedStack(FMLClientHandler.instance().getClient().player.getItemStackFromSlot(EntityEquipmentSlot.HEAD));
            if (searchStack.isEmpty()) return 0;
            for (int l = 0; l < handler.getSlots(); l++) {
                if (!handler.getStackInSlot(l).isEmpty()) {
                    itemCount += getSearchedItemCount(handler.getStackInSlot(l), searchStack);
                }
            }
            return itemCount;
        }
        return 0;
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:RenderSearchItemBlock.java

示例7: setPlayerItemStackInHand

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
public static void setPlayerItemStackInHand(ItemStack stack, EntityPlayer player, EnumHand hand)
{

	// okay, find the itemstack
	if (hand == EnumHand.MAIN_HAND)
	{
		player.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, stack);
	}
	else if (hand == EnumHand.OFF_HAND)
	{
		player.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, stack);
	}
	else
	{
		// uhh... what?
		Util.logger.error("Found invalid EnumHand value!");
	}

}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:20,代码来源:Util.java

示例8: createSkeleton

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
    EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
    entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
    entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
    entityskeleton.hurtResistantTime = 60;
    entityskeleton.enablePersistence();

    if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
    {
        entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
    }

    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
    return entityskeleton;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:EntityAISkeletonRiders.java

示例9: ItemCGArmor

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
public ItemCGArmor(String id, ArmorMaterial armorMaterial, String armorName, int renderIndex, EntityEquipmentSlot armorType)
{
	super(armorMaterial, renderIndex, armorType);

	this.armorName = armorName;
	this.itemClass = EnumItemClass.MEDIUM_ARMOR;
	this.isAirMask = false;
	this.minAirToStartRefil = 0;
	this.rarity = EnumRarity.COMMON;
	
	setUnlocalizedName(id);
	
	ItemsCG.registerItem(this, new ResourceLocation(ModInfo.MODID, id)); // Put into registry.

	if (CompositeGear.ic2Tab != null) {
		setCreativeTab(CompositeGear.ic2Tab);
	}
}
 
开发者ID:TwilightWingsStudio,项目名称:CompositeGear,代码行数:19,代码来源:ItemCGArmor.java

示例10: getEntityEquipment

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
@Nullable
public Iterable<ItemStack> getEntityEquipment(EntityLivingBase entityIn)
{
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (EntityEquipmentSlot entityequipmentslot : this.applicableEquipmentTypes)
    {
        ItemStack itemstack = entityIn.getItemStackFromSlot(entityequipmentslot);

        if (itemstack != null)
        {
            list.add(itemstack);
        }
    }

    return list.size() > 0 ? list : null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:Enchantment.java

示例11: apply

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
public ItemStack apply(ItemStack stack, Random rand, LootContext context)
{
    for (SetAttributes.Modifier setattributes$modifier : this.modifiers)
    {
        UUID uuid = setattributes$modifier.uuid;

        if (uuid == null)
        {
            uuid = UUID.randomUUID();
        }

        EntityEquipmentSlot entityequipmentslot = setattributes$modifier.slots[rand.nextInt(setattributes$modifier.slots.length)];
        stack.addAttributeModifier(setattributes$modifier.attributeName, new AttributeModifier(uuid, setattributes$modifier.modifierName, (double)setattributes$modifier.amount.generateFloat(rand), setattributes$modifier.operation), entityequipmentslot);
    }

    return stack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:SetAttributes.java

示例12: onItemRightClick

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack);
    ItemStack itemstack1 = worldIn.getItemStackFromSlot(entityequipmentslot);

    if (itemstack1.func_190926_b())
    {
        worldIn.setItemStackToSlot(entityequipmentslot, itemstack.copy());
        itemstack.func_190920_e(0);
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemstack);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:ItemArmor.java

示例13: getAttributeModifiers

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot,
		ItemStack stack) {
	Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);

	if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
		multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
				new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) 3.0F, 0));
		multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(),
				new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double) -3F, 0));
	}

	return multimap;
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:15,代码来源:ItemRock.java

示例14: getAttributeModifiers

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) 
{
	final Multimap<String, AttributeModifier> modifiers = super.getAttributeModifiers(slot, stack);

	if (slot == EntityEquipmentSlot.MAINHAND) 
	{
		replaceModifier(modifiers, SharedMonsterAttributes.ATTACK_DAMAGE, ATTACK_DAMAGE_MODIFIER, damageMultiplier);
		replaceModifier(modifiers, SharedMonsterAttributes.ATTACK_SPEED, ATTACK_SPEED_MODIFIER, speedMultiplier);
	}

	return modifiers;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:14,代码来源:ItemLEAdvancedMelee.java

示例15: renderWorldLastEvent

import net.minecraft.inventory.EntityEquipmentSlot; //导入依赖的package包/类
@SubscribeEvent
public void renderWorldLastEvent(RenderWorldLastEvent event) {
    if (!GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) return;
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.player;
    double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks();
    double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks();
    double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks();

    GL11.glPushMatrix();
    GL11.glTranslated(-playerX, -playerY, -playerZ);
    ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
        if (((IPressurizable) helmetStack.getItem()).getPressure(helmetStack) > 0F) {
            CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
            if (comHudHandler.ticksExisted > comHudHandler.getStartupTime()) {

                GL11.glDisable(GL11.GL_TEXTURE_2D);

                for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
                    if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked)
                        UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).render3D(event.getPartialTicks());
                }

                GL11.glEnable(GL11.GL_TEXTURE_2D);

            }
        }
    }
    GL11.glPopMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:32,代码来源:HUDHandler.java


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