I already tried this: PHP: if($event->getItem()->getId() === 369) { $aimPos = $player->getDirectionVector(); $nbt = new CompoundTag("", [ "Pos" => new Enum("Pos", [ new Double("", $player->x), new Double("", $player->y + $player->getEyeHeight()), new Double("", $player->z) ]), "Motion" => new Enum("Motion", [ new Double("", $aimPos->x), new Double("", $aimPos->y), new Double("", $aimPos->z) ]), "Rotation" => new Enum("Rotation", [ new Float("", $player->yaw), new Float("", $player->pitch) ]), "Health" => new Short("Health", 5), "Item" => new CompoundTag("Item", [ "id" => new Short("id", Item::TNT), "Damage" => new Short("Damage", 0), "Count" => new Byte("Count", 1), ]), "PickupDelay" => new Short("PickupDelay", 0x7F), ]); $f = 1.5; $tnt= Entity::createEntity("Item", $player->getLevel()->getChunk($player->getFloorX() >> 4, $player->getFloorZ() >> 4), $nbt, $player); $tnt->setMotion($tnt->getMotion()->multiply($f)); /* $player->getLevel()->addSound(new LaunchSound($player), */ $player->getViewers(); $tnt->spawnToAll();
PHP: <?php/** * @author robske_110 * @license GPLv3 * NO WARRANTY */#WAY 1$aimPos = $player->getDirectionVector();$nbt = new CompoundTag("", [ "Pos" => new ListTag("Pos", [ new DoubleTag("", $player->x), new DoubleTag("", $player->y + $player->getEyeHeight()), new DoubleTag("", $player->z) ]), "Motion" => new ListTag("Motion", [ new DoubleTag("", $aimPos->x), new DoubleTag("", $aimPos->y), new DoubleTag("", $aimPos->z) ]), "Rotation" => new ListTag("Rotation", [ new FloatTag("", $player->yaw), new FloatTag("", $player->pitch) ]),]);$projectile = new Projectile($player->getLevel()->getChunk($player->getX() >> 4, $player->getZ() >> 4), $nbt, $player);$f = 1.5; #force$projectile->setMotion($projectile->getMotion()->multiply($f));$this->level->addSound(new LaunchSound($this), $player->getViewers()); $projectile->spawnToAll();#WAY 2$nbt = new CompoundTag("", [ "Pos" => new ListTag("Pos", [ new DoubleTag("", $player->x), new DoubleTag("", $player->y + $player->getEyeHeight()), new DoubleTag("", $player->z) ]), "Motion" => new ListTag("Motion", [ new DoubleTag("", $aimPos->x), new DoubleTag("", $aimPos->y), new DoubleTag("", $aimPos->z) ]), "Rotation" => new ListTag("Rotation", [ new FloatTag("", $player->yaw), new FloatTag("", $player->pitch) ]),]);$projectile = Entity::createEntity("Snowball", $player->getLevel()->getChunk($player->getX() >> 4, $player->getZ() >> 4), $nbt, $player);$f = 1.5;$projectile->setMotion($projectile->getMotion()->multiply($f));$projectile->spawnToAll(); threw this together real quick, code is GPLv3
Worth nothing, there a old hack using on packet receive and then constantly shoot the projectile FYI OP you need to word your top post better i originally think you meant to throw some item on the ground when player holds a stick