Archiviert
13
0

more work and compile fixes

Dieser Commit ist enthalten in:
Jake Potrebic 2023-06-07 15:12:41 -07:00
Ursprung e09a44e169
Commit 8f7a7ec440
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
31 geänderte Dateien mit 126 neuen und 119 gelöschten Zeilen

Datei anzeigen

@ -2846,7 +2846,7 @@ index 614e567eb1ef10ac7514909a8425e29ac3627d3d..60596c4ac2ebb8caf19d65591624275b
}
collection = icons;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9874d0d3ae16e79f2598d9c1f93a9b7cc40f56b0..19fdfbe49108b1e757ed89d995f5440815c51311 100644
index 9874d0d3ae16e79f2598d9c1f93a9b7cc40f56b0..7d95f4e919f46fd415a3cf88b1bb7c163c5065ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -608,8 +608,10 @@ public final class CraftServer implements Server {
@ -2999,7 +2999,7 @@ index 9874d0d3ae16e79f2598d9c1f93a9b7cc40f56b0..19fdfbe49108b1e757ed89d995f54408
+ }
+ } else if (emitter instanceof org.bukkit.craftbukkit.entity.CraftEntity craftEntity) {
+ final net.minecraft.world.entity.Entity entity = craftEntity.getHandle();
+ io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, entity, seed, this.playSound0(entity.getX(), entity.getY(), entity.getZ(), List.of((ServerLevel) entity.getLevel())));
+ io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, entity, seed, this.playSound0(entity.getX(), entity.getY(), entity.getZ(), List.of((ServerLevel) entity.level())));
+ } else {
+ throw new IllegalArgumentException("Sound emitter must be an Entity or self(), but was: " + emitter);
+ }
@ -3616,7 +3616,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa
public boolean isOp() {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a3a8c94b576c917428ac5c8fcab3f75b6e28880b..2118aac177923da4239ccd926af0daab87268bc8 100644
index a3a8c94b576c917428ac5c8fcab3f75b6e28880b..8beafda74a1e1c274906ba91a6f93ac8b5c85437 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -285,14 +285,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -3860,7 +3860,7 @@ index a3a8c94b576c917428ac5c8fcab3f75b6e28880b..2118aac177923da4239ccd926af0daab
+ }
+
+ private net.minecraft.network.chat.ChatType.Bound toHandle(net.kyori.adventure.chat.ChatType.Bound boundChatType) {
+ net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
+ net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
+
+ return new net.minecraft.network.chat.ChatType.Bound(
+ chatTypeRegistry.get(io.papermc.paper.adventure.PaperAdventure.asVanilla(boundChatType.type().key())),
@ -3906,7 +3906,7 @@ index a3a8c94b576c917428ac5c8fcab3f75b6e28880b..2118aac177923da4239ccd926af0daab
+ @Override
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
+ if (getHandle().connection == null) return;
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, false));
+ }
+

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable despawn distances for living entities
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index b3de20af553414369784b17139dd9185cc715db2..cb58d527b72f047299ae5ed71a29ce0178de6e6a 100644
index b3de20af553414369784b17139dd9185cc715db2..9e17033b801676f9db7739bd2ed710744f42defd 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -844,14 +844,14 @@ public abstract class Mob extends LivingEntity implements Targeting {
@ -13,7 +13,7 @@ index b3de20af553414369784b17139dd9185cc715db2..cb58d527b72f047299ae5ed71a29ce01
if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this);
- int i = this.getType().getCategory().getDespawnDistance();
+ int i = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
int j = i * i;
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
@ -21,7 +21,7 @@ index b3de20af553414369784b17139dd9185cc715db2..cb58d527b72f047299ae5ed71a29ce01
}
- int k = this.getType().getCategory().getNoDespawnDistance();
+ int k = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
int l = k * k;
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {

Datei anzeigen

@ -21,7 +21,7 @@ index 984a13267cc1bb960507bc9231359bb4bb837205..668a7c3f36cdbe48e472cb810b27ae4a
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index cb58d527b72f047299ae5ed71a29ce0178de6e6a..2dc21048b968e7aa63b5b28cacdd1ae407c06958 100644
index 9e17033b801676f9db7739bd2ed710744f42defd..3500fd0045ad670de818dc170d9c68da643592e0 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -840,7 +840,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@ -29,7 +29,7 @@ index cb58d527b72f047299ae5ed71a29ce0178de6e6a..2dc21048b968e7aa63b5b28cacdd1ae4
this.discard();
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
- Player entityhuman = this.level().getNearestPlayer(this, -1.0D);
+ Player entityhuman = this.level().getNearestPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper
+ Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper
if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this);
@ -137,7 +137,7 @@ index 127c4ebedb94631ceac92dbdcd465e904217d715..5e19b91e6fb7e5e354f55ea206b3d59e
for(Player player : this.players()) {
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ebe5ed6ec66ec5f0979c8ff2998a9d6c1539b2fe..e68f0f2cde8ab40087bf26b93d053c2a0a49436c 100644
index 5afdada0d56c2f9af431ea6485faa277229befa9..1098c95f8f27e0ff3cf593a4f0dfde0dbe4d3152 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2169,8 +2169,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -74,7 +74,7 @@ index 403f7c7f31e0072b0cad0706bc981ece24733a1d..42a44820a3c13e2b0e29e02ed384c191
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1e601581d7b6bb59ccec3c0b4a87747ec6c64f84..d3254e29df8543de33923a54b78c3af027e68b71 100644
index 17056a7ea6c6a3a671872d2be603d7dd60ae04e9..6e488fe34231afa20d0f8f62299bb631359ee51c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -875,6 +875,28 @@ public final class CraftServer implements Server {
@ -107,7 +107,7 @@ index 1e601581d7b6bb59ccec3c0b4a87747ec6c64f84..d3254e29df8543de33923a54b78c3af0
return true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index cef936dea0592b08b1cca0482d1220ffe4b2c05a..b1f69f7183b2765695446fd587527def4dd8c4c9 100644
index 484fab5eeeb92407ded625b96678c9aa93199d70..b8fc2196b8f77b826d229265e96b5cce1e5301cb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -437,7 +437,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -117,7 +117,7 @@ index cef936dea0592b08b1cca0482d1220ffe4b2c05a..b1f69f7183b2765695446fd587527def
- this.getHandle().connection.chat(msg, PlayerChatMessage.system(msg), false);
+ // Paper start - improve chat handling
+ if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {
+ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS);
+ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
+ } else {
+ if (msg.startsWith("/")) {
+ this.getHandle().connection.handleCommand(msg);

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 8357ef35c374c6a6602eb96d4281da0210aea757..04b4c7af20d6aa9924fb1d345f11cb51dcadc708 100644
index 8357ef35c374c6a6602eb96d4281da0210aea757..3bd7f52030ea5b603bba5e4a8e1d28194f89fa7f 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -35,6 +35,7 @@ import net.minecraft.stats.Stats;
@ -23,7 +23,7 @@ index 8357ef35c374c6a6602eb96d4281da0210aea757..04b4c7af20d6aa9924fb1d345f11cb51
+ // Paper start
+ if (this.pickupDelay <= 0) {
+ PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ this.level.getCraftServer().getPluginManager().callEvent(attemptEvent);
+ this.level().getCraftServer().getPluginManager().callEvent(attemptEvent);
+
+ flyAtPlayer = attemptEvent.getFlyAtPlayer();
+ if (attemptEvent.isCancelled()) {

Datei anzeigen

@ -14,7 +14,7 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I
public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e93fca6b851170232cdffc0e38bae86791ae6815..b7f071d7d0128d4c0990b59bd843fd88f8320ca8 100644
index 5af1f24c42e61ce159a3f6221411d01bdc4178c0..1ce5ec09f6fe562dace89575e2a73f727e1eb951 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1467,7 +1467,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -30,7 +30,7 @@ index e93fca6b851170232cdffc0e38bae86791ae6815..b7f071d7d0128d4c0990b59bd843fd88
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle);
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY;
+ if (!itemstack.isEmpty() && itemstack.getItem().canBeDepleted()) {
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level);
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
+ orb.value = amount;
+ orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM;
+ orb.setPosRaw(handle.getX(), handle.getY(), handle.getZ());

Datei anzeigen

@ -9,7 +9,7 @@ This can be useful for changing name or skins after a player has logged in.
public-f net.minecraft.world.entity.player.Player gameProfile
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8abd8d7e1bbdd59338725ae075117ec26d567a86..86e6e6ffdd5d8391b7a8f17bbad9b49a62339a8a 100644
index 528ef2cb78ece52e389578e5ed36287ac395b824..a72d0b6add00ba03bec76c1e22bfdb94730fe73e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1528,7 +1528,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -55,7 +55,7 @@ index e7442952ef1f03969949014492a7ddc6d0796ba5..69a1852905dd4724c30ac8ab88c14251
public Server getServer() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b7f071d7d0128d4c0990b59bd843fd88f8320ca8..407a037ae43c8cd209a9ce18359b5e0a15d9a88f 100644
index 1ce5ec09f6fe562dace89575e2a73f727e1eb951..dd81b001288c4a9144defb297a6a877b4464d0ab 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -82,6 +82,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
@ -160,8 +160,8 @@ index b7f071d7d0128d4c0990b59bd843fd88f8320ca8..407a037ae43c8cd209a9ce18359b5e0a
+ ServerGamePacketListenerImpl connection = handle.connection;
+
+ //Respawn the player then update their position and selected slot
+ ServerLevel worldserver = handle.getLevel();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA, this.getHandle().getLastDeathLocation()));
+ ServerLevel worldserver = handle.serverLevel();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA, this.getHandle().getLastDeathLocation(), handle.getPortalCooldown()));
+ handle.onUpdateAbilities();
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet());
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);

