From be35039c5b116475c14bfaa80e8dc659a6341180 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 15 Jan 2019 13:16:58 -0500 Subject: [PATCH] boop --- plugin.yml | 7 +++ src/.DS_Store | Bin 0 -> 8196 bytes src/ARTulloss/.DS_Store | Bin 0 -> 8196 bytes src/ARTulloss/BowFix/.DS_Store | Bin 0 -> 6148 bytes src/ARTulloss/BowFix/BowFix.php | 21 +++++++ src/ARTulloss/BowFix/Item/Bow.php | 94 ++++++++++++++++++++++++++++++ 6 files changed, 122 insertions(+) create mode 100755 plugin.yml create mode 100644 src/.DS_Store create mode 100644 src/ARTulloss/.DS_Store create mode 100644 src/ARTulloss/BowFix/.DS_Store create mode 100755 src/ARTulloss/BowFix/BowFix.php create mode 100644 src/ARTulloss/BowFix/Item/Bow.php diff --git a/plugin.yml b/plugin.yml new file mode 100755 index 0000000..7536a70 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,7 @@ +name: BowFix +main: ARTulloss\BowFix\BowFix +api: [3.0.0] +version: 1.0.0 +author: ARTulloss +website: github.com/artulloss +description: Bow patch \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c8e8130c41cfcc23ac1e34497b9f3831d4c95a00 GIT binary patch literal 8196 zcmeHMTWs7!6umc()^<|jgp|ak+bm53X`8fp(KaP1n-?KXOR8q`Y?{QoHi?B}Z`a=4 zq-ju4#Zw4WKtj9(s`yJKBqSuL_~cOpLaL~E3HX2?J`o5czTl3>8?||SAS8%X&uZq* z%$+;qd*+Ns*9!pHp3>?8$^k&2%%ogE#Ttp}SzeWL{GL3LNcI3G{cLc+iDg!e4mtt^ z0t5mC0t5mC0t7Y!0(57yB&>7qb8S!t2m}b+lnAi*Lzps?5nnEH>AgCr@InBREClcp z)hQ0}Y{I^b_;Qg;&y?om(F6LX=!Y1{%}F0-!%0SbxyU6q2ju2}{>tb_DCn(Dc42Qg zV1&z{3=jwqSd9QXJ|eWiNr*z~`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Qf|gzC=3{QiJ#o2z{_He~4ONx7`Uwp`V)^n~YZXgW<9A2uw_PDkyer8(Yp z`nf?6L{XfSD;5_Un;UAwO^x+Swc*8W z6Su7s37y%8pcV69mQ?V?SN@c?-!!cr}KA1K%cV<*|;<}|7 z*7O*`Wx2-vhMo{h@Vq!+sk8dkTgoeBWvjAnBQHU&5=N3S<8;z+7x)^L%59?jmN2f- zT^zSHc16vzD3waJAe?0Sj)YDvS4%a@Zc$c+0fz$Nm#CBWiLxUOJV1NOT^prlLDs}U zQ;q2+R~?XA1i4onPH{B3vQ;`Plwhqm61Qh(DISNb+m#MMzAQ|zwU4Qe+c&3Mw7eHx zrP3`3qs-E-X}TsiI~dQ$>NjbcWmmV$%bB#TH9B*GHdt#N+gdv zoE#o$GNkafa4i#Q&y}sWN})mGmOh{T6l8cVZ(=MG7(IeEw{EECM&R~jhn^lkR*uzoPif$ z1unq{#JwxcqeqG%!I7Oko=5@gY1%JbV-%!}ItIaq&6g;sspEVqQ;%b6n!ZZ04o< z6P9UP)1=R^b*)P9QP2K4A&T{QA z)hVj1uzAZ|dM?y>={QL*9VfZ^havUDG?n>8e7VdeX{h|`9|G8~gW&v!)nA^$`S0=Y HMr-~AnFZfh literal 0 HcmV?d00001 diff --git a/src/ARTulloss/BowFix/.DS_Store b/src/ARTulloss/BowFix/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0isSurvival() and !$player->getInventory()->contains(ItemFactory::get(Item::ARROW, 0, 1))){ + $player->getInventory()->sendContents($player); + return false; + } + $nbt = Entity::createBaseNBT( + $player->add(0, $player->getEyeHeight(), 0), + $player->getDirectionVector(), + ($player->yaw > 180 ? 360 : 0) - $player->yaw, + -$player->pitch + ); + $nbt->setShort("Fire", $player->isOnFire() ? 45 * 60 : 0); + $diff = $player->getItemUseDuration(); + $p = $diff / 20; + $baseForce = min((($p ** 2) + $p * 2) / 3, 1); + $entity = Entity::createEntity("Arrow", $player->getLevel(), $nbt, $player, $baseForce >= 1); + if($entity instanceof Projectile){ + $infinity = $this->hasEnchantment(Enchantment::INFINITY); + if($entity instanceof ArrowEntity){ + if($infinity){ + $entity->setPickupMode(ArrowEntity::PICKUP_CREATIVE); + } + if(($punchLevel = $this->getEnchantmentLevel(Enchantment::PUNCH)) > 0){ + $entity->setPunchKnockback($punchLevel); + } + } + if(($powerLevel = $this->getEnchantmentLevel(Enchantment::POWER)) > 0){ + $entity->setBaseDamage($entity->getBaseDamage() + (($powerLevel + 1) / 2)); + } + if($this->hasEnchantment(Enchantment::FLAME)){ + $entity->setOnFire(intdiv($entity->getFireTicks(), 20) + 100); + } + $ev = new EntityShootBowEvent($player, $this, $entity, $baseForce * 3); + if($baseForce < 0.1 or $diff < 5){ + $ev->setCancelled(); + } + $ev->call(); + $entity = $ev->getProjectile(); //This might have been changed by plugins + if($ev->isCancelled()){ + $entity->flagForDespawn(); + $player->getInventory()->sendContents($player); + }else{ + $entity->setMotion($entity->getMotion()->multiply($ev->getForce())); + if($player->isSurvival()){ + if(!$infinity){ //TODO: tipped arrows are still consumed when Infinity is applied + $player->getInventory()->removeItem(ItemFactory::get(Item::ARROW, 0, 1)); + } + $this->applyDamage(1); + } + if($entity instanceof Projectile){ + $projectileEv = new ProjectileLaunchEvent($entity); + $projectileEv->call(); + if($projectileEv->isCancelled()){ + $ev->getProjectile()->flagForDespawn(); + }else{ + $ev->getProjectile()->spawnToAll(); + $player->getLevel()->broadcastLevelSoundEvent($player, LevelSoundEventPacket::SOUND_BOW); + } + }else{ + $entity->spawnToAll(); + } + } + }else{ + $entity->spawnToAll(); + } + return true; + } +} \ No newline at end of file