2022-11-28 03:48:07 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2024-02-13 21:52:00 +00:00
|
|
|
From: Allink <arclicious@vivaldi.net>
|
2023-12-11 01:20:31 +00:00
|
|
|
Date: Sun, 10 Dec 2023 18:41:18 -0600
|
2022-11-28 03:48:07 +00:00
|
|
|
Subject: [PATCH] Prevent velocity freeze
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
2024-02-24 22:32:31 +00:00
|
|
|
index 20ce474b72894a8bb3fc21018b9d79bbdc8bb14b..b5c87bb5f5d3526600520913f04cfc6614a62b81 100644
|
2022-11-28 03:48:07 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
2023-12-11 01:20:31 +00:00
|
|
|
@@ -1,6 +1,8 @@
|
2023-04-11 00:08:03 +00:00
|
|
|
package net.minecraft.world.entity.projectile;
|
|
|
|
|
2023-12-11 01:20:31 +00:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
+
|
|
|
|
+import me.totalfreedom.scissors.MathUtility;
|
2023-04-11 00:08:03 +00:00
|
|
|
import net.minecraft.core.particles.ParticleOptions;
|
|
|
|
import net.minecraft.core.particles.ParticleTypes;
|
|
|
|
import net.minecraft.nbt.CompoundTag;
|
2024-02-24 22:32:31 +00:00
|
|
|
@@ -50,12 +52,15 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
2023-12-11 01:20:31 +00:00
|
|
|
// CraftBukkit end
|
2022-11-28 03:48:07 +00:00
|
|
|
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
|
|
|
|
2023-12-11 01:20:31 +00:00
|
|
|
- if (d6 != 0.0D) {
|
2022-11-28 03:48:07 +00:00
|
|
|
- this.xPower = d3 / d6 * 0.1D;
|
|
|
|
- this.yPower = d4 / d6 * 0.1D;
|
|
|
|
- this.zPower = d5 / d6 * 0.1D;
|
2023-12-11 01:20:31 +00:00
|
|
|
+ if (d6 != 0.0D)
|
|
|
|
+ {
|
2022-11-28 03:48:07 +00:00
|
|
|
+ // Scissors start - Prevent projectile velocity freeze
|
|
|
|
+ //this.xPower = d3 / d6 * 0.1D;
|
|
|
|
+ //this.yPower = d4 / d6 * 0.1D;
|
|
|
|
+ //this.zPower = d5 / d6 * 0.1D;
|
|
|
|
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
|
|
|
}
|
2023-12-11 01:20:31 +00:00
|
|
|
-
|
|
|
|
+ // Scissors end
|
2022-11-28 03:48:07 +00:00
|
|
|
}
|
2023-12-11 01:20:31 +00:00
|
|
|
|
|
|
|
public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> type, LivingEntity owner, double directionX, double directionY, double directionZ, Level world) {
|
2024-02-24 22:32:31 +00:00
|
|
|
@@ -167,6 +172,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
2022-11-28 03:48:07 +00:00
|
|
|
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Scissors start - Prevent projectile velocity freeze
|
|
|
|
+ public void setPower(double xPower, double yPower, double zPower)
|
|
|
|
+ {
|
|
|
|
+ if (Double.isInfinite(xPower) || Double.isInfinite(yPower) || Double.isInfinite(zPower))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (Double.isNaN(xPower) || Double.isNaN(yPower) || Double.isNaN(zPower))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
2023-04-11 00:08:03 +00:00
|
|
|
+ this.xPower = MathUtility.clampDouble(xPower, -1024, 1024);
|
|
|
|
+ this.yPower = MathUtility.clampDouble(yPower, -1024, 1024);
|
|
|
|
+ this.zPower = MathUtility.clampDouble(zPower, -1024, 1024);
|
2022-11-28 03:48:07 +00:00
|
|
|
+ }
|
|
|
|
+ // Scissors end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
super.readAdditionalSaveData(nbt);
|
2024-02-24 22:32:31 +00:00
|
|
|
@@ -174,9 +198,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
2022-11-28 03:48:07 +00:00
|
|
|
ListTag nbttaglist = nbt.getList("power", 6);
|
|
|
|
|
|
|
|
if (nbttaglist.size() == 3) {
|
|
|
|
- this.xPower = nbttaglist.getDouble(0);
|
|
|
|
- this.yPower = nbttaglist.getDouble(1);
|
|
|
|
- this.zPower = nbttaglist.getDouble(2);
|
|
|
|
+ // Scissors start - Prevent projectile velocity freeze
|
|
|
|
+ //this.xPower = nbttaglist.getDouble(0);
|
|
|
|
+ //this.yPower = nbttaglist.getDouble(1);
|
|
|
|
+ //this.zPower = nbttaglist.getDouble(2);
|
|
|
|
+
|
|
|
|
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
2023-07-01 20:21:13 +00:00
|
|
|
+ // Scissors end
|
2022-11-28 03:48:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-24 22:32:31 +00:00
|
|
|
@@ -210,9 +238,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
2022-11-28 03:48:07 +00:00
|
|
|
Vec3 vec3d = entity.getLookAngle();
|
|
|
|
|
|
|
|
this.setDeltaMovement(vec3d);
|
|
|
|
- this.xPower = vec3d.x * 0.1D;
|
|
|
|
- this.yPower = vec3d.y * 0.1D;
|
|
|
|
- this.zPower = vec3d.z * 0.1D;
|
|
|
|
+ // Scissors start - Prevent projectile velocity freeze
|
|
|
|
+ //this.xPower = vec3d.x * 0.1D;
|
|
|
|
+ //this.yPower = vec3d.y * 0.1D;
|
|
|
|
+ //this.zPower = vec3d.z * 0.1D;
|
2023-07-01 20:21:13 +00:00
|
|
|
+
|
2022-11-28 03:48:07 +00:00
|
|
|
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
|
|
|
+ // Scissors end
|
|
|
|
this.setOwner(entity);
|
|
|
|
}
|
|
|
|
|