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

[ci-skip] finish patches

This commit is contained in:
NONPLAYT
2023-03-21 20:54:44 +03:00
parent 747de0799b
commit 340edaf4d3
62 changed files with 597 additions and 176 deletions

View File

@@ -21,12 +21,14 @@
- **Bug fixes** for several Minecraft issues.
- **Contains** PaperMC pull requests patches.
- **Faster process** for Vanilla methods.
- **Dynamic mine-carts speed**
- **Plugin compatibility** with Spigot & Paper plugins.
## We use patches from the following projects
* **[Paper](https://github.com/PaperMC/Paper)**
* **[Purpur](https://github.com/PurpurMC/Purpur)**
* **[Kiterino](https://github.com/SoSeDiKs-Universe/Kiterino)**
* **[Mirai](https://github.com/etil2jz/Mirai)**
* **NOTE: We also borrow some patches from [Yatopia](https://github.com/YatopiaMC/Yatopia).**
@@ -47,4 +49,4 @@ In order to distribute and use this server software, you need a paperclip file:
Patches are licensed under GPL-3.0.
All other files are licensed under MIT.
###### And we dont stealed logo from YatopiaMC!!!
###### And we don't steal logo from YatopiaMC!!!

View File

@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 24 Apr 2017 20:27:23 -0400
Subject: [PATCH] EMC - Add ChatColor.getById
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index e3f185dc982d1c38195a4e01ddd485c13ffa58c0..8a3d05702ad0cfa8384d3a9c7a5695d82e13523e 100644
--- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java
@@ -233,6 +233,10 @@ public enum ChatColor {
}
};
+ public int getId() {
+ return intCode;
+ }
+
/**
* The special character which prefixes all chat colour codes. Use this if
* you need to dynamically convert colour codes from your custom format.
@@ -296,6 +300,11 @@ public enum ChatColor {
return !isFormat && this != RESET;
}
+ @Nullable
+ public static ChatColor getById(int id) {
+ return BY_ID.get(id);
+ }
+
/**
* Gets the color represented by the specified color code
*

View File

@@ -0,0 +1,64 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Justin <justin@justinf.dev>
Date: Wed, 24 Aug 2022 05:08:52 -0700
Subject: [PATCH] Paper PR - Add Entity hidden by default API
This patch adds API that allows entities to be hidden by default. Entities that are hidden by
default are not shown to players until Player#showEntity is invoked on said entity. The same is
true for players that join the server after an Entity is hidden by default.
Hiding entities by default also respects precedent of keeping entities hidden when other plugins
explicitly hide them from a player. If an entity is hidden by default and by a plugin, the entity
must have the plugin that hid them from a player show them in order to be shown to a player again.
If no plugin had previously hidden the entity before the entity was hidden by default, then any
plugin that attempts to show the entity to a player will succeed in doing so.
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 365350d38b2eee00d22bad09ab95c6054f11d536..565a3bcc49ccb4650188263632751e9f6326a5d1 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -953,4 +953,25 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API
+
+ // Paper start - Entity hiddenByDefault
+ /**
+ * Sets whether the entity is hidden by default. When an entity is hidden by default,
+ * {@link Player#showEntity(org.bukkit.plugin.Plugin, Entity)} must be called in order to
+ * display the entity again. Players that join the server do not see entities that are
+ * hidden by default at first and must be shown the entity with the same method above.
+ *
+ * This method also respects plugins hiding entities - if another plugin still wishes for an entity
+ * to be hidden (via {@link Player#hideEntity(org.bukkit.plugin.Plugin, Entity)}), then the entity will
+ * remain hidden even if hiddenByDefault is set to false again or if another plugin tries to show the entity.
+ *
+ * @param hiddenByDefault
+ */
+ void setHiddenByDefault(boolean hiddenByDefault);
+
+ /**
+ * @return true if the Entity is hidden by default, false otherwise
+ */
+ boolean isHiddenByDefault();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b5fd857896b3afcfa69cce55cbc2696dd625f805..7d44d455a550490e8e505c205dfe26e1d048719e 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1568,9 +1568,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Allows this player to see an entity that was previously hidden. If
- * another another plugin had hidden the entity too, then the entity will
+ * another plugin had hidden the entity too, then the entity will
* remain hidden until the other plugin calls this method too.
*
+ * If no other plugin is hiding the entity after this method is called,
+ * then this method also allows the player to see entities hidden by default
+ * with {@link Entity#setHiddenByDefault(boolean)}.
+ *
* @param plugin Plugin that wants to show the entity
* @param entity Entity to show
*/

View File

@@ -1,69 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: James Lyne <jim+github@not-null.co.uk>
Date: Mon, 7 Dec 2020 17:52:36 +0000
Subject: [PATCH] Spread out and optimise player list ticksSpread out and
optimise player list ticks
This patch was removed from PurpurMC!
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/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index faaf13f46bc7bf0ffc1fe61f45e9f11cb9c8b4d5..f4b554da231ed968c6fa7d71380da361d463d6c5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1032,22 +1032,22 @@ public abstract class PlayerList {
}
public void tick() {
- if (++this.sendAllPlayerInfoIn > 600) {
- // CraftBukkit start
- for (int i = 0; i < this.players.size(); ++i) {
- final ServerPlayer target = (ServerPlayer) this.players.get(i);
-
- target.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.UPDATE_LATENCY, this.players.stream().filter(new Predicate<ServerPlayer>() {
- @Override
- public boolean test(ServerPlayer input) {
- return target.getBukkitEntity().canSee(input.getBukkitEntity());
- }
- }).collect(Collectors.toList())));
+ // Purpur start
+ if (this.sendAllPlayerInfoIn < this.players.size()) {
+ final org.bukkit.craftbukkit.entity.CraftPlayer target = this.players.get(this.sendAllPlayerInfoIn).getBukkitEntity();
+ final List<ServerPlayer> list = new java.util.ArrayList<>();
+ for (ServerPlayer player : this.players) {
+ if (target.canSee(player.getUUID())) {
+ list.add(player);
+ }
}
- // CraftBukkit end
- this.sendAllPlayerInfoIn = 0;
+ target.getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.UPDATE_LATENCY, list));
}
+ if (++this.sendAllPlayerInfoIn > 600) {
+ this.sendAllPlayerInfoIn = 0;
+ }
+ // Purpur end
}
public void broadcastAll(Packet<?> packet) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b1136b9c39b16cbb9dfe460f88000f74ccd4f571..cfbabdcade291b2fcdbe83206b060b8762f50f41 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1883,7 +1883,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {
- return !this.hiddenEntities.containsKey(entity.getUniqueId());
+ // Purpur start
+ return this.canSee(entity.getUniqueId());
+ }
+
+ public boolean canSee(UUID uuid) {
+ return !this.hiddenEntities.containsKey(uuid);
+ // Purpur end
}
@Override

View File

@@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: etil2jz <81570777+etil2jz@users.noreply.github.com>
Date: Fri, 8 Apr 2022 21:20:50 +0200
Subject: [PATCH] Fix tick function tag running before load
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 00a50196f6a4768d84acfbbeec79a0753308f091..3452ff5d378a2703fb0959c8163ee0274236e839 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -46,13 +46,14 @@ public class ServerFunctionManager {
}
public void tick() {
- this.executeTagFunctions(this.ticking, ServerFunctionManager.TICK_FUNCTION_TAG);
+ //this.executeTagFunctions(this.ticking, ServerFunctionManager.TICK_FUNCTION_TAG); // DivineMC - moved down
if (this.postReload) {
this.postReload = false;
Collection<CommandFunction> collection = this.library.getTag(ServerFunctionManager.LOAD_FUNCTION_TAG);
this.executeTagFunctions(collection, ServerFunctionManager.LOAD_FUNCTION_TAG);
}
+ this.executeTagFunctions(this.ticking, ServerFunctionManager.TICK_FUNCTION_TAG); // DivineMC - fix tick function tag running before load
}

View File

@@ -3,12 +3,12 @@ From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 19 Mar 2023 19:07:20 +0300
Subject: [PATCH] NoChatReports Implementation
idk why, but server status has been updated. waiting for ncr
diff --git a/src/main/java/gq/bxteam/divinemc/DivineConfig.java b/src/main/java/gq/bxteam/divinemc/DivineConfig.java
index 541acfc832fe4caa13b5fb46bc455fc6a7294af8..8749af60221b53efa9f4bce43bbdad166a3f4506 100644
--- a/src/main/java/gq/bxteam/divinemc/DivineConfig.java
+++ b/src/main/java/gq/bxteam/divinemc/DivineConfig.java
@@ -131,4 +131,14 @@ public class DivineConfig {
--- a/src/main/java/gq/bxteam/divinemc/DivineConfig.java (revision 5273f89dd19146a784cf4c584647befb8099b105)
+++ b/src/main/java/gq/bxteam/divinemc/DivineConfig.java (date 1679415878866)
@@ -131,4 +131,14 @@
return config.getStringList(key);
}

View File

@@ -3,6 +3,7 @@ From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Tue, 14 Mar 2023 21:03:19 +0300
Subject: [PATCH] Update Bungeecord Chat API
ok, it will be build 9
diff --git a/build.gradle.kts b/build.gradle.kts
index 181e9cd8623995f40e696ccfe49754dc340405d8..ba11fc979aac6f9a4bc812bc83b42b5ff2916b6d 100644
@@ -12,7 +13,7 @@ index 181e9cd8623995f40e696ccfe49754dc340405d8..ba11fc979aac6f9a4bc812bc83b42b5f
// api dependencies are listed transitively to API consumers
api("com.google.guava:guava:31.1-jre")
api("com.google.code.gson:gson:2.10")
- api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.6") // Paper
- api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.9") // Paper
+ api("net.md-5:bungeecord-chat:1.19-R0.1-SNAPSHOT") // Paper // DivineMC
api("org.yaml:snakeyaml:1.33")
// Paper start

View File

@@ -4,7 +4,7 @@ Date: Tue, 4 Jun 2019 15:50:08 -0500
Subject: [PATCH] Fix 'outdated server' showing in ping before server fully
boots
Original code by PurpurMC, licensed under MIT
Original code by PurpurMC, licensed under MIT (removed now)
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Divine Branding
diff --git a/build.gradle.kts b/build.gradle.kts
index 530159ef6307e092279824488652bbc94d3ad387..df5c8abe5fe5428f99fab668583c0af986adbd27 100644
index 3c8293f002f11b430083502362fdc801f44aa138..506456fd003dda0d544c9800301b1210a5d18457 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins {
@@ -196,10 +196,10 @@ index 0000000000000000000000000000000000000000..0dc13e363448d7a0f20993e0576af625
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 33a5e900c2cab99c311fa5f5b71a609cf8f802cb..0b414bcb1799d895d8d1b7dce42d7d5bee265ec8 100644
index 6d5e9400892b86562519a893349ca55e566bfb24..9945d6efac1e1ea0d22d6fdfe8aa5d2805c615b2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1683,7 +1683,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
@@ -209,10 +209,10 @@ index 33a5e900c2cab99c311fa5f5b71a609cf8f802cb..0b414bcb1799d895d8d1b7dce42d7d5b
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7ddf52de4b095f63c75b696008fcdde6345fc3c8..cfb665cf895cd96d1b6f78267abfd2c1ac113312 100644
index b2d94582037c091bd6a04451bf62b3f9c4923d19..efc137a8a9f1da4a7ffff6028af368cc7f90d20a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
@@ -256,7 +256,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
@@ -222,10 +222,10 @@ index 7ddf52de4b095f63c75b696008fcdde6345fc3c8..cfb665cf895cd96d1b6f78267abfd2c1
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f30621be24c6c3a4f173436fce1ad1c13507c84f..07c2991774323e051844aa83a80b9fdaa0cbeb63 100644
index 4966a1e3dd35357a8ea6a7d2944c84c9c3e9058e..5b4d42fd74a32e4e97690f0cd9a33c66dc1ae141 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -278,7 +278,7 @@ public class Main {
@@ -285,7 +285,7 @@ public class Main {
if (buildDate.before(deadline.getTime())) {
// Paper start - This is some stupid bullshit
System.err.println("*** Warning, you've not updated in a while! ***");
@@ -235,7 +235,7 @@ index f30621be24c6c3a4f173436fce1ad1c13507c84f..07c2991774323e051844aa83a80b9fda
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
// Paper End
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0ccde7fe2a852f7da72f0b3f5a53cb48d28d1840..29c26e1ffa1d5212df6cdc954a286aba41fb50c3 100644
index d4f62940504e3ef7a70e13b1f4a7726f23b4c637..bd21dd728b6d47d354aeb879b083394e186d6a5c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -464,7 +464,7 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index c1172ba542bc07e0c780a50d5b4ce26ac04c1720..4ebbd0bbbecb07eb1950231cf0b3a7f25e09f1c9 100644
index 82bce6109d59cba30178a446f0ff129da6f3692f..28f3145193e8bc22f3bbd0442248ea09ccc91973 100644
--- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java
@@ -191,7 +191,7 @@ public enum Direction implements StringRepresentable {
@@ -192,7 +192,7 @@ public enum Direction implements StringRepresentable {
}
public Direction getOpposite() {
@@ -19,7 +19,7 @@ index c1172ba542bc07e0c780a50d5b4ce26ac04c1720..4ebbd0bbbecb07eb1950231cf0b3a7f2
}
public Direction getClockWise(Direction.Axis axis) {
@@ -441,7 +441,7 @@ public enum Direction implements StringRepresentable {
@@ -442,7 +442,7 @@ public enum Direction implements StringRepresentable {
}
public static Direction getRandom(RandomSource random) {
@@ -29,7 +29,7 @@ index c1172ba542bc07e0c780a50d5b4ce26ac04c1720..4ebbd0bbbecb07eb1950231cf0b3a7f2
public static Direction getNearest(double x, double y, double z) {
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..c5ff387a78693b0d5b18653dae67eb4a03324ff7 100644
index ffc76354ead6937daf366c3d87bcb51d3e4c47f5..5be83bcfc719db1a71b00dc4a88fd794476a8ad9 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -16,6 +16,15 @@ public class AABB {

View File

@@ -295,10 +295,10 @@ index 0000000000000000000000000000000000000000..4128567173d3985257a1bdd4412c7db0
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index edd2c236ca7c37e1a3aec0048b8974f4cd62f2cc..f7da7be380062eb052ac0549f9d9dc810d6218a3 100644
index 6aec1983a0236d6aa0507a2b3ad1c08b3330f0fc..78069d2dbd4ee5624e99a76547cbba354ef0b96e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -116,9 +116,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -118,9 +118,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public static final int TICKS_PER_DAY = 24000;
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
public static final int MIN_ENTITY_SPAWN_Y = -20000000;

View File

@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0b414bcb1799d895d8d1b7dce42d7d5bee265ec8..3a378940093d2990b95a2097973fafe38589d4e9 100644
index 9945d6efac1e1ea0d22d6fdfe8aa5d2805c615b2..b91a634777065969a4f3bb569a32c3645d42c4af 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1096,6 +1096,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1098,6 +1098,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot End
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system
@@ -29,10 +29,10 @@ index 0b414bcb1799d895d8d1b7dce42d7d5bee265ec8..3a378940093d2990b95a2097973fafe3
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index cfb665cf895cd96d1b6f78267abfd2c1ac113312..ffde3c96f0593ca9719a3e1fb24ee5839b57f6db 100644
index efc137a8a9f1da4a7ffff6028af368cc7f90d20a..b8f51b262561fce967f99801ad595de8faaddd0d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2924,6 +2924,12 @@ public final class CraftServer implements Server {
@@ -2922,6 +2922,12 @@ public final class CraftServer implements Server {
public CraftPotionBrewer getPotionBrewer() {
return this.potionBrewer;
}

View File

@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4b754f6eae683248d7fe11d6d6cb168d5dd696a2..18cfe7746b1b6e04b22fc73345b789d5807dfa35 100644
index c0c14766adaac855112f85a203a6163b8adfdded..d4e3bc6dc71740d2f989e87f9b5cc48ac96ba8d5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -695,13 +695,19 @@ public abstract class PlayerList {
@@ -702,13 +702,19 @@ public abstract class PlayerList {
if (getBans().isBanned(gameprofile) && (gameprofilebanentry = getBans().get(gameprofile)) != null) {
// Paper end

View File

@@ -7,10 +7,10 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/PatinaMC/Patina
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7d6d3c8556033d289fdadc489e73fba478fce41a..180e189fb657453fd395ed0e845d3d90d883d08c 100644
index ca5291a9573a62cb5c19539cf5c7aceff11f9829..5f3658625c05e9e1ff3e4685ce4cb5f6eb66cc49 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -390,7 +390,7 @@ public class ServerPlayer extends Player {
@@ -396,7 +396,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
@@ -19,7 +19,7 @@ index 7d6d3c8556033d289fdadc489e73fba478fce41a..180e189fb657453fd395ed0e845d3d90
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
@@ -427,7 +427,7 @@ public class ServerPlayer extends Player {
@@ -433,7 +433,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);

View File

@@ -7,10 +7,10 @@ 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/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index 4ebbd0bbbecb07eb1950231cf0b3a7f25e09f1c9..61eadbc9bf353319d98df1135ded05dfe9bcc3f4 100644
index 28f3145193e8bc22f3bbd0442248ea09ccc91973..28ecd137dd37759e7890d71635289c3f6e994b87 100644
--- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java
@@ -247,6 +247,12 @@ public enum Direction implements StringRepresentable {
@@ -248,6 +248,12 @@ public enum Direction implements StringRepresentable {
case EAST:
var10000 = SOUTH;
break;
@@ -23,7 +23,7 @@ index 4ebbd0bbbecb07eb1950231cf0b3a7f25e09f1c9..61eadbc9bf353319d98df1135ded05df
default:
throw new IllegalStateException("Unable to get Y-rotated facing of " + this);
}
@@ -359,6 +365,12 @@ public enum Direction implements StringRepresentable {
@@ -360,6 +366,12 @@ public enum Direction implements StringRepresentable {
case EAST:
var10000 = NORTH;
break;

View File

@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f7da7be380062eb052ac0549f9d9dc810d6218a3..0cfcf1c1c4f2fe0658b212b076e2cf9f7f0e974b 100644
index 78069d2dbd4ee5624e99a76547cbba354ef0b96e..234d7c309bd386862b6f9ddc8dc2d469ecf30030 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -175,8 +175,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -179,8 +179,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
@@ -21,7 +21,7 @@ index f7da7be380062eb052ac0549f9d9dc810d6218a3..0cfcf1c1c4f2fe0658b212b076e2cf9f
private int tileTickPosition;
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
@@ -370,8 +370,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -376,8 +376,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper

View File

@@ -7,10 +7,10 @@ Original code by Starlis, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/starlis/empirecraft
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
index 5406925cd66f46ab8744123c670d72cea7bfc3a1..ba9b29db6d6b9e73e1b8d305ad1d7e855290e758 100644
index fca27f98989bf106060ba08196255fe32f850df5..d154a5d84cbb56f62a028d32ff48e9eb0a5dd829 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -358,4 +358,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
@@ -357,4 +357,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public boolean isAttackable() {
return false;
}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Paper PR - BoneMeal API
diff --git a/src/main/java/net/minecraft/world/item/BoneMealItem.java b/src/main/java/net/minecraft/world/item/BoneMealItem.java
index 664c3a6b34035ebeff19926be311b1fd6f08dc19..dd67f7b3a4e7bf4d648a1b955b0beeec8cad9bd5 100644
index c26665bc59c18c4da467fb6ae33e51a65ecf1de6..db31b8e00f63f3fa265dcc669816a5a250ee4910 100644
--- a/src/main/java/net/minecraft/world/item/BoneMealItem.java
+++ b/src/main/java/net/minecraft/world/item/BoneMealItem.java
@@ -36,15 +36,17 @@ public class BoneMealItem extends Item {
@@ -39,7 +39,7 @@ index 664c3a6b34035ebeff19926be311b1fd6f08dc19..dd67f7b3a4e7bf4d648a1b955b0beeec
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 54932d92b13b890b07f827c5f09bd137383d4ab5..c56005e062f2b5ce38109e4666c07b941fe22149 100644
index 5e9055fdf411029ea2fed91acd6b981f79156418..d3ceb6925c86640663439a9dc413df1d9126cc5f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2394,5 +2394,43 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@@ -7,7 +7,7 @@ Original code by Starlis, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/starlis/empirecraft
diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
index 06e3a868e922f1b7a586d0ca28f64a67ae463b68..00c481ebf012efa5424e32521e7aecf4b36f24c0 100644
index ee7d29d85c8b024c9b23cba8ecd4192aa7e8aa7b..e50d8c5f6c4f2aa672732d1d42c4995c9b377530 100644
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
@@ -58,6 +58,7 @@ public class GiveCommand {

View File

@@ -7,7 +7,7 @@ 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/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index f80545f80948db27d1fbde77d0505c916eb504ed..95a6284026d17567deb7416abe2bc4d6975aaaf8 100644
index c73024cc62490c336ffe26313580e88d25ca7078..690d498a97b943a62e8ea415450ca44a2349fee0 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -178,6 +178,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {

View File

@@ -10,7 +10,7 @@ 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/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 9788e477ff1446ad2ea3669922cc7dfc09900ce8..056ba60a855a2628e0b72ceaa3257da756ee61d9 100644
index 5d6d26cfe8f0ab68a3145214b3fc126ca7a71a66..6d00e5d22147ae69de3723a46eabf0ecc577d421 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -312,7 +312,7 @@ public abstract class AbstractArrow extends Projectile {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Skip cloning loot parameters
diff --git a/src/main/java/net/minecraft/advancements/Advancement.java b/src/main/java/net/minecraft/advancements/Advancement.java
index dd4409790524293be07483f00df05d8a8743e3d9..49b40fd9adea5b6dc1d304c172acdc5da4f148fd 100644
index 31ef13a708db2e4a664b30090a562eb6e4597bab..f18357d4dffbfe35d7c205fec0cc026020afdf25 100644
--- a/src/main/java/net/minecraft/advancements/Advancement.java
+++ b/src/main/java/net/minecraft/advancements/Advancement.java
@@ -45,7 +45,7 @@ public class Advancement {

View File

@@ -7,10 +7,10 @@ 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/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d939b1e3bc101e66bc1019cf49d8079665dadfcc..3d78c10a5442bfa5d4beae2546378b3822f0465d 100644
index 3ce4dbf4eed442d89d6bbc8e4c6a000172041da5..364d899f4fba65f0ecae522c7dde4f1ef8ee632e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -995,7 +995,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -998,7 +998,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.anyPlayerCloseEnoughForSpawning(this.getUpdatingChunkIfPresent(chunkcoordintpair.toLong()), chunkcoordintpair, reducedRange);
}

View File

@@ -8,10 +8,10 @@ the displayed hunger bar never goes down. Hunger (or any related value, includin
should not go down on peaceful. See https://bugs.mojang.com/browse/MC-31819.
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 61597ebe2f9faff43994c475074b87d11905e582..6f6fdab36ed5a912ad655a466dd16644eb7139fc 100644
index 2b02800666b358159c8ecb63208a14855f90657b..f68d53f085f4cb9ae94f5aa110ca0bd2a88aa5e1 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1901,6 +1901,7 @@ public abstract class Player extends LivingEntity {
@@ -1896,6 +1896,7 @@ public abstract class Player extends LivingEntity {
}
public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {

View File

@@ -8,10 +8,10 @@ Original project: https://github.com/PaperMC/Velocity
Paper pull request: https://github.com/PaperMC/Paper/pull/8418
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 32ee4ed11aefd82dca2e3e78b3108f041fdc3695..888a9fd7b13630fec814d23f0a2035f88cffa6e8 100644
index 9938bb90bef84cf784f9a1ceb02a1a45aa8b48a1..015685c97dc4a3485e009e0bf6c8f04302249578 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -93,15 +93,18 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -102,15 +102,18 @@ public class FriendlyByteBuf extends ByteBuf {
this.source = parent;
}
@@ -37,7 +37,7 @@ index 32ee4ed11aefd82dca2e3e78b3108f041fdc3695..888a9fd7b13630fec814d23f0a2035f8
public static int getVarLongSize(long value) {
for (int j = 1; j < 10; ++j) {
@@ -565,7 +568,22 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -612,7 +615,22 @@ public class FriendlyByteBuf extends ByteBuf {
return new UUID(this.readLong(), this.readLong());
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-238526
diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
index 18389f46902bb9879ac6d734723e9a720724dc48..a50dff923743c9f916747abbf5c7d8c729ac8efe 100644
index 35cfa366baf6747105faa93f1220bb9cc31a5bd5..55d2a130d056da10b79d5291ab5e4ad7a809972f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -83,6 +83,6 @@ public abstract class WaterAnimal extends PathfinderMob {
@@ -82,6 +82,6 @@ public abstract class WaterAnimal extends PathfinderMob {
i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i);
j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j);
// Paper end

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 40f0e57bed6866bff69231b9135987ca53125ba3..1e358cdabca103d65410b340db96a1ad6e479c59 100644
index a85e788ff5a55288df753a0e630b32270760f8de..ebb3808fbaaec82283db0839335b5efca28d4881 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -608,11 +608,18 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -604,11 +604,18 @@ public class Block extends BlockBehaviour implements ItemLike {
private final BlockState first;
private final BlockState second;
private final Direction direction;
@@ -29,7 +29,7 @@ index 40f0e57bed6866bff69231b9135987ca53125ba3..1e358cdabca103d65410b340db96a1ad
}
public boolean equals(Object object) {
@@ -628,11 +635,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -624,11 +631,7 @@ public class Block extends BlockBehaviour implements ItemLike {
}
public int hashCode() {

View File

@@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3073b34a0e0281b6b0330721bb0440147de28511..f150d57ed1acc8423e86b1345ad3e1091c73ba95 100644
index 8a2429f915da389360dcb16609fef7701b4a863a..bc8cdffb58369a5c1796d3323ed1facbedf9c823 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -299,6 +299,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -20,7 +20,7 @@ index 3073b34a0e0281b6b0330721bb0440147de28511..f150d57ed1acc8423e86b1345ad3e109
public boolean onGround;
public boolean horizontalCollision;
public boolean verticalCollision;
@@ -1034,6 +1035,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1035,6 +1036,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end - detailed watchdog information
public void move(MoverType movementType, Vec3 movement) {
@@ -33,7 +33,7 @@ index 3073b34a0e0281b6b0330721bb0440147de28511..f150d57ed1acc8423e86b1345ad3e109
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
synchronized (this.posLock) {
@@ -3817,6 +3824,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3862,6 +3869,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setBoundingBox(AABB boundingBox) {

View File

@@ -9,10 +9,10 @@ Original license: GNU Lesser General Public License v3.0
Original project: https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f150d57ed1acc8423e86b1345ad3e1091c73ba95..49537da22dfc5f99edd64fbe351987ecb5ff4826 100644
index bc8cdffb58369a5c1796d3323ed1facbedf9c823..e273fed8e97c98bf5735d3a8c301968990d4cf32 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2610,39 +2610,64 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2623,39 +2623,64 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return !this.isRemoved();
}

View File

@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
index c15e4d95baacd30f9614dc5526dc8fc12ae5bd06..8577f80ccf84705b94d2cd1007a1a28ec3432d41 100644
index 29d1f78dbc8410f9292f409b17705acde55979df..81b9cbc717283021fc902337102fbb3af35db101 100644
--- a/src/main/java/net/minecraft/world/level/GameRules.java
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
@@ -27,6 +27,7 @@ import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
@@ -18,7 +18,7 @@ index c15e4d95baacd30f9614dc5526dc8fc12ae5bd06..8577f80ccf84705b94d2cd1007a1a28e
public class GameRules {
@@ -118,14 +119,16 @@ public class GameRules {
@@ -120,14 +121,16 @@ public class GameRules {
public GameRules() {
// Pufferfish start - use this to ensure gameruleArray is initialized

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index 61eadbc9bf353319d98df1135ded05dfe9bcc3f4..90297e355d2009ca134ff786925dd3c2ac3a08cc 100644
index 28ecd137dd37759e7890d71635289c3f6e994b87..c31da8e3709168d87ceb44826c9dee9fe7e117f0 100644
--- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java
@@ -41,7 +41,7 @@ public enum Direction implements StringRepresentable {
@@ -42,7 +42,7 @@ public enum Direction implements StringRepresentable {
private final Direction.Axis axis;
private final Direction.AxisDirection axisDirection;
private final Vec3i normal;

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 120c0804010fd5b38a5f806ca580962ff8b47339..577e6744eab8e01a1fab414e53c2263f1997def5 100644
index 791f672b30f2a4d3b329e2ce0f4fb9c2ca627b01..dcbeffd0b4ea7c245ac83fe7e097794fc24fe4e8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3478,6 +3478,8 @@ public abstract class LivingEntity extends Entity {
@@ -3440,6 +3440,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
private void updateFallFlying() {

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 577e6744eab8e01a1fab414e53c2263f1997def5..f24b8baf01c4e25c0ddff6f7726d1ac6d5345930 100644
index dcbeffd0b4ea7c245ac83fe7e097794fc24fe4e8..85f4b06cf4062fcc8199b66dd926dbe352584210 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2519,6 +2519,8 @@ public abstract class LivingEntity extends Entity {
@@ -2459,6 +2459,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void updateSwingTime() {

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f24b8baf01c4e25c0ddff6f7726d1ac6d5345930..857fb16dfb9593ea1ef1da7c4f80f0f7f5a729f7 100644
index 85f4b06cf4062fcc8199b66dd926dbe352584210..be8060a46399f5d9c09003c2144f4b46b659cef5 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -570,11 +570,11 @@ public abstract class LivingEntity extends Entity {
@@ -565,11 +565,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void tryAddFrost() {
@@ -24,7 +24,7 @@ index f24b8baf01c4e25c0ddff6f7726d1ac6d5345930..857fb16dfb9593ea1ef1da7c4f80f0f7
if (attributemodifiable == null) {
return;
@@ -584,7 +584,7 @@ public abstract class LivingEntity extends Entity {
@@ -579,7 +579,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
attributemodifiable.addTransientModifier(new AttributeModifier(LivingEntity.SPEED_MODIFIER_POWDER_SNOW_UUID, "Powder snow slow", (double) f, AttributeModifier.Operation.ADDITION));
}

View File

@@ -309,7 +309,7 @@ index acae3eb30e0689048937f479dc3070f0688abdad..9c2b79655f2c63a208c7087d5d897db0
int onResize(int newBits, T object);
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 3c7ef1e8e338a84eee34f39ce73e64876632ea87..ade64cbde3e9929557c3c7305af2568bc350938f 100644
index 7c770d131d39da6900fdd22df36707d5f43e8cd0..34e98db58044d87c8264c977e16dd17a36182501 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -22,8 +22,23 @@ import net.minecraft.util.Mth;
@@ -336,7 +336,7 @@ index 3c7ef1e8e338a84eee34f39ce73e64876632ea87..ade64cbde3e9929557c3c7305af2568b
private static final int MIN_PALETTE_BITS = 0;
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
return 0;
@@ -299,30 +314,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -303,30 +318,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // Paper - synchronize
this.acquire();
@@ -408,7 +408,7 @@ index 3c7ef1e8e338a84eee34f39ce73e64876632ea87..ade64cbde3e9929557c3c7305af2568b
}
private static <T> void swapPalette(int[] is, IntUnaryOperator applier) {
@@ -362,17 +401,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -366,17 +405,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@Override
public void count(PalettedContainer.CountConsumer<T> counter) {

View File

@@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..493661ff3ac7247b68b7b02784b09b0e
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index b1d12c78edf21cc29a9f9ca54e7957ddc8875ffb..b52dc7290d40ed68d6ce3cfa6dd071ab98242b19 100644
index b37e0ff164a894d2033fb94bbbc2f630a0e66bcd..79eae7a38ecfdf438f13ec7573326585b3c5f466 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -18,6 +18,12 @@ import net.minecraft.world.phys.AABB;
@@ -154,7 +154,7 @@ index b1d12c78edf21cc29a9f9ca54e7957ddc8875ffb..b52dc7290d40ed68d6ce3cfa6dd071ab
@Immutable
public class BlockPos extends Vec3i {
@@ -288,7 +294,18 @@ public class BlockPos extends Vec3i {
@@ -279,7 +285,18 @@ public class BlockPos extends Vec3i {
};
}

View File

@@ -9,10 +9,10 @@ Original code by RelativityMC, licensed under MIT
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 3d78c10a5442bfa5d4beae2546378b3822f0465d..d87f255670b9969040b26c9ba5571ceb2799756f 100644
index 364d899f4fba65f0ecae522c7dde4f1ef8ee632e..6ae3f09f01e7ad72d46aeb950cca83b0d2a8d88b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -114,6 +114,7 @@ import org.bukkit.entity.Player;
@@ -117,6 +117,7 @@ import org.bukkit.entity.Player;
// CraftBukkit end
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper
@@ -20,7 +20,7 @@ index 3d78c10a5442bfa5d4beae2546378b3822f0465d..d87f255670b9969040b26c9ba5571ceb
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
@@ -295,7 +296,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -298,7 +299,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper - rewrite chunk system
this.tickingGenerated = new AtomicInteger();
this.playerMap = new PlayerMap();

View File

@@ -43,7 +43,7 @@ index 01bdf134fc21220ab7ecca51f2dcd51c0b466bba..83373befc7357094a13c74bf87ac1480
public boolean useDimensionTypeForCustomSpawners = false;
public boolean strictAdvancementDimensionCheck = false;
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
index 4532f3a0d74feae0a1249b53e1bfbc18a8808b32..dc7a555c8e2ccdf1b0451759efc33e915a416abe 100644
index 51cf0014c4229fc8671804d885b6381996810130..b4a3207ddb31d44e95732f2f01fbaceadfbf01b2 100644
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -115,9 +115,9 @@ public class WorldConfiguration extends ConfigurationPart {

View File

@@ -0,0 +1,208 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SoSeDiK <mrsosedik@gmail.com>
Date: Fri, 2 Dec 2022 21:44:23 +0200
Subject: [PATCH] Dynamic minecart speed
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 9a80cf593bbdd7681bc9395daf4545a98e07636f..012d4ad1651d7a9118b24e0589d8bdf28ed0b708 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -573,7 +573,108 @@ public abstract class AbstractMinecart extends Entity {
d5 = -d5;
}
- double d8 = Math.min(2.0D, vec3d1.horizontalDistance());
+ // Kiterino start - dynamic minecart speed
+ double vanillaMaxHorizontalMovementPerTick = 0.4D;
+ double horizontalMomentumPerTick = vec3d1.horizontalDistance();
+
+ java.util.function.DoubleSupplier calculateMaxHorizontalMovementPerTick = () -> {
+ final double fallbackSpeedFactor = 1.15D;
+ double fallback = this.getMaxSpeed();
+
+ if (this.getPassengers().isEmpty())
+ return fallback;
+
+ if (horizontalMomentumPerTick < vanillaMaxHorizontalMovementPerTick)
+ return fallback;
+
+ fallback *= fallbackSpeedFactor;
+
+ boolean hasEligibleShape = blockpropertytrackposition == RailShape.NORTH_SOUTH || blockpropertytrackposition == RailShape.EAST_WEST;
+ if (!hasEligibleShape)
+ return fallback;
+
+ boolean hasEligibleType = state.is(Blocks.RAIL) || (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED));
+ if (!hasEligibleType)
+ return fallback;
+
+ var eligibleNeighbors = new java.util.concurrent.atomic.AtomicInteger();
+
+ java.util.HashSet<BlockPos> checkedPositions = new java.util.HashSet<>();
+ checkedPositions.add(pos);
+
+ java.util.function.BiFunction<BlockPos, RailShape, java.util.ArrayList<Pair<BlockPos, RailShape>>> checkNeighbors = (cPos, cRailShape) -> {
+ Pair<Vec3i, Vec3i> cAdjPosDiff = AbstractMinecart.exits(cRailShape);
+ java.util.ArrayList<Pair<BlockPos, RailShape>> newNeighbors = new java.util.ArrayList<>();
+
+ BlockPos n1Pos = cPos.offset(cAdjPosDiff.getFirst());
+
+ if (!checkedPositions.contains(n1Pos)) {
+ BlockState n1State = this.level.getBlockState(n1Pos);
+ boolean n1HasEligibleType = n1State.is(Blocks.RAIL) || (n1State.is(Blocks.POWERED_RAIL) && n1State.getValue(PoweredRailBlock.POWERED));
+ if (!n1HasEligibleType)
+ return new java.util.ArrayList<>();
+
+ RailShape n1RailShape = n1State.getValue(((BaseRailBlock) n1State.getBlock()).getShapeProperty());
+ if (n1RailShape != blockpropertytrackposition)
+ return new java.util.ArrayList<>();
+
+ checkedPositions.add(n1Pos);
+ eligibleNeighbors.incrementAndGet();
+ newNeighbors.add(Pair.of(n1Pos, n1RailShape));
+ }
+
+ BlockPos n2Pos = cPos.offset(cAdjPosDiff.getSecond());
+ if (!checkedPositions.contains(n2Pos)) {
+ BlockState n2State = this.level.getBlockState(n2Pos);
+ boolean n2HasEligibleType = n2State.is(Blocks.RAIL) || (n2State.is(Blocks.POWERED_RAIL) && n2State.getValue(PoweredRailBlock.POWERED));
+ if (!n2HasEligibleType)
+ return new java.util.ArrayList<>();
+
+ RailShape n2RailShape = n2State.getValue(((BaseRailBlock) n2State.getBlock()).getShapeProperty());
+
+ if (n2RailShape != blockpropertytrackposition)
+ return new java.util.ArrayList<>();
+
+ checkedPositions.add(n2Pos);
+ eligibleNeighbors.incrementAndGet();
+ newNeighbors.add(Pair.of(n2Pos, n2RailShape));
+ }
+
+ return newNeighbors;
+ };
+
+
+ java.util.ArrayList<Pair<BlockPos, RailShape>> newNeighbors = checkNeighbors.apply(pos, blockpropertytrackposition);
+
+ while (!newNeighbors.isEmpty() && eligibleNeighbors.get() < 16) {
+ java.util.ArrayList<Pair<BlockPos, RailShape>> tempNewNeighbors = new java.util.ArrayList<>(newNeighbors);
+ newNeighbors.clear();
+
+ for (Pair<BlockPos, RailShape> newNeighbor : tempNewNeighbors) {
+ java.util.ArrayList<Pair<BlockPos, RailShape>> result = checkNeighbors.apply(newNeighbor.getFirst(), newNeighbor.getSecond());
+
+ if (result.isEmpty()) {
+ newNeighbors.clear();
+ break;
+ }
+
+ newNeighbors.addAll(result);
+ }
+ }
+
+ int eligibleForwardRailTrackCount = eligibleNeighbors.get() / 2;
+
+ if (eligibleForwardRailTrackCount <= 1)
+ return fallback;
+
+ return (2.01D + eligibleForwardRailTrackCount * 4D) / 20D;
+ };
+
+ double maxHorizontalMovementPerTick = calculateMaxHorizontalMovementPerTick.getAsDouble();
+ double maxHorizontalMomentumPerTick = Math.max(maxHorizontalMovementPerTick * 5D, 4.2D);
+ // Kiterino end
+
+ double d8 = Math.min(maxHorizontalMomentumPerTick, vec3d1.horizontalDistance()); // Kiterino - dynamic minecart speed, unhardcode 2.0D
vec3d1 = new Vec3(d8 * d4 / d6, vec3d1.y, d8 * d5 / d6);
this.setDeltaMovement(vec3d1);
@@ -596,8 +697,15 @@ public abstract class AbstractMinecart extends Entity {
d11 = this.getDeltaMovement().horizontalDistance();
if (d11 < 0.03D) {
this.setDeltaMovement(Vec3.ZERO);
- } else {
- this.setDeltaMovement(this.getDeltaMovement().multiply(0.5D, 0.0D, 0.5D));
+ }
+ else {
+ // Kiterino start - dynamic minecart speed
+ double brakeFactor = 0.5D;
+ if (horizontalMomentumPerTick > 4D * vanillaMaxHorizontalMovementPerTick) {
+ brakeFactor = Math.pow(brakeFactor, 1D + ((horizontalMomentumPerTick - 3.99D * vanillaMaxHorizontalMovementPerTick) / 1.2D));
+ }
+ // Kiterino end
+ this.setDeltaMovement(this.getDeltaMovement().multiply(brakeFactor, 0.0D, brakeFactor)); // Kiterino - dynamic minecart speed, unhardcode 0.5D
}
}
@@ -626,9 +734,10 @@ public abstract class AbstractMinecart extends Entity {
d2 = d12 + d5 * d15;
this.setPos(d0, d1, d2);
d16 = this.isVehicle() ? 0.75D : 1.0D;
- d17 = this.getMaxSpeed();
+ d17 = maxHorizontalMomentumPerTick;
vec3d1 = this.getDeltaMovement();
- this.move(MoverType.SELF, new Vec3(Mth.clamp(d16 * vec3d1.x, -d17, d17), 0.0D, Mth.clamp(d16 * vec3d1.z, -d17, d17)));
+ var movement = new Vec3(Mth.clamp(d16 * vec3d1.x, -d17, d17), 0D, Mth.clamp(d16 * vec3d1.z, -d17, d17));
+ this.move(MoverType.SELF, movement); // Kiterino - dynamic minecart speed, expose into the variable
if (baseblockposition.getY() != 0 && Mth.floor(this.getX()) - pos.getX() == baseblockposition.getX() && Mth.floor(this.getZ()) - pos.getZ() == baseblockposition.getZ()) {
this.setPos(this.getX(), this.getY() + (double) baseblockposition.getY(), this.getZ());
} else if (baseblockposition1.getY() != 0 && Mth.floor(this.getX()) - pos.getX() == baseblockposition1.getX() && Mth.floor(this.getZ()) - pos.getZ() == baseblockposition1.getZ()) {
@@ -658,26 +767,52 @@ public abstract class AbstractMinecart extends Entity {
if (i != pos.getX() || j != pos.getZ()) {
vec3d4 = this.getDeltaMovement();
d18 = vec3d4.horizontalDistance();
- this.setDeltaMovement(d18 * (double) (i - pos.getX()), vec3d4.y, d18 * (double) (j - pos.getZ()));
+ this.setDeltaMovement(d18 * Mth.clamp((double) i - pos.getX(), -1D, 1D), vec3d4.y, d18 * Mth.clamp((double) j - pos.getZ(), -1D, 1D)); // Kiterino - dynamic minecart speed, clamp values
}
if (flag) {
vec3d4 = this.getDeltaMovement();
d18 = vec3d4.horizontalDistance();
+ final double basisAccelerationPerTick = 0.021D; // Kiterino - dynamic minecart speed
if (d18 > 0.01D) {
+ // Kiterino start - dynamic minecart speed
+ if (!getPassengers().isEmpty()) {
+ // Based on 10 ticks per second basis spent per powered block we calculate a fair acceleration per tick
+ // due to spending less ticks per powered block on higher speeds (and even skipping blocks)
+ final double basisTicksPerSecond = 10D;
+ // Tps = Ticks per second
+ final double tickMovementForBasisTps = 1D / basisTicksPerSecond;
+ final double maxSkippedBlocksToConsider = 3D;
+
+ double acceleration = basisAccelerationPerTick;
+ final double distanceMovedHorizontally = movement.horizontalDistance();
+
+ if (distanceMovedHorizontally > tickMovementForBasisTps) {
+ acceleration *= Math.min((1D + maxSkippedBlocksToConsider) * basisTicksPerSecond, distanceMovedHorizontally / tickMovementForBasisTps);
+
+ // Add progressively slower (or faster) acceleration for higher speeds;
+ double highspeedFactor = 1D + Mth.clamp(-0.45D * (distanceMovedHorizontally / tickMovementForBasisTps / basisTicksPerSecond), -0.7D, 2D);
+ acceleration *= highspeedFactor;
+ }
+ this.setDeltaMovement(vec3d4.add(acceleration * (vec3d4.x / d18), 0D, acceleration * (vec3d4.z / d18)));
+ } else {
+ this.setDeltaMovement(vec3d4.add(vec3d4.x / d18 * 0.06D, 0D, vec3d4.z / d18 * 0.06D));
+ }
+ // Kiterino end
double d20 = 0.06D;
- this.setDeltaMovement(vec3d4.add(vec3d4.x / d18 * 0.06D, 0.0D, vec3d4.z / d18 * 0.06D));
+ // this.setDeltaMovement(vec3d4.add(vec3d4.x / d18 * 0.06D, 0.0D, vec3d4.z / d18 * 0.06D)); // Kiterino - dynamic minecart speed
} else {
Vec3 vec3d5 = this.getDeltaMovement();
double d21 = vec3d5.x;
double d22 = vec3d5.z;
+ final double railStopperAcceleration = basisAccelerationPerTick * 16D; // Kiterino
if (blockpropertytrackposition == RailShape.EAST_WEST) {
if (this.isRedstoneConductor(pos.west())) {
- d21 = 0.02D;
+ d21 = railStopperAcceleration; // Kiterino - dynamic minecart speed, unhardcode 0.02D
} else if (this.isRedstoneConductor(pos.east())) {
- d21 = -0.02D;
+ d21 = -railStopperAcceleration; // Kiterino - dynamic minecart speed, unhardcode -0.02D
}
} else {
if (blockpropertytrackposition != RailShape.NORTH_SOUTH) {

View File

@@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SoSeDiK <mrsosedik@gmail.com>
Date: Fri, 2 Dec 2022 23:05:04 +0200
Subject: [PATCH] Increase manual minecart speed
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 012d4ad1651d7a9118b24e0589d8bdf28ed0b708..522a04150da9473812f1ae3406664c2ea392d2ba 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -685,8 +685,8 @@ public abstract class AbstractMinecart extends Entity {
double d9 = vec3d2.horizontalDistanceSqr();
double d10 = this.getDeltaMovement().horizontalDistanceSqr();
- if (d9 > 1.0E-4D && d10 < 0.01D) {
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d2.x * 0.1D, 0.0D, vec3d2.z * 0.1D));
+ if (d9 > 1.0E-4D && d10 < 0.04D) { // Kiterino - increase max manual speed
+ this.setDeltaMovement(this.getDeltaMovement().add(vec3d2.x * 0.12D, 0.0D, vec3d2.z * 0.12D)); // Kiterino - slightly increase speed buildup
flag1 = false;
}
}

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SoSeDiK <mrsosedik@gmail.com>
Date: Sun, 4 Dec 2022 21:57:07 +0200
Subject: [PATCH] Allow placing rails on more surfaces
diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
index a3f877bf03f75cbfbd128c856322bcd427b95d21..96860dc68c7e7c59c27465a74b833e189db9d85b 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
@@ -51,7 +51,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
- return canSupportRigidBlock(world, pos.below());
+ return canSupportCenter(world, pos.below(), Direction.UP); // Kiterino
}
@Override
@@ -86,6 +86,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
}
private static boolean shouldBeRemoved(BlockPos pos, Level world, RailShape shape) {
+ if (canSupportCenter(world, pos.below(), Direction.UP)) return false; // Kiterino
if (!canSupportRigidBlock(world, pos.below())) {
return true;
} else {

View File

@@ -0,0 +1,160 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Justin <justin@justinf.dev>
Date: Wed, 24 Aug 2022 05:17:20 -0700
Subject: [PATCH] Paper PR - Add Entity hidden by default flag
Adds a boolean to the server Entity controlling if the entity should be hidden by default.
The TrackedEntity maintains a set of all players that will be able to see the entity even
when it is hidden by default. This set is modified when Player#showEntity and Player#hideEntity
are invoked. Changes are made to the way that TrackedEntity updates players when the entity is
hidden by default - if a player is not present in the above set, the update is abandoned.
This functionality is expanded when a Player is hidden by default. The player will send out
PlayerInfo packets to hide themselves from other Players when hiddenByDefault. There remains a
discrepancy when trying to getHiddenPlayers - players that are hidden by default are currently
not returned from this method, only those hidden with hideEntity or hidePlayer.
Hiding entities by default also respects precedent of keeping entities hidden when other plugins
explicitly hide them from a player. If an entity is hidden by default and by a plugin, the entity
must have the plugin that hid them from a player show them in order to be shown to a player again.
If no plugin had previously hidden the entity before the entity was hidden by default, then any
plugin that attempts to show the entity to a player will succeed in doing so.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6ae3f09f01e7ad72d46aeb950cca83b0d2a8d88b..07985de694f76e55f8eef2ac7dca6e404980519d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1515,6 +1515,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final int range;
SectionPos lastSectionPos;
public final Set<ServerPlayerConnection> seenBy = new ReferenceOpenHashSet<>(); // Paper - optimise map impl
+ public final Set<ServerPlayerConnection> showToEvenWhenHiddenByDefault = new ReferenceOpenHashSet<>(); // Paper - Entity hiddenByDefault
public TrackedEntity(Entity entity, int i, int j, boolean flag) {
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e273fed8e97c98bf5735d3a8c301968990d4cf32..21d980628bcaf80ed8809122766b626713974ed4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -400,6 +400,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean collidingWithWorldBorder; // Paper
+ public boolean hiddenByDefault; // Paper
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 57a0dbb23a32123d30c3b3572f4d129be9d97847..6286431870438767e779f37aef1e6d9dd9fbec65 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1442,4 +1442,30 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !this.getHandle().level.noCollision(this.getHandle(), aabb);
}
// Paper End - Collision API
+
+ // Paper start - Entity hiddenByDefault
+ @Override
+ public void setHiddenByDefault(boolean hiddenByDefault) {
+ this.getHandle().hiddenByDefault = hiddenByDefault;
+
+ // We need to update the players again
+ ChunkMap.TrackedEntity entityTracker = this.getHandle().tracker;
+
+ // Tracker was not initialized yet
+ if (entityTracker == null) {
+ return;
+ }
+
+ // If the entity is already hiddenByDefault, we reset our "show to" set to again hide the entity from all players that may be seeing the entity
+ // We also clear the "show to" set when we stop hiding by default
+ entityTracker.showToEvenWhenHiddenByDefault.clear();
+
+ entityTracker.updatePlayers(this.server.getHandle().getPlayers());
+ }
+
+ @Override
+ public boolean isHiddenByDefault() {
+ return this.getHandle().hiddenByDefault;
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1bada55af5d16437da4d16f9ded55f88a6121eb4..0fbc2971cdf15799c1f0beb1b3670894c41db9c8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1814,6 +1814,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap;
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) {
+ entry.showToEvenWhenHiddenByDefault.remove(this.getHandle().connection); // Paper - Entity hiddenByDefault
entry.removePlayer(this.getHandle());
}
@@ -1892,9 +1893,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
- if (entry != null && !entry.seenBy.contains(this.getHandle().connection)) {
- entry.updatePlayer(this.getHandle());
+ // Paper start - Entity hiddenByDefault
+ if (entry != null) {
+ entry.showToEvenWhenHiddenByDefault.add(this.getHandle().connection);
+
+ if (!entry.seenBy.contains(this.getHandle().connection)) {
+ entry.updatePlayer(this.getHandle());
+ }
}
+ // Paper end
server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity)); // Paper
}
// Paper start
@@ -1970,7 +1977,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {
- return entity.isVisibleByDefault() ^ this.invertedVisibilityEntities.containsKey(entity.getUniqueId());
+ // Paper start - Entity hiddenByDefault
+ boolean shownWhenHiddenByDefault = true;
+
+ if (entity.isHiddenByDefault()) {
+ ChunkMap.TrackedEntity tracker = ((CraftEntity) entity).getHandle().tracker;
+ shownWhenHiddenByDefault = tracker == null || tracker.showToEvenWhenHiddenByDefault.contains(this.getHandle().connection);
+ }
+
+ return shownWhenHiddenByDefault && (entity.isVisibleByDefault() ^ this.invertedVisibilityEntities.containsKey(entity.getUniqueId()));
+ // Paper end
}
public boolean canSee(UUID uuid) {
@@ -3143,6 +3159,30 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end
+ // Paper start - Entity hiddenByDefault
+ @Override
+ public void setHiddenByDefault(boolean hiddenByDefault) {
+ // Update server lists
+ if (hiddenByDefault) {
+ for (CraftPlayer player : this.server.getOnlinePlayers()) {
+ if (player == this || !player.canSee(this)) continue;
+
+ player.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(this.getHandle().getUUID())));
+ }
+ } else {
+ for (CraftPlayer player : this.server.getOnlinePlayers()) {
+ if (player == this || player.canSee(this)) continue;
+
+ player.getHandle().connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, this.getHandle()));
+ }
+ }
+
+ // Now, process trackers
+ super.setHiddenByDefault(hiddenByDefault);
+ }
+ // Paper end
+
+
public Player.Spigot spigot()
{
return this.spigot;