@Override public void update() { super.update(); World world = entity.getWorld(); if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){ BlockPos pos = getPos(); for(int i=0;i<AMOUNT;i++){ double x = pos.getX()+Math.random() * RAD * 2 - RAD, z = pos.getZ()+Math.random() * RAD * 2 - RAD; BlockPos spawn = new BlockPos(x,pos.getY()+94,z); while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down(); //Original spawned arrows at a fixed height of 158 EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z); arrow.motionX=0; arrow.motionZ=0; arrow.motionY=-2D; arrow.setFire(30); arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int... //arrow.setThrowableHeading(0, -1, 0, 2F, 0); world.spawnEntity(arrow); } } }
@SuppressWarnings("static-access") @SubscribeEvent public void onBowFire(ArrowLooseEvent event) { EntityPlayer player = event.getEntityPlayer(); ItemStack stack = event.getBow(); NBTTagCompound nbt = NBTHelper.loadStackNBT(stack); if (player != null && stack != null && nbt != null && !player.getEntityWorld().isRemote) { if (BowAttribute.BARRAGE.hasAttribute(nbt)) { for (int i = 0; i < (int) BowAttribute.BARRAGE.getCalculatedValue(nbt, 3, 1.5); i++) { EntityArrow entityarrow = new EntityTippedArrow(player.getEntityWorld(), player); entityarrow.setAim(player, player.rotationPitch, player.rotationYaw, 0, ((ItemBow) event.getBow().getItem()).getArrowVelocity(event.getCharge()) * 3, 20F); entityarrow.pickupStatus = PickupStatus.DISALLOWED; player.getEntityWorld().spawnEntity(entityarrow); } } } }
@Override public void onHit(RayTraceResult raytraceResultIn) { super.onHit(raytraceResultIn); if (!this.world.isRemote && this.isDead) { EntitySpearWood replace = new EntitySpearWood(this.world, this.posX, this.posY, this.posZ); replace.durability = this.durability; replace.pickupStatus = PickupStatus.ALLOWED; this.world.spawnEntity(replace); } }
@Override public void onHit(RayTraceResult raytraceResultIn) { super.onHit(raytraceResultIn); if (!this.world.isRemote && this.isDead) { EntitySpearFlint replace = new EntitySpearFlint(this.world, this.posX, this.posY, this.posZ); replace.durability = this.durability; replace.pickupStatus = PickupStatus.ALLOWED; this.world.spawnEntity(replace); } }