Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ButterAleks.RandomIdeas.items.tools;
- import com.ButterAleks.RandomIdeas.items.ItemBase;
- import net.minecraft.entity.item.EntityTNTPrimed;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.ActionResult;
- import net.minecraft.util.EnumActionResult;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.EnumHand;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.math.Vec3d;
- import net.minecraft.world.World;
- public class RightClickTest extends ItemBase
- {
- public RightClickTest(String name)
- {
- super(name);
- }
- @Override
- public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
- {
- ItemStack item = playerIn.getHeldItem(handIn);
- //For firing
- Vec3d aim = playerIn.getLookVec();
- EntityTNTPrimed tnt = new EntityTNTPrimed(worldIn, 3, 3, 3, playerIn);
- tnt.setPosition(playerIn.posX + aim.x * 1.5D, playerIn.posY + aim.y * 1.5D, playerIn.posZ + aim.z * 1.5D);
- worldIn.spawnEntity(tnt);
- tnt.motionX = aim.x * 0.1; tnt.motionY = aim.y * 0.1; tnt.motionZ = aim.z * 0.1;
- item.damageItem(1, playerIn);
- return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, item);
- }
- //If you want to be used on a block
- //@Override
- //public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
- //{
- //return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
- //}
- }
- package com.ButterAleks.RandomIdeas.items.tools;
- import com.ButterAleks.RandomIdeas.items.ItemBase;
- import net.minecraft.entity.item.EntityTNTPrimed;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.ActionResult;
- import net.minecraft.util.EnumActionResult;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.EnumHand;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.math.Vec3d;
- import net.minecraft.world.World;
- public class RightClickTest extends ItemBase
- {
- public RightClickTest(String name)
- {
- super(name);
- }
- @Override
- public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
- {
- ItemStack item = playerIn.getHeldItem(handIn);
- //For firing
- Vec3d aim = playerIn.getLookVec();
- EntityTNTPrimed tnt = new EntityTNTPrimed(worldIn, 3, 3, 3, playerIn);
- tnt.setPosition(playerIn.posX + aim.x * 1.5D, playerIn.posY + aim.y * 1.5D, playerIn.posZ + aim.z * 1.5D);
- worldIn.spawnEntity(tnt);
- tnt.motionX = aim.x * 0.1; tnt.motionY = aim.y * 0.1; tnt.motionZ = aim.z * 0.1;
- item.damageItem(1, playerIn);
- return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, item);
- }
- //If you want to be used on a block
- //@Override
- //public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
- //{
- //return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement