2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-24 03:30:36 +02:00
|
|
|
From: Lucavon <lucavonlp@gmail.com>
|
|
|
|
Date: Tue, 23 Jul 2019 20:29:20 -0500
|
|
|
|
Subject: [PATCH] Configurable projectile relative velocity
|
|
|
|
|
|
|
|
This patch adds an option "disable relative projectile velocity", which, when
|
|
|
|
nabled, will cause projectiles to ignore the shooter's current velocity,
|
|
|
|
like they did in Minecraft 1.8 and prior.
|
|
|
|
If a player is falling, for example, their shooting range will be drastically
|
|
|
|
reduced, as a downwards velocity is applied to the projectile. This prevents
|
|
|
|
players from saving themselves from falling off floating islands, for example,
|
|
|
|
as a thrown ender pearl will not make it back to the island, while it would
|
|
|
|
have in 1.8.
|
|
|
|
|
|
|
|
While this could easily be done with plugins, too, there are multiple problems:
|
|
|
|
P1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
|
|
|
|
from the projectile's velocity, the projectile's velocity would be different.
|
|
|
|
As there's no way to detect whether the projectile's velocity has already been
|
|
|
|
adjusted to ignore the player's velocity, plugins can't not do it if it's not
|
|
|
|
necessary.
|
|
|
|
P2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
|
|
|
|
using an elytra. Checking for those inconsistencies is possible, but not as
|
|
|
|
efficient as just not applying the velocity in the first place.
|
|
|
|
P3) Solutions for 1) and especially 2) might not be future-proof, while this
|
|
|
|
server-internal fix makes this change future-proof.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-06-09 10:12:20 +02:00
|
|
|
index e8e61ce505cafccb3c8338bc5bbdf941f903bb27..7101ef0912221bdb1c32d2cafbac5d9d53e7037d 100644
|
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-24 03:30:36 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-06-09 10:12:20 +02:00
|
|
|
@@ -541,4 +541,9 @@ public class PaperWorldConfig {
|
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-24 03:30:36 +02:00
|
|
|
}
|
2020-05-06 10:35:20 +02:00
|
|
|
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
|
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-24 03:30:36 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean disableRelativeProjectileVelocity;
|
|
|
|
+ private void disableRelativeProjectileVelocity() {
|
|
|
|
+ disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 634e2bd3049d65bbef4ef12e2264049a6980fd71..9c97edf9c9e9a8cdf029264f6b563090142c686b 100644
|
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-24 03:30:36 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
|
|
@@ -85,7 +85,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
|
|
|
float f7 = MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f * 0.017453292F);
|
|
|
|
|
|
|
|
this.shoot((double) f5, (double) f6, (double) f7, f3, f4);
|
|
|
|
- this.setMot(this.getMot().add(entity.getMot().x, entity.onGround ? 0.0D : entity.getMot().y, entity.getMot().z));
|
|
|
|
+ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) this.setMot(this.getMot().add(entity.getMot().x, entity.onGround ? 0.0D : entity.getMot().y, entity.getMot().z)); // Paper - allow disabling relative velocity
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 6c091b68087d60b0b916871eb0ce06c6a2776bf8..f5c8074dcf1c6275bc13eb8f2b67c04ca547877b 100644
|
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-24 03:30:36 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
|
|
@@ -43,7 +43,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
|
|
|
this.shoot((double) f5, (double) f6, (double) f7, f3, f4);
|
|
|
|
Vec3D vec3d = entity.getMot();
|
|
|
|
|
|
|
|
- this.setMot(this.getMot().add(vec3d.x, entity.onGround ? 0.0D : vec3d.y, vec3d.z));
|
|
|
|
+ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) this.setMot(this.getMot().add(vec3d.x, entity.onGround ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|