Jump to content

Friend2Creepers

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Friend2Creepers

  1. I have been trying to make an item which creates a sword swipe surrounding you on a right click, although it seems like there is no defined sword swipe. Where is the location, how do i use it, etc.
  2. Would there be a way to almost immediatley have it setDead through the item code?
  3. First of all, yes i still mod in 1.11.2 Second of all, I have been trying to create an item that does lots of damage when you right click, though my code says [see title.] Here is my code: package slagle.adventuremod.item; import slagle.adventuremod.BaseMod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.world.World; //advmod public class ItemAssassinsKnife extends ItemSword { public final static String name="knife"; public ItemAssassinsKnife() { super(ItemMod.PhaKni); this.setUnlocalizedName(BaseMod.MODID+"_"+name); this.setCreativeTab(CreativeTabs.COMBAT); // TODO Auto-generated constructor stub } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (!worldIn.isRemote){ EntityArrow entitySwipe=new EntityArrow(worldIn,playerIn); entitySwipe.setAim(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.0F, 0.0F); worldIn.spawnEntity(entitySwipe); } return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); // TODO make it do damage } }
  4. I've been working on a "assassin's knife" for a while, the main idea being if you get very close to a mob you can do around ~50 damage. Unfortuanatley I don't exactly know how to do this. I would love some help with finding a way to make this close range attack work. here is my code: package com.idtech.item; import com.idtech.BaseMod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.world.World; //advmod public class ItemAssassinsKnife extends ItemSword { public final static String name="knife"; public ItemAssassinsKnife() { super(ItemMod.PhaKni); this.setUnlocalizedName(BaseMod.MODID+"_"+name); this.setCreativeTab(CreativeTabs.COMBAT); // TODO Auto-generated constructor stub } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (!worldIn.isRemote){ EntitySnowball entitySwipe=new EntitySnowball(worldIn,playerIn); entitySwipe.setHeadingFromThrower( playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntity(entitySwipe); // TODO placeholder } return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } }
  5. So I'm new to the community, and I've been modding with 1.11.2 for a bit. I have looked on the forums for answers but most of the pages on it were outdated. Here is my question: How do I detect damage dealt be a player wearing armor and effect the player with life boost based on the damage value? Here is my current code: import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ItemAncientArmor extends ItemArmor { public final String name; public ItemAncientArmor(ArmorMaterial material, int renderIndex, EntityEquipmentSlot armorType, String name) { super(material, renderIndex, armorType); this.name = name; this.setUnlocalizedName(BaseMod.MODID + "_" + name); this.setCreativeTab(CreativeTabs.COMBAT); } public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { if(slot == EntityEquipmentSlot.LEGS){ return "examplemod:textures/models/armor/ancientarmor2.png"; } return "examplemod:textures/models/armor/ancientarmor1.png"; } public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (itemStack.getItem() == ItemMod.ancientHelmet || itemStack.getItem() == ItemMod.ancientChestplate || itemStack.getItem() == ItemMod.ancientLeggings || itemStack.getItem() == ItemMod.ancientBoots) { if (player.isAirBorne) { player.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("resistance"), 1, 5)); player.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("strength"), 1, 5)); } /* public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float amount) { super(entity); this.source = source; this.amount = amount; // TODO make player get health boost based on damage output //LivingHurtEvent float damage? player.addPotionEffect... boost"), 5, damage));? } */ /* TODO make player get health boost based on damage output new AttackEntityEvent(player, player) { super(player); this.target = target; } */
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.