9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

Some new patches

This commit is contained in:
NONPLAYT
2023-06-12 00:34:16 +03:00
parent 2921ea88ad
commit 7514cb64db
3 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 11 Jun 2023 23:37:00 +0300
Subject: [PATCH] Do not drop items from Give command
Original project: starlis/empirecraft
Link: https://github.com/starlis/empirecraft/blob/master/patches/server/0050-Do-not-drop-items-from-Give-command.patch
This is a permanent change. Some players who have /give perms may abuse this to create lags on server
diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
index 0ff3b06a98b2f4514b2d861b92dd70fe678ae86c..b5646fbfb94ba07b8d723ffcf21e7506bc097f3e 100644
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
@@ -57,6 +57,11 @@ public class GiveCommand {
l -= i1;
ItemStack itemstack1 = item.createItemStack(i1, false);
boolean flag = entityplayer.getInventory().add(itemstack1);
+ // DivineMC start - EMC - never drop items
+ if (true) {
+ continue;
+ }
+ // DivineMC end
ItemEntity entityitem;
if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 11 Jun 2023 23:43:00 +0300
Subject: [PATCH] Do not process chat/commands before player has joined
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9dfc12ccf53f5b4d4432bd89449b09504f3a2285..25e05aebf764dc36ca27f8a08c061c163195752f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2424,6 +2424,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca
}); // Paper - push to main
return Optional.empty();
+ } else if (player.joining) { // DivineMC - EMC - do not handle chat messages before they joined
+ return Optional.empty();
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 11 Jun 2023 23:59:29 +0300
Subject: [PATCH] Fix MC-2025
Original post on Mojira: https://bugs.mojang.com/browse/MC-2025
Fix taken from Reddit: https://redd.it/8pgd4q
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ff8258b1146d2899037a1fbd0ebc985df342eff4..92fe861c4b513999e3a0cc462f007f0dd60f26c3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2442,6 +2442,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
nbt.putBoolean("Purpur.FireImmune", immuneToFire);
}
// Purpur end
+
+ // DivineMC start - Fix MC-2025
+ // This fix was taken from Reddit: https://redd.it/8pgd4q
+ AABB boundingBox = getBoundingBox();
+ ListTag boundingBoxList = new ListTag();
+ for (double coord : new double[]{boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ}) {
+ boundingBoxList.add(DoubleTag.valueOf(coord));
+ }
+ nbt.put("DivineMC.BoundingBox", boundingBoxList);
+ // DivineMC end
+
return nbt;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2519,6 +2530,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.reapplyPosition();
}
+ // DivineMC start - Fix MC-2025
+ // This fix was taken from Reddit: https://redd.it/8pgd4q
+ if (nbt.contains("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_LIST)) {
+ ListTag boundingBoxList = nbt.getList("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_DOUBLE);
+ setBoundingBox(new AABB(boundingBoxList.getDouble(0), boundingBoxList.getDouble(1), boundingBoxList.getDouble(2), boundingBoxList.getDouble(3), boundingBoxList.getDouble(4), boundingBoxList.getDouble(5)));
+ }
+ // DivineMC end
+
} else {
throw new IllegalStateException("Entity has invalid rotation");
}