Datei anzeigen

@ -70,7 +70,7 @@ index 2eff7e1f6b63a3a72e1595a089e9ee47f42bba06..35bf922f7995074dd875474cc3d5577d
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0238b8a11f457dd667b079a35e44ac5e19a2e0cf..41a729e19abe04ad54ee2267565c935234fb6c41 100644
index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a164fcf834c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -149,7 +149,7 @@ index 0238b8a11f457dd667b079a35e44ac5e19a2e0cf..41a729e19abe04ad54ee2267565c9352
+
+ this.getCombatTracker().recheckStatus();
+ if (entity != null) {
+ entity.wasKilled((ServerLevel) this.level(), this);
+ entity.killedEntity((ServerLevel) this.level(), this);
+ }
this.gameEvent(GameEvent.ENTITY_DIE);
- this.dropAllDeathLoot(damageSource);
@ -222,7 +222,7 @@ index 0238b8a11f457dd667b079a35e44ac5e19a2e0cf..41a729e19abe04ad54ee2267565c9352
// CraftBukkit start
public int getExpReward() {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 8151da761dd2dd561384181576321c71197a84e1..b60714796725ba3dc0a17ff4ca7df8b344e838da 100644
index e1f2bb40ca7868671a869745de66f87ef3a49408..d7f24c26b0981184f43a16a27a0c5d5a931d4de3 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1068,7 +1068,13 @@ public abstract class Mob extends LivingEntity implements Targeting {
@ -354,7 +354,7 @@ index 719f68f96e58ddcdd3592131c691d21263c81915..4413b609f1250cf9477fcb3fecd7b67a
this.gameEvent(GameEvent.ENTITY_DIE);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e193632f4b795d16a62e074e082a2fd5f10b1330..a33262e0bcc98321cb7acef533973629de5278a6 100644
index 51ca4232a00f0b38050967c60aaae22366b1bc8a..fe3f5c4f3f4f5c42e4067e05f0a8bee97661c9a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2252,7 +2252,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1aec3ec3debe3adfd5fda424761b559614dfdc84..ad1fa44281b8ce907fd7434a13d29c3717296877 100644
index 1aec3ec3debe3adfd5fda424761b559614dfdc84..4736ae957f79871cdd48ea114d77c7707885c122 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -567,9 +567,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -27,7 +27,7 @@ index 1aec3ec3debe3adfd5fda424761b559614dfdc84..ad1fa44281b8ce907fd7434a13d29c37
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
+ // Paper start - Prevent moving into unloaded chunks
+ if (player.level.paperConfig().chunks.preventMovingIntoUnloadedChunks && (
+ if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (
+ !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) ||
+ !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
+ )) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Implement alternative item-despawn-rate
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 6836288bd380651007f3aa76e608767f612f6644..028fd9c7cb927cde84ee2d078681d122d7d928aa 100644
index 080b574d28b07e59b234a927a50ba8972d410664..7678199278324cce4ce736197cb8766c134a0f87 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -53,6 +53,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -21,8 +21,8 @@ index 6836288bd380651007f3aa76e608767f612f6644..028fd9c7cb927cde84ee2d078681d122
}
}
- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@ -30,12 +30,12 @@ index 6836288bd380651007f3aa76e608767f612f6644..028fd9c7cb927cde84ee2d078681d122
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -264,7 +265,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -269,7 +270,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
private boolean isMergable() {
ItemStack itemstack = this.getItem();
@ -44,20 +44,20 @@ index 6836288bd380651007f3aa76e608767f612f6644..028fd9c7cb927cde84ee2d078681d122
}
private void tryToMerge(ItemEntity other) {
@@ -505,6 +506,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -509,6 +510,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
+ this.despawnRate = level.paperConfig().entities.spawning.altItemDespawnRate.enabled ? level.paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), level.spigotConfig.itemDespawnRate) : level.spigotConfig.itemDespawnRate; // Paper
+ this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper
}
@Override
@@ -558,7 +560,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -562,7 +564,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void makeFakeItem() {
this.setNeverPickUp();
- this.age = level.spigotConfig.itemDespawnRate - 1; // Spigot
+ this.age = this.despawnRate - 1; // Spigot
- this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
+ this.age = this.despawnRate - 1; // Spigot // Paper
}
public float getSpin(float tickDelta) {

Datei anzeigen

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index bba77d5001638307fe640b2e656df0a2b3cb4c43..40177f2e0206f89b83bbc0b6c80d74785d9d8414 100644
index 97f8336108b1b96a99eb5e5650feb5832aee89fa..459d9007130c9addffd8f65b6d8f9110794f2021 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1333,6 +1333,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1860,6 +1860,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16;
@ -20,7 +20,7 @@ index bba77d5001638307fe640b2e656df0a2b3cb4c43..40177f2e0206f89b83bbc0b6c80d7478
if (j > i) {
i = j;
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
index 7ce2b657ba94c67236ab64c0029b35ee39f71c8f..71225959e1b17974374b1fb998de573ea55d85a4 100644
index 73f9563551632a5369ba55e8fe9211afc325e869..172d231adecf043f9f06b7f5e0365ae82327998d 100644
--- a/src/main/java/org/spigotmc/TrackingRange.java
+++ b/src/main/java/org/spigotmc/TrackingRange.java
@@ -7,7 +7,6 @@ import net.minecraft.world.entity.ExperienceOrb;

Datei anzeigen

@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8be765356261190a070715effbcaadfc83ab6c9c..64bd1cb6c5dd65a62df133926b969e37a3e31f76 100644
index 5ec0f3304b2ef352e3cdd73974716b1a18bb26e9..6c2e1eea451cdeec3f93fd6a24b394c8391079b6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3230,6 +3230,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3301,6 +3301,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (flag1) {
blockposition1 = ServerLevel.END_SPAWN_POINT;
} else {

Datei anzeigen

@ -252,18 +252,18 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 40177f2e0206f89b83bbc0b6c80d74785d9d8414..1c39d12a6e72954a24ad51d8d6346341dc1c5d22 100644
index 459d9007130c9addffd8f65b6d8f9110794f2021..3ab66eb22561971392616c083bae5339e6ddc493 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -152,6 +152,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -156,6 +156,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Long2LongMap chunkSaveCooldowns;
private final Queue<Runnable> unloadQueue;
int viewDistance;
+ public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper
// Paper - rewrite chunk system
@@ -164,11 +165,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -185,16 +186,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated
@ -275,7 +275,6 @@ index 40177f2e0206f89b83bbc0b6c80d74785d9d8414..1c39d12a6e72954a24ad51d8d6346341
}
void removePlayerFromDistanceMaps(ServerPlayer player) {
this.playerChunkManager.removePlayer(player); // Paper - replace chunk loader
+ // Paper start - per player mob spawning
+ if (this.playerMobDistanceMap != null) {
@ -285,10 +284,9 @@ index 40177f2e0206f89b83bbc0b6c80d74785d9d8414..1c39d12a6e72954a24ad51d8d6346341
}
void updateMaps(ServerPlayer player) {
@@ -176,6 +187,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated
this.playerChunkManager.updatePlayer(player); // Paper - replace chunk loader
+ // Paper start - per player mob spawning
+ if (this.playerMobDistanceMap != null) {
+ this.playerMobDistanceMap.update(player, chunkX, chunkZ, io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player));
@ -297,7 +295,7 @@ index 40177f2e0206f89b83bbc0b6c80d74785d9d8414..1c39d12a6e72954a24ad51d8d6346341
}
// Paper end
// Paper start
@@ -261,6 +277,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -285,6 +301,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
this.regionManagers.add(this.dataRegionManager);
// Paper end
@ -305,7 +303,7 @@ index 40177f2e0206f89b83bbc0b6c80d74785d9d8414..1c39d12a6e72954a24ad51d8d6346341
}
protected ChunkGenerator generator() {
@@ -286,6 +303,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -310,6 +327,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
@ -338,10 +336,10 @@ index 40177f2e0206f89b83bbc0b6c80d74785d9d8414..1c39d12a6e72954a24ad51d8d6346341
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c021733342c09adb04ce3f675209543f84ac4bda..d137aa95f670aab516e9e08272f33b2125b282c6 100644
index d0330d1baf89f949c05b2380ce875366802834e3..419da79f773281ffe917b712461d6df81645b19e 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -693,7 +693,18 @@ public class ServerChunkCache extends ChunkSource {
@@ -696,7 +696,18 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.push("naturalSpawnCount");
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
@ -362,7 +360,7 @@ index c021733342c09adb04ce3f675209543f84ac4bda..d137aa95f670aab516e9e08272f33b21
this.lastSpawnState = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c93ede55cdd575f0c928bc9bf90c47480e52f91b..b014f1bd167bad3e1dc613dce5c929f201ef27cc 100644
index e00a40e8637f0b73aba04b5b47bcb021c3d7e952..50a6f7f6ff5b24053d8f6eba06b0e1e5541be685 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -248,6 +248,11 @@ public class ServerPlayer extends Player {
@ -377,7 +375,7 @@ index c93ede55cdd575f0c928bc9bf90c47480e52f91b..b014f1bd167bad3e1dc613dce5c929f2
// CraftBukkit start
public String displayName;
@@ -339,6 +344,7 @@ public class ServerPlayer extends Player {
@@ -338,6 +343,7 @@ public class ServerPlayer extends Player {
this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
this.bukkitPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth();
@ -386,7 +384,7 @@ index c93ede55cdd575f0c928bc9bf90c47480e52f91b..b014f1bd167bad3e1dc613dce5c929f2
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 05c014c5f0805d50cfd251b043c79ce3355eef16..a1770e5ae4b3014c3538b52d4912c60864e186a8 100644
index f22e1d76586980edb2dc962b4d55ad7a542b61a7..a3461824fd2162d509facf6f64c5008e3f0fd42b 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -70,6 +70,12 @@ public final class NaturalSpawner {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 78fe610d69db727411bf685127c39d009090ee14..5049d72f080bb82ca0e1fc5e2348b3605a0204f1 100644
index b4d5a33bfc5616d69a3570c99ea0af52397f8ffb..6fd1c49ba12fc812ca73492294b2ca66fc94c168 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -143,7 +143,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -142,7 +142,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
public Bee(EntityType<? extends Bee> type, Level world) {
super(type, world);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);

Datei anzeigen

@ -18,10 +18,10 @@ public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraf
Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
index 943b5ee11fb066afcfb3717befe4dab35db5b600..5ecf02ce83b7496c977adfeb203b8eadb05f9da5 100644
index 6f9cb55491da718cd6564425748ab3852fda9b68..5fbdc96f29e29dfc092b9e84a988032db0fa36ab 100644
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
@@ -25,6 +25,11 @@ public class IceBlock extends HalfTransparentBlock {
@@ -27,6 +27,11 @@ public class IceBlock extends HalfTransparentBlock {
@Override
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) {
super.playerDestroy(world, player, pos, state, blockEntity, tool);
@ -34,7 +34,7 @@ index 943b5ee11fb066afcfb3717befe4dab35db5b600..5ecf02ce83b7496c977adfeb203b8ead
if (world.dimensionType().ultraWarm()) {
world.removeBlock(pos, false);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 97f0f5fac4e1ddf1f39981687d08adf6a5662457..cbe5f0a6ba85d2acafa9d0d9b1575d3ccbd11cae 100644
index 90ec90acd6cfe0dcc677c7f26493fc8184cacca8..c67de2f3bb8b048b8432add4adcb9e6042fb65ad 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -479,6 +479,18 @@ public class CraftBlock implements Block {

Datei anzeigen

@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either,
then unwrap it...
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index d137aa95f670aab516e9e08272f33b2125b282c6..f838a921a08981bac0d0c0a68e334ba06d11cb18 100644
index 419da79f773281ffe917b712461d6df81645b19e..cfc7febc84ac1bdde1a20f8ac35df915218cd910 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -421,6 +421,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -398,6 +398,12 @@ public class ServerChunkCache extends ChunkSource {
return this.getChunk(x, z, leastStatus, create);
}, this.mainThreadProcessor).join();
} else {
@ -23,8 +23,8 @@ index d137aa95f670aab516e9e08272f33b2125b282c6..f838a921a08981bac0d0c0a68e334ba0
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
gameprofilerfiller.incrementCounter("getChunk");
@@ -464,39 +470,7 @@ public class ServerChunkCache extends ChunkSource {
if (!io.papermc.paper.util.TickThread.isTickThread()) { // Paper - rewrite chunk system
@@ -444,39 +450,7 @@ public class ServerChunkCache extends ChunkSource {
if (Thread.currentThread() != this.mainThread) {
return null;
} else {
- this.level.getProfiler().incrementCounter("getChunkNow");

Datei anzeigen

@ -194,13 +194,13 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047
+ }
+}
diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java
index 8f16640fc2f1233c10392d7e32a54d784fd8e370..1e9f191dc0f9d98f4404d2796f15b13912860b13 100644
index ae046aff4b9d2ced37ee3e8e908780a807b5c4dd..1188d221be8a4f1dece514e3f66b99f60b556488 100644
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
@@ -41,6 +41,7 @@ public final class PaperCommand extends Command {
@@ -40,6 +40,7 @@ public final class PaperCommand extends Command {
commands.put(Set.of("callback"), new CallbackCommand());
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
commands.put(Set.of("fixlight"), new FixLightCommand());
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
+ commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
return commands.entrySet().stream()
@ -300,31 +300,40 @@ index 0000000000000000000000000000000000000000..95d6022c9cfb2e36ec5a71be6e343540
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index f838a921a08981bac0d0c0a68e334ba06d11cb18..665e088cb0b73f6a0c62f29c56da462bab7c927e 100644
index cfc7febc84ac1bdde1a20f8ac35df915218cd910..2cbb2a02da1e5de18613ee977dafc92af9b552e9 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -445,6 +445,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - async chunk io/loading
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
// Paper end
@@ -393,6 +393,7 @@ public class ServerChunkCache extends ChunkSource {
@Nullable
@Override
public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) {
+ final int x1 = x; final int z1 = z; // Paper - conflict on variable change
if (Thread.currentThread() != this.mainThread) {
return (ChunkAccess) CompletableFuture.supplyAsync(() -> {
return this.getChunk(x, z, leastStatus, create);
@@ -426,6 +427,7 @@ public class ServerChunkCache extends ChunkSource {
Objects.requireNonNull(completablefuture);
if (!completablefuture.isDone()) { // Paper
+ com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
this.level.timings.syncChunkLoad.startTiming(); // Paper
chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
this.level.timings.syncChunkLoad.stopTiming(); // Paper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5ae321dc30d48f838c49322b5beef89bcbc952bc..67e59ac94c584a742bf5e6e2094459234603ef06 100644
index 1ea55cced137e16dd2aebd705ea8b4494c43bc4f..203dc7444a2e6b0cfcaf0532e50ae0b22e51210e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -422,6 +422,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
return this.entityLookup;
@@ -424,6 +424,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
}
// Paper end - rewrite chunk system
+ // Paper start
+ @Override
+ public boolean hasChunk(int chunkX, int chunkZ) {
+ return this.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ) != null;
+ }
+ // Paper end
// Paper start - optimise getPlayerByUUID
@Nullable
+
/** @deprecated */
@Deprecated
@VisibleForTesting

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Remove garbage Java version check
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c79afabed432ca9094967ae0e48b04133dc4c51b..77911e26af9ec468c8a0c1fe8161b79c67b2303c 100644
index f707537227a729a48f63b86b69bbeb22743435ac..24607ed5f60ce68aeda7380c433a8b416ed885c4 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -205,10 +205,6 @@ public class Main {

Datei anzeigen

@ -7,7 +7,7 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem
(dispensers can throw eggs to hatch them, too).
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
index c400bcb9da854e3c953c269d6f74c1a4f07b82a7..326eb972078e5dd700372c9ba09ea7f8415b144e 100644
index 7a56c884cb144f8982466872ed2e0937bebf7fe8..6fd803f831cab088a67062ce8624b30338771d8e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
@@ -76,6 +76,14 @@ public class ThrownEgg extends ThrowableItemProjectile {
@ -24,4 +24,4 @@ index c400bcb9da854e3c953c269d6f74c1a4f07b82a7..326eb972078e5dd700372c9ba09ea7f8
+ // Paper end
if (hatching) {
for (int i = 0; i < b0; ++i) {
Entity entity = level.getWorld().createEntity(new org.bukkit.Location(level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
Entity entity = this.level().getWorld().createEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Entity Jump API
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 38a5d219713f7d3bb3d5ea73e4e6756a03128d01..e6e4856db7d983460fdf898583915ff2e4a43d14 100644
index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..574f8db51202c6686e7703f3193d63a1a4fefb65 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3224,8 +3224,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else if (this.isInLava() && (!this.onGround || d7 > d8)) {
@@ -3262,8 +3262,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else if (this.isInLava() && (!this.onGround() || d7 > d8)) {
this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {
} else if ((this.onGround() || flag && d7 <= d8) && this.noJumpDelay == 0) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
this.jumpFromGround();
this.noJumpDelay = 10;
@ -20,13 +20,13 @@ index 38a5d219713f7d3bb3d5ea73e4e6756a03128d01..e6e4856db7d983460fdf898583915ff2
} else {
this.noJumpDelay = 0;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index e98849c103e7409f70e73a30c6713c644155b284..2db5d8a937c841718e7b568c215109c39775d82c 100644
index f8a59afbe0f95a06e9ae6972fc664d0a0860c951..7f4ff9658b0eca2034333810fd2b199a3d186e72 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -521,7 +521,9 @@ public class Panda extends Animal {
Panda entitypanda = (Panda) iterator.next();
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
entitypanda.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
@ -34,13 +34,13 @@ index e98849c103e7409f70e73a30c6713c644155b284..2db5d8a937c841718e7b568c215109c3
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index 24dc43c7806e99be6dc37af48ec056a5edd19947..74bc42623f16042c2a72993f842614a013bfb4d0 100644
index 243397de3b0a843ec95c6b721d7fc654bfc78448..aad1fb5cf231b400dc8c192871aa4429536d53ee 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -176,7 +176,9 @@ public class Ravager extends Raider {
}
if (!flag && this.onGround) {
if (!flag && this.onGround()) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
this.jumpFromGround();
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 64bd1cb6c5dd65a62df133926b969e37a3e31f76..479586efacc17e418dd8d64d884efe67355e1844 100644
index 6c2e1eea451cdeec3f93fd6a24b394c8391079b6..a1eb5b0357d646b42031a5a21cc7740a94430558 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -388,6 +388,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -392,6 +392,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper start
public long activatedImmunityTick = Integer.MIN_VALUE; // Paper
public boolean isTemporarilyActive = false; // Paper
@ -16,7 +16,7 @@ index 64bd1cb6c5dd65a62df133926b969e37a3e31f76..479586efacc17e418dd8d64d884efe67
protected int numCollisions = 0; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@javax.annotation.Nullable
@@ -2081,6 +2082,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2148,6 +2149,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
}
@ -26,7 +26,7 @@ index 64bd1cb6c5dd65a62df133926b969e37a3e31f76..479586efacc17e418dd8d64d884efe67
// Paper end
return nbt;
} catch (Throwable throwable) {
@@ -2223,6 +2227,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2290,6 +2294,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f77bb8401f0d4b5acc64c8b707083bc251caf8e5..cdf93e8751fa2520881290b2a7385f99ec4d0dc2 100644
index 17a5d568e9ac367917e40c554aa7354088f66114..762ebbf5800a602c58b5f492c1350628a2fd13fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -366,13 +366,18 @@ public class CraftEventFactory {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
index f150afd99922bc5d2f2183ad39fd1918ce3de367..4fbbd74cda7e4f2c623db46c2c94d9697ca5df05 100644
index ce83fe0b68fcb229dd37fe07e5f21b52a60c32de..c0a7616b9095a2fc51fe03c28b533bf56bad83dd 100644
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
@@ -334,7 +334,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
@@ -325,7 +325,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata = world.getBlockState(blockposition1);

Datei anzeigen

@ -8,12 +8,12 @@ This allows you to solve an issue in vanilla behavior where:
* On normal difficulty they will have a 50% of getting infected or dying.
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index f0bad2264df3a4b4631d66dad46ec03470a206ee..23fe7c324b8faca954dbef1a5703db6a8763edf6 100644
index 69c54b68b364f58a3319154cd984069dd5b6c901..9deb1acbcc334c2e7f9cf16abe02b6128032de90 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -451,12 +451,16 @@ public class Zombie extends Monster {
public boolean wasKilled(ServerLevel world, LivingEntity other) {
boolean flag = super.wasKilled(world, other);
public boolean killedEntity(ServerLevel world, LivingEntity other) {
boolean flag = super.killedEntity(world, other);
- if ((world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) {
- Villager entityvillager = (Villager) other;

Datei anzeigen

@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it
easier to inline due to code size
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index b1471b43392863ce1f2861d07baddbd711e761dc..703830416a0483e960643bee269fe01e170112bd 100644
index 419125e865cb086f0ef75f69749cc03a178d9a41..44bcb9c4d4b3449effc4f43659ecfe32be65cf98 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -420,18 +420,20 @@ public class LevelChunk extends ChunkAccess {
@@ -380,18 +380,20 @@ public class LevelChunk extends ChunkAccess {
}
public FluidState getFluidState(int x, int y, int z) {
@ -38,7 +38,7 @@ index b1471b43392863ce1f2861d07baddbd711e761dc..703830416a0483e960643bee269fe01e
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got");
@@ -441,6 +443,7 @@ public class LevelChunk extends ChunkAccess {
@@ -401,6 +403,7 @@ public class LevelChunk extends ChunkAccess {
});
throw new ReportedException(crashreport);
}
@ -47,10 +47,10 @@ index b1471b43392863ce1f2861d07baddbd711e761dc..703830416a0483e960643bee269fe01e
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 8823751cde27bf195177282e99e9a69888441e35..8c8445af8a2fe684fdbb468f8d8605d44a803758 100644
index 2c3ea88bac229df67bd742e16d2106d80bcc8889..789664d53584c7d958572c63db22f904fb411a58 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -54,7 +54,7 @@ public class LevelChunkSection {
@@ -43,7 +43,7 @@ public class LevelChunkSection {
}
public FluidState getFluidState(int x, int y, int z) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Set spigots verbose world setting to false by def
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index a345befaee2e4703294c3941f4060c496838c496..102b038e2566cba4f259a61e502ff0808c47234c 100644
index 77698b0555c5930645659b4af061c3f428bf8f65..b7d6197cb5f46bb020fff049ae2dd8fc3ee8ff2f 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -20,7 +20,7 @@ public class SpigotWorldConfig

Datei anzeigen

@ -125,7 +125,7 @@ index d44d0074446c1c54e87dc8078dff7fef1d92f343..bbb8b1933ef33a3b91f69545f69dd3cf
public static void registerCommands(final MinecraftServer server) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2e29d1c3e5faf970bfaf3a545ef3553f284d68ef..d00545c31de383470bcb8e4d9c6edad2f39c864c 100644
index 02287a932feb98341e4e9f76538abdb1649a07ec..3d71748684264a854f0e8648a99d6c8f09b0900e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -253,6 +253,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -140,7 +140,7 @@ index 2e29d1c3e5faf970bfaf3a545ef3553f284d68ef..d00545c31de383470bcb8e4d9c6edad2
@Nullable
private KeyPair keyPair;
@Nullable
@@ -1345,6 +1350,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1349,6 +1354,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.averageTickTime = this.averageTickTime * 0.8F + (float) j / 1000000.0F * 0.19999999F;
long k = Util.getNanos();
@ -152,7 +152,7 @@ index 2e29d1c3e5faf970bfaf3a545ef3553f284d68ef..d00545c31de383470bcb8e4d9c6edad2
this.frameTimer.logFrameDuration(k - i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -2581,4 +2591,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2579,4 +2589,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static record ServerResourcePackInfo(String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
@ -184,10 +184,10 @@ index 2e29d1c3e5faf970bfaf3a545ef3553f284d68ef..d00545c31de383470bcb8e4d9c6edad2
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 456bb6cf7278a1418b39b9b2094abad3137bb508..dc1cbc8942d80e2975cc8c47d7567941b18148ea 100644
index 05af8ba7b1f3ca7a6264f38ad514b8b9cb3b33b9..f300e2e446d97a4ef0bc2b8566489a0aaed909d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2516,6 +2516,16 @@ public final class CraftServer implements Server {
@@ -2514,6 +2514,16 @@ public final class CraftServer implements Server {
net.minecraft.server.MinecraftServer.getServer().tps15.getAverage()
};
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dc1cbc8942d80e2975cc8c47d7567941b18148ea..b7dc51e29aed83fe40cc4730a1b8448b432ebff8 100644
index f300e2e446d97a4ef0bc2b8566489a0aaed909d5..7f4ee248bede39701365d200cdc4e39f7bdd8b26 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2747,5 +2747,10 @@ public final class CraftServer implements Server {
@@ -2745,5 +2745,10 @@ public final class CraftServer implements Server {
public int getCurrentTick() {
return net.minecraft.server.MinecraftServer.currentTick;
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 4aa7969297cfbbbfe4964a3f793d9f11d684a713..f6eae5756dd7919938ca8265bfeba84fba3ec644 100644
index f5f528e4520c5e52e1e9dae5228525f29e4eee92..447df549a0d371389b086327b06b74aa1d6647cd 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -468,6 +468,52 @@ public final class CraftMagicNumbers implements UnsafeValues {