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();
}
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;
}
Aggregations