mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
126 lines
10 KiB
Diff
126 lines
10 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: YouHaveTrouble <garrenpolska@gmail.com>
|
|
Date: Thu, 25 Mar 2021 01:56:38 +0100
|
|
Subject: [PATCH] Projectile offset config
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
|
|
index 33df0ca406dc8321b76b393f317bbd1c8ebe6366..220513d3fd5645322886522ea4f6b8c55d043b3c 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BowItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
|
|
@@ -44,7 +44,7 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
|
|
ArrowItem itemarrow = (ArrowItem) (itemstack1.getItem() instanceof ArrowItem ? itemstack1.getItem() : Items.ARROW);
|
|
AbstractArrow entityarrow = itemarrow.createArrow(world, itemstack1, entityhuman);
|
|
|
|
- entityarrow.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, f * 3.0F, 1.0F);
|
|
+ entityarrow.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, f * 3.0F, (float) world.purpurConfig.bowProjectileOffset); // Purpur
|
|
if (f == 1.0F) {
|
|
entityarrow.setCritArrow(true);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
index 95ed2daf9dbcee099e0dc70d5bfea0649e8245d0..0c566b14191c8438389150f0c6e70bcfa3d1f53c 100644
|
|
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
|
@@ -64,7 +64,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
|
ItemStack itemstack = user.getItemInHand(hand);
|
|
|
|
if (CrossbowItem.isCharged(itemstack)) {
|
|
- CrossbowItem.performShooting(world, user, hand, itemstack, CrossbowItem.getShootingPower(itemstack), 1.0F);
|
|
+ CrossbowItem.performShooting(world, user, hand, itemstack, CrossbowItem.getShootingPower(itemstack), (float) world.purpurConfig.crossbowProjectileOffset); // Purpur
|
|
CrossbowItem.setCharged(itemstack, false);
|
|
return InteractionResultHolder.consume(itemstack);
|
|
} else if (!user.getProjectile(itemstack).isEmpty()) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/EggItem.java b/src/main/java/net/minecraft/world/item/EggItem.java
|
|
index 58cb992c5defec2f092755cbde661ff10f38bf9d..52f48681407d23f0925f4c9c072d5f0a2a6b1778 100644
|
|
--- a/src/main/java/net/minecraft/world/item/EggItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/EggItem.java
|
|
@@ -24,7 +24,7 @@ public class EggItem extends Item {
|
|
ThrownEgg entityegg = new ThrownEgg(world, user);
|
|
|
|
entityegg.setItem(itemstack);
|
|
- entityegg.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F);
|
|
+ entityegg.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, (float) world.purpurConfig.eggProjectileOffset); // Purpur
|
|
// Paper start
|
|
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityegg.getBukkitEntity());
|
|
if (event.callEvent() && world.addFreshEntity(entityegg)) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/EnderpearlItem.java b/src/main/java/net/minecraft/world/item/EnderpearlItem.java
|
|
index 897c202c0905040072a06fdfa2032a7f9461b088..6b27d98d06b163243bb0e1bb979aad03f48d7770 100644
|
|
--- a/src/main/java/net/minecraft/world/item/EnderpearlItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/EnderpearlItem.java
|
|
@@ -24,7 +24,7 @@ public class EnderpearlItem extends Item {
|
|
ThrownEnderpearl entityenderpearl = new ThrownEnderpearl(world, user);
|
|
|
|
entityenderpearl.setItem(itemstack);
|
|
- entityenderpearl.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F);
|
|
+ entityenderpearl.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, (float) world.purpurConfig.enderPearlProjectileOffset); // Purpur
|
|
// Paper start
|
|
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityenderpearl.getBukkitEntity());
|
|
if (event.callEvent() && world.addFreshEntity(entityenderpearl)) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/SnowballItem.java b/src/main/java/net/minecraft/world/item/SnowballItem.java
|
|
index ef3f90a5bcdd7b9815a4053cff166f9d2552f55d..e7e5e1cc92f56e3daba8fa09c59188febec5e8f2 100644
|
|
--- a/src/main/java/net/minecraft/world/item/SnowballItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/SnowballItem.java
|
|
@@ -25,7 +25,7 @@ public class SnowballItem extends Item {
|
|
Snowball entitysnowball = new Snowball(world, user);
|
|
|
|
entitysnowball.setItem(itemstack);
|
|
- entitysnowball.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F);
|
|
+ entitysnowball.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, (float) world.purpurConfig.snowballProjectileOffset); // Purpur
|
|
// Paper start
|
|
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity());
|
|
if (event.callEvent() && world.addFreshEntity(entitysnowball)) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java b/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java
|
|
index de5bdceb4c8578fb972a2fd5ee0dfdae509e46dc..bcf63ccb6e679cb97d658780b2663aafa3568bcb 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java
|
|
@@ -18,7 +18,7 @@ public class ThrowablePotionItem extends PotionItem {
|
|
if (!world.isClientSide) {
|
|
ThrownPotion thrownPotion = new ThrownPotion(world, user);
|
|
thrownPotion.setItem(itemStack);
|
|
- thrownPotion.shootFromRotation(user, user.getXRot(), user.getYRot(), -20.0F, 0.5F, 1.0F);
|
|
+ thrownPotion.shootFromRotation(user, user.getXRot(), user.getYRot(), -20.0F, 0.5F, (float) world.purpurConfig.throwablePotionProjectileOffset); // Purpur
|
|
// Paper start
|
|
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownPotion.getBukkitEntity());
|
|
if (event.callEvent() && world.addFreshEntity(thrownPotion)) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
|
|
index 41bd45c0720751f348b5cf6eaecac4397a439857..60512d08a45670a164a9b93191aafa40b2c2287c 100644
|
|
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
|
|
@@ -77,7 +77,7 @@ public class TridentItem extends Item implements Vanishable {
|
|
if (k == 0) {
|
|
ThrownTrident entitythrowntrident = new ThrownTrident(world, entityhuman, stack);
|
|
|
|
- entitythrowntrident.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 2.5F + (float) k * 0.5F, 1.0F);
|
|
+ entitythrowntrident.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 2.5F + (float) k * 0.5F, (float) world.purpurConfig.tridentProjectileOffset); // Purpur
|
|
if (entityhuman.getAbilities().instabuild) {
|
|
entitythrowntrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 0c5c28d209dbde8153e1dce9f002e6a04c3d6ec8..cfc7eb48f297133b84c2b982483c6981428a008b 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -428,6 +428,23 @@ public class PurpurWorldConfig {
|
|
//}
|
|
}
|
|
|
|
+ public double bowProjectileOffset = 1.0D;
|
|
+ public double crossbowProjectileOffset = 1.0D;
|
|
+ public double eggProjectileOffset = 1.0D;
|
|
+ public double enderPearlProjectileOffset = 1.0D;
|
|
+ public double throwablePotionProjectileOffset = 1.0D;
|
|
+ public double tridentProjectileOffset = 1.0D;
|
|
+ public double snowballProjectileOffset = 1.0D;
|
|
+ private void projectileOffsetSettings() {
|
|
+ bowProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.bow", bowProjectileOffset);
|
|
+ crossbowProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.crossbow", crossbowProjectileOffset);
|
|
+ eggProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.egg", eggProjectileOffset);
|
|
+ enderPearlProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.ender-pearl", enderPearlProjectileOffset);
|
|
+ throwablePotionProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.throwable-potion", throwablePotionProjectileOffset);
|
|
+ tridentProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.trident", tridentProjectileOffset);
|
|
+ snowballProjectileOffset = getDouble("gameplay-mechanics.projectile-offset.snowball", snowballProjectileOffset);
|
|
+ }
|
|
+
|
|
public int snowballDamage = -1;
|
|
private void snowballSettings() {
|
|
snowballDamage = getInt("gameplay-mechanics.projectile-damage.snowball", snowballDamage);
|