mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-27 07:05:39 +00:00
Patch 2 crash exploits (#78)
* Limit projectile velocity to 1024 * Limit sculk catalyst cursor positions
This commit is contained in:
parent
205e742c56
commit
db22a6b194
@ -5,10 +5,17 @@ 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
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
index 2096e8a0bdbcfc865f175f3a01ab688542481531..1c31e2c457c416a970b6ff4913c63195ff19443a 100644
|
index 2096e8a0bdbcfc865f175f3a01ab688542481531..15d375221c253dc4ca1b598eb80b4638eba6f8d0 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
@@ -41,9 +41,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.entity.projectile;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.MathUtility;
|
||||||
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@@ -41,9 +42,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||||
|
|
||||||
if (d6 != 0.0D) {
|
if (d6 != 0.0D) {
|
||||||
@ -25,7 +32,7 @@ index 2096e8a0bdbcfc865f175f3a01ab688542481531..1c31e2c457c416a970b6ff4913c63195
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -141,6 +145,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -141,6 +146,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,16 +49,16 @@ index 2096e8a0bdbcfc865f175f3a01ab688542481531..1c31e2c457c416a970b6ff4913c63195
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ this.xPower = xPower;
|
+ this.xPower = MathUtility.clampDouble(xPower, -1024, 1024);
|
||||||
+ this.yPower = yPower;
|
+ this.yPower = MathUtility.clampDouble(yPower, -1024, 1024);
|
||||||
+ this.zPower = zPower;
|
+ this.zPower = MathUtility.clampDouble(zPower, -1024, 1024);
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
super.readAdditionalSaveData(nbt);
|
super.readAdditionalSaveData(nbt);
|
||||||
@@ -148,9 +171,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -148,9 +172,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
ListTag nbttaglist = nbt.getList("power", 6);
|
ListTag nbttaglist = nbt.getList("power", 6);
|
||||||
|
|
||||||
if (nbttaglist.size() == 3) {
|
if (nbttaglist.size() == 3) {
|
||||||
@ -68,7 +75,7 @@ index 2096e8a0bdbcfc865f175f3a01ab688542481531..1c31e2c457c416a970b6ff4913c63195
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +211,12 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -184,9 +212,12 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
Vec3 vec3d = entity.getLookAngle();
|
Vec3 vec3d = entity.getLookAngle();
|
||||||
|
|
||||||
this.setDeltaMovement(vec3d);
|
this.setDeltaMovement(vec3d);
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 10 Apr 2023 13:56:18 -0300
|
||||||
|
Subject: [PATCH] Limit sculk catalyst cursor positions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
index ab732f0e52ef3c3d3be6ddc827d693fe294e4167..761c8cfb98e05a3c500599520e26e4323725fc85 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
@@ -141,6 +141,13 @@ public class SculkSpreader {
|
||||||
|
Object2IntMap<BlockPos> object2IntMap = new Object2IntOpenHashMap<>();
|
||||||
|
|
||||||
|
for(SculkSpreader.ChargeCursor chargeCursor : this.cursors) {
|
||||||
|
+ // Scissors start
|
||||||
|
+ if (!world.getMinecraftWorld().isLoadedAndInBounds(chargeCursor.getPos()))
|
||||||
|
+ {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
chargeCursor.update(world, pos, random, this, shouldConvertToBlock);
|
||||||
|
if (chargeCursor.charge <= 0) {
|
||||||
|
world.levelEvent(3006, chargeCursor.getPos(), 0);
|
Loading…
Reference in New Issue
Block a user