Search in sources :

Example 1 with ItemAxe

use of net.minecraft.item.ItemAxe in project Minechem by iopleke.

the class AugmentedItem method renderOverlay.

@Override
public void renderOverlay(FontRenderer fontRenderer, TextureManager textureManager, ItemStack itemStack, int left, int top, float z) {
    RenderHelper.enableBlend();
    RenderHelper.setOpacity(1.0F);
    textureManager.bindTexture(TextureMap.locationItemsTexture);
    ItemStack wrappedItemStack = getWrappedItemStack(itemStack);
    if (wrappedItemStack != null) {
        Item wrappedItem = wrappedItemStack.getItem();
        if (wrappedItem instanceof ItemAxe) {
            RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[AXEICON]);
        } else if (wrappedItem instanceof ItemHoe) {
            RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[HOEICON]);
        } else if (wrappedItem instanceof ItemPickaxe) {
            RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[PICKICON]);
        } else if (wrappedItem instanceof ItemSpade) {
            RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[SHOVELICON]);
        } else if (wrappedItem instanceof ItemSword) {
            RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[SWORDICON]);
        } else {
            RenderHelper.drawTexturedRectUV(left, top, z + 10, 16, 16, augmentIcon[DEFAULTICON]);
        }
    }
    RenderHelper.resetOpacity();
    RenderHelper.disableBlend();
}
Also used : ItemSword(net.minecraft.item.ItemSword) Item(net.minecraft.item.Item) EntityItem(net.minecraft.entity.item.EntityItem) WrapperItem(minechem.item.prefab.WrapperItem) ItemAxe(net.minecraft.item.ItemAxe) ItemHoe(net.minecraft.item.ItemHoe) ItemSpade(net.minecraft.item.ItemSpade) ItemPickaxe(net.minecraft.item.ItemPickaxe) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ItemAxe

use of net.minecraft.item.ItemAxe in project Pearcel-Mod by MiningMark48.

the class EntityPearcelBoss method attackEntityAsMob.

@Override
public boolean attackEntityAsMob(Entity entityIn) {
    float f = (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
    int i = 0;
    if (entityIn instanceof EntityLivingBase) {
        f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase) entityIn).getCreatureAttribute());
        i += EnchantmentHelper.getKnockbackModifier(this);
    }
    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);
    if (flag) {
        if (i > 0 && entityIn instanceof EntityLivingBase) {
            ((EntityLivingBase) entityIn).knockBack(this, (float) i * 0.5F, (double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
        }
        int j = EnchantmentHelper.getFireAspectModifier(this);
        if (j > 0) {
            entityIn.setFire(j * 4);
        }
        if (entityIn instanceof EntityPlayer) {
            EntityPlayer entityplayer = (EntityPlayer) entityIn;
            ItemStack itemstack = this.getHeldItemMainhand();
            ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;
            if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD) {
                float f1 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
                if (this.rand.nextFloat() < f1) {
                    entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
                    this.world.setEntityState(entityplayer, (byte) 30);
                }
            }
            entityplayer.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 40, 1, false, true));
            entityplayer.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 60, 0, false, true));
            entityplayer.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 40, 0, false, true));
            entityplayer.addPotionEffect(new PotionEffect(MobEffects.WITHER, 200, 1, false, true));
            entityplayer.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, 100, 0, false, true));
        }
        this.applyEnchantments(this, entityIn);
    }
    return flag;
}
Also used : ItemAxe(net.minecraft.item.ItemAxe) PotionEffect(net.minecraft.potion.PotionEffect) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemAxe (net.minecraft.item.ItemAxe)2 ItemStack (net.minecraft.item.ItemStack)2 WrapperItem (minechem.item.prefab.WrapperItem)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Item (net.minecraft.item.Item)1 ItemHoe (net.minecraft.item.ItemHoe)1 ItemPickaxe (net.minecraft.item.ItemPickaxe)1 ItemSpade (net.minecraft.item.ItemSpade)1 ItemSword (net.minecraft.item.ItemSword)1 PotionEffect (net.minecraft.potion.PotionEffect)1