Advertisement
Guest User

PowerTool

a guest
Jan 12th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. public class AirStrikeI extends Item {
  2.     public AirStrikeI() {
  3.         super();
  4.         this.setCreativeTab(CreativeTabs.tabMisc);
  5.         this.setUnlocalizedName("airStrike1");
  6.         // Chick this
  7.         this.setTextureName(Main.MODID + ":" + "LightningSword");
  8.     }
  9.    
  10.     boolean active = false;
  11.    
  12.     public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
  13.     {
  14.         active = true;
  15.         return stack;
  16.     }
  17.    
  18.     public void onUpdate(ItemStack stack, World world, Entity player, int p_77663_4_, boolean p_77663_5_) {
  19.         //Block target = null;
  20.         int i = 0, j = 0, k = 0;
  21.         boolean gotTarget = false;
  22.         if (active) {
  23.             MovingObjectPosition mop = Minecraft.getMinecraft().renderViewEntity.rayTrace(200, 1.0F);
  24.             if(mop != null) {
  25.                 i = mop.blockX;
  26.                 j = mop.blockY;
  27.                 k = mop.blockZ;
  28.                 gotTarget = true;
  29.                 //int blockHitSide = mop.sideHit;
  30.                 //target = mop.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
  31.             }
  32.             active = false;
  33.             //Block event = Infos.getPointingBlock();
  34.             if (gotTarget) {
  35.                 // Spawn stuff right there.
  36.                 world.spawnEntityInWorld(new Meteor(world, i, j, k));
  37.                 world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k));
  38.                 gotTarget = false;
  39.             }
  40.         }
  41.         return;
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement