-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb54a09
commit ee6983a
Showing
3 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
patches/unapplied/server/0029-Dont-send-useless-entity-packets.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: William Blake Galbreath <[email protected]> | ||
Date: Sat, 6 Jul 2019 17:00:04 -0500 | ||
Subject: [PATCH] Dont send useless entity packets | ||
|
||
Original code by PurpurMC, licensed under MIT | ||
You can find the original code on https://github.com/PurpurMC/Purpur | ||
|
||
diff --git a/src/main/java/dev/etil/mirai/MiraiConfig.java b/src/main/java/dev/etil/mirai/MiraiConfig.java | ||
index 8717e40515dbc7cfbb5b45ce706f5c720596b5fc..d867baee944627e1a1419611fac2d3385350b182 100644 | ||
--- a/src/main/java/dev/etil/mirai/MiraiConfig.java | ||
+++ b/src/main/java/dev/etil/mirai/MiraiConfig.java | ||
@@ -152,4 +152,10 @@ public class MiraiConfig { | ||
checkVehicleFlying = getBoolean("checks.vehicle-flight", true, | ||
"Whether or not vanilla anticheat should check for passengers flying."); | ||
} | ||
+ | ||
+ public static boolean dontSendUselessEntityPackets; | ||
+ private static void uselessEntityPackets() { | ||
+ dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", true, | ||
+ "Whether or not server should send entity packets with null movements."); | ||
+ } | ||
} | ||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
index da459fa2bd8ad4b05a0ae99552db2709a5169c2a..b99eeae741c1042ae5d925957a87481c113f9502 100644 | ||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
@@ -206,6 +206,7 @@ public class ServerEntity { | ||
flag4 = true; | ||
flag5 = true; | ||
} | ||
+ if (dev.etil.mirai.MiraiConfig.dontSendUselessEntityPackets && isUselessPacket(packet1)) packet1 = null; // Purpur | ||
} | ||
|
||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) { | ||
@@ -278,6 +279,21 @@ public class ServerEntity { | ||
}); | ||
} | ||
|
||
+ // Purpur start | ||
+ private boolean isUselessPacket(Packet<?> possibleUselessPacket) { | ||
+ if (possibleUselessPacket instanceof ClientboundMoveEntityPacket packet) { | ||
+ if (possibleUselessPacket instanceof ClientboundMoveEntityPacket.Pos) { | ||
+ return packet.getXa() == 0 && packet.getYa() == 0 && packet.getZa() == 0; | ||
+ } else if (possibleUselessPacket instanceof ClientboundMoveEntityPacket.PosRot) { | ||
+ return packet.getXa() == 0 && packet.getYa() == 0 && packet.getZa() == 0 && packet.getyRot() == 0 && packet.getxRot() == 0; | ||
+ } else if (possibleUselessPacket instanceof ClientboundMoveEntityPacket.Rot) { | ||
+ return packet.getyRot() == 0 && packet.getxRot() == 0; | ||
+ } | ||
+ } | ||
+ return false; | ||
+ } | ||
+ // Purpur end | ||
+ | ||
public void removePairing(ServerPlayer player) { | ||
this.entity.stopSeenByPlayer(player); | ||
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Dreeam <[email protected]> | ||
Date: Sat, 20 Jul 2024 05:28:12 +0800 | ||
Subject: [PATCH] Fix MC-26678 | ||
|
||
Original license: MIT | ||
Original project: https://github.com/545u/OldDamageTilt | ||
|
||
Mojang issues: https://bugs.mojang.com/browse/MC-172047 | ||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java | ||
index 152d0219c4da3a68e331771c336d8c9423081557..52627656dd506aa9fbc7b8070d6e4bdf4b033ba6 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java | ||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java | ||
@@ -2482,7 +2482,9 @@ public abstract class Player extends LivingEntity { | ||
|
||
@Override | ||
public float getHurtDir() { | ||
- return this.hurtDir; | ||
+ return org.dreeam.leaf.config.modules.fixes.FixMC26678.enabled | ||
+ ? this.hurtDir | ||
+ : 0.0F; | ||
} | ||
|
||
@Override | ||
diff --git a/src/main/java/org/dreeam/leaf/config/modules/fixes/FixMC26678.java b/src/main/java/org/dreeam/leaf/config/modules/fixes/FixMC26678.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..cdf992d47afd524b6b36f6befddeefe2cdf66265 | ||
--- /dev/null | ||
+++ b/src/main/java/org/dreeam/leaf/config/modules/fixes/FixMC26678.java | ||
@@ -0,0 +1,21 @@ | ||
+package org.dreeam.leaf.config.modules.fixes; | ||
+ | ||
+import org.dreeam.leaf.config.ConfigInfo; | ||
+import org.dreeam.leaf.config.EnumConfigCategory; | ||
+import org.dreeam.leaf.config.IConfigModule; | ||
+ | ||
+public class FixMC26678 implements IConfigModule { | ||
+ | ||
+ @Override | ||
+ public EnumConfigCategory getCategory() { | ||
+ return EnumConfigCategory.FIXES; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public String getBaseName() { | ||
+ return "fix_MC_26678"; | ||
+ } | ||
+ | ||
+ @ConfigInfo(baseName = "enabled", comments = "Disable it to makes damage tilt toward left, to use old damage tilt") | ||
+ public static boolean enabled = true; | ||
+} |
54 changes: 54 additions & 0 deletions
54
patches/unapplied/server/0094-Fix-Nova-compatibility.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Dreeam <[email protected]> | ||
Date: Thu, 4 Jul 2024 19:47:01 +0800 | ||
Subject: [PATCH] Fix Nova compatibility | ||
|
||
By setting server brand to Purpur to be compatible with Nova plugin | ||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
index 15c3d62262a589844dbaa8ac357402aa592cd351..5823a3fa71850b38cb00b869e597c2fabc8d4117 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
@@ -671,6 +671,12 @@ public final class CraftServer implements Server { | ||
|
||
@Override | ||
public String getVersion() { | ||
+ // Leaf start - Fix Nova compatibility | ||
+ if (org.dreeam.leaf.config.modules.misc.FixNovaCompatibility.enabled) { | ||
+ return "git-Purpur-\"0000000\" (MC: " + this.console.getServerVersion() + ")"; | ||
+ } | ||
+ // Leaf end - Fix Nova compatibility | ||
+ | ||
return this.serverVersion + " (MC: " + this.console.getServerVersion() + ")"; | ||
} | ||
|
||
diff --git a/src/main/java/org/dreeam/leaf/config/modules/misc/FixNovaCompatibility.java b/src/main/java/org/dreeam/leaf/config/modules/misc/FixNovaCompatibility.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..fb13c33172b530c080a6028241bb6f5efd91cdaf | ||
--- /dev/null | ||
+++ b/src/main/java/org/dreeam/leaf/config/modules/misc/FixNovaCompatibility.java | ||
@@ -0,0 +1,24 @@ | ||
+package org.dreeam.leaf.config.modules.misc; | ||
+ | ||
+import org.dreeam.leaf.config.ConfigInfo; | ||
+import org.dreeam.leaf.config.EnumConfigCategory; | ||
+import org.dreeam.leaf.config.IConfigModule; | ||
+ | ||
+public class FixNovaCompatibility implements IConfigModule { | ||
+ | ||
+ @Override | ||
+ public EnumConfigCategory getCategory() { | ||
+ return EnumConfigCategory.MISC; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public String getBaseName() { | ||
+ return "fix_nova_compatibility"; | ||
+ } | ||
+ | ||
+ @ConfigInfo(baseName = "enabled", comments = """ | ||
+ Set the server brand to Purpur if enabled. | ||
+ Don't enable this unless you have to use Nova | ||
+ """) | ||
+ public static boolean enabled = false; | ||
+} |