Make it compile

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-06-14 18:02:15 +02:00
Ursprung 184a943ad4
Commit 5442bffab5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
13 geänderte Dateien mit 124 neuen und 43 gelöschten Zeilen

Datei anzeigen

@ -109,3 +109,16 @@ index 8eb1aca72df0bca292473e90ecb74159db4fe034..4b4dcee6abe7a6db43638d04665125ee
this.goalSelector.addGoal(3, new RangedCrossbowAttackGoal<>(this, 1.0D, 8.0F));
this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D));
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 15.0F, 1.0F));
diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
index e2b72817857a7a203aae4c9de4e01ba1396dc95b..82fc5133325a127890984d51c1381883759eb444 100644
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
@@ -153,7 +153,7 @@ public class ChunkStatusTasks {
if (protochunk instanceof ImposterProtoChunk) {
chunk1 = ((ImposterProtoChunk) protochunk).getWrapped();
} else {
- chunk1 = new LevelChunk(worldserver, protochunk, (chunk1) -> {
+ chunk1 = new LevelChunk(worldserver, protochunk, ($) -> { // Paper - decompile fix
ChunkStatusTasks.postLoadProtoChunk(worldserver, protochunk.getEntities());
});
generationchunkholder.replaceProtoChunk(new ImposterProtoChunk(chunk1, false));

Datei anzeigen

@ -2663,19 +2663,19 @@ index 0000000000000000000000000000000000000000..a5f706d6f716b2a463ae58adcde69d9e
+}
diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
new file mode 100644
index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1d59f9e7d
index 0000000000000000000000000000000000000000..0d0cb3e63acd5156b6f9d6d78cc949b0af36a77b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java
@@ -0,0 +1,296 @@
@@ -0,0 +1,303 @@
+package io.papermc.paper.chunk.system;
+
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
+import com.destroystokyo.paper.util.SneakyThrow;
+import com.mojang.datafixers.util.Either;
+import com.mojang.logging.LogUtils;
+import io.papermc.paper.util.CoordinateUtils;
+import net.minecraft.server.level.ChunkHolder;
+import net.minecraft.server.level.ChunkMap;
+import net.minecraft.server.level.ChunkResult;
+import net.minecraft.server.level.FullChunkStatus;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.server.level.ServerPlayer;
@ -2683,8 +2683,10 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.chunk.ChunkAccess;
+import net.minecraft.world.level.chunk.status.ChunkPyramid;
+import net.minecraft.world.level.chunk.status.ChunkStatus;
+import net.minecraft.world.level.chunk.LevelChunk;
+import net.minecraft.world.level.chunk.status.ChunkStep;
+import org.bukkit.Bukkit;
+import org.slf4j.Logger;
+import java.util.ArrayList;
@ -2695,6 +2697,11 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+public final class ChunkSystem {
+
+ private static final Logger LOGGER = LogUtils.getLogger();
+ private static final ChunkStep FULL_CHUNK_STEP = ChunkPyramid.GENERATION_PYRAMID.getStepTo(ChunkStatus.FULL);
+
+ public static int getDistance(final ChunkStatus status) {
+ return FULL_CHUNK_STEP.getAccumulatedRadiusOf(status);
+ }
+
+ public static void scheduleChunkTask(final ServerLevel level, final int chunkX, final int chunkZ, final Runnable run) {
+ scheduleChunkTask(level, chunkX, chunkZ, run, PrioritisedExecutor.Priority.NORMAL);
@ -2715,7 +2722,7 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+ if (chunk == null) {
+ onComplete.accept(null);
+ } else {
+ if (chunk.getStatus().isOrAfter(toStatus)) {
+ if (chunk.getPersistedStatus().isOrAfter(toStatus)) {
+ scheduleChunkLoad(level, chunkX, chunkZ, toStatus, addTicket, priority, onComplete);
+ } else {
+ onComplete.accept(null);
@ -2736,7 +2743,7 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+ return;
+ }
+
+ final int minLevel = 33 + ChunkStatus.getDistance(toStatus);
+ final int minLevel = 33 + ChunkSystem.getDistance(toStatus);
+ final Long chunkReference = addTicket ? Long.valueOf(++chunkLoadCounter) : null;
+ final ChunkPos chunkPos = new ChunkPos(chunkX, chunkZ);
+
@ -2770,19 +2777,19 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+ return;
+ }
+
+ final CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> loadFuture = holder.getOrScheduleFuture(toStatus, level.chunkSource.chunkMap);
+ final CompletableFuture<ChunkResult<ChunkAccess>> loadFuture = holder.scheduleChunkGenerationTask(toStatus, level.chunkSource.chunkMap);
+
+ if (loadFuture.isDone()) {
+ loadCallback.accept(loadFuture.join().left().orElse(null));
+ loadCallback.accept(loadFuture.join().orElse(null));
+ return;
+ }
+
+ loadFuture.whenCompleteAsync((final Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either, final Throwable thr) -> {
+ loadFuture.whenCompleteAsync((final ChunkResult<ChunkAccess> result, final Throwable thr) -> {
+ if (thr != null) {
+ loadCallback.accept(null);
+ return;
+ }
+ loadCallback.accept(either.left().orElse(null));
+ loadCallback.accept(result.orElse(null));
+ }, (final Runnable r) -> {
+ scheduleChunkTask(level, chunkX, chunkZ, r, PrioritisedExecutor.Priority.HIGHEST);
+ });
@ -2838,7 +2845,7 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+ return;
+ }
+
+ final CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> tickingState;
+ final CompletableFuture<ChunkResult<LevelChunk>> tickingState;
+ switch (toStatus) {
+ case FULL: {
+ tickingState = holder.getFullChunkFuture();
@ -2858,16 +2865,16 @@ index 0000000000000000000000000000000000000000..cff2f04409fab9abca87ceec85a551e1
+ }
+
+ if (tickingState.isDone()) {
+ loadCallback.accept(tickingState.join().left().orElse(null));
+ loadCallback.accept(tickingState.join().orElse(null));
+ return;
+ }
+
+ tickingState.whenCompleteAsync((final Either<LevelChunk, ChunkHolder.ChunkLoadingFailure> either, final Throwable thr) -> {
+ tickingState.whenCompleteAsync((final ChunkResult<LevelChunk> result, final Throwable thr) -> {
+ if (thr != null) {
+ loadCallback.accept(null);
+ return;
+ }
+ loadCallback.accept(either.left().orElse(null));
+ loadCallback.accept(result.orElse(null));
+ }, (final Runnable r) -> {
+ scheduleChunkTask(level, chunkX, chunkZ, r, PrioritisedExecutor.Priority.HIGHEST);
+ });
@ -3482,7 +3489,7 @@ index 0000000000000000000000000000000000000000..cea9c098ade00ee87b8efc8164ab72f5
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..9e21566fc4d76ae2e305f0e1d47d8c2f1c1f2c4c
index 0000000000000000000000000000000000000000..eb36bef19e6729c1cc44aefa927317963aba929e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -0,0 +1,554 @@
@ -4014,7 +4021,7 @@ index 0000000000000000000000000000000000000000..9e21566fc4d76ae2e305f0e1d47d8c2f
+ }
+
+ public static int getTicketLevelFor(net.minecraft.world.level.chunk.status.ChunkStatus status) {
+ return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.status.ChunkStatus.getDistance(status);
+ return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + io.papermc.paper.chunk.system.ChunkSystem.getDistance(status);
+ }
+
+ @NotNull
@ -6125,7 +6132,7 @@ index 40adb6117b9e0d5f70103113202a07715e403e2a..b1325e090f2c7aff31d27fc38ca7173e
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad700483eff 100644
index 5d4336210e11ee39521b4096a5f0874329053cdc..09d7b416c02eb13c506e9dc92d78e983bf43f4f0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -37,9 +37,9 @@ public class ChunkHolder extends GenerationChunkHolder {
@ -6160,7 +6167,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
super(pos);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -74,8 +86,23 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -74,8 +86,22 @@ public class ChunkHolder extends GenerationChunkHolder {
this.queueLevel = this.oldTicketLevel;
this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
@ -6171,12 +6178,11 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
+ public @Nullable ChunkAccess getAvailableChunkNow() {
+ // TODO can we just getStatusFuture(EMPTY)?
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
+ CompletableFuture<ChunkResult<ChunkAccess>> future = this.getFutureIfPresentUnchecked(curr);
+ ChunkResult<ChunkAccess> either = future.getNow(null);
+ if (either == null || either.isSuccess()) {
+ ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
+ if (chunkAccess == null) {
+ continue;
+ }
+ return either.orElseThrow(IllegalStateException::new);
+ return chunkAccess;
+ }
+ return null;
+ }
@ -6184,7 +6190,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
// CraftBukkit start
public LevelChunk getFullChunkNow() {
return (LevelChunk) this.getChunkIfPresent(ChunkStatus.FULL);
@@ -86,20 +113,20 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -86,20 +112,20 @@ public class ChunkHolder extends GenerationChunkHolder {
}
// CraftBukkit end
@ -6209,16 +6215,15 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
return (LevelChunk) ((ChunkResult) this.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error
}
@@ -123,6 +150,21 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -123,6 +149,20 @@ public class ChunkHolder extends GenerationChunkHolder {
}
+ // Paper start
+ public @Nullable ChunkStatus getChunkHolderStatus() {
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
+ CompletableFuture<ChunkResult<ChunkAccess>> future = this.getFutureIfPresentUnchecked(curr);
+ ChunkResult<ChunkAccess> either = future.getNow(null);
+ if (either == null || !either.isSuccess()) {
+ ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
+ if (chunkAccess == null) {
+ continue;
+ }
+ return curr;
@ -6231,7 +6236,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
public CompletableFuture<?> getSaveSyncFuture() {
return this.saveSync;
}
@@ -266,7 +308,7 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -266,7 +306,7 @@ public class ChunkHolder extends GenerationChunkHolder {
}
@Override
@ -6240,7 +6245,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
return this.ticketLevel;
}
@@ -335,12 +377,28 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -335,12 +375,28 @@ public class ChunkHolder extends GenerationChunkHolder {
this.wasAccessibleSinceLastSave |= flag1;
if (!flag && flag1) {
@ -6269,7 +6274,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
this.fullChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -351,11 +409,25 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -351,11 +407,25 @@ public class ChunkHolder extends GenerationChunkHolder {
if (!flag2 && flag3) {
this.tickingChunkFuture = chunkLoadingManager.prepareTickingChunk(this);
this.scheduleFullChunkPromotion(chunkLoadingManager, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING);
@ -6296,7 +6301,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -369,11 +441,24 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -369,11 +439,24 @@ public class ChunkHolder extends GenerationChunkHolder {
this.entityTickingChunkFuture = chunkLoadingManager.prepareEntityTickingChunk(this);
this.scheduleFullChunkPromotion(chunkLoadingManager, this.entityTickingChunkFuture, executor, FullChunkStatus.ENTITY_TICKING);
@ -6322,7 +6327,7 @@ index 5d4336210e11ee39521b4096a5f0874329053cdc..526d5b9bd6ce8eade59d3d3cf8bd7ad7
this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -423,4 +508,18 @@ public class ChunkHolder extends GenerationChunkHolder {
@@ -423,4 +506,18 @@ public class ChunkHolder extends GenerationChunkHolder {
List<ServerPlayer> getPlayers(ChunkPos chunkPos, boolean onlyOnWatchDistanceEdge);
}
@ -6650,7 +6655,7 @@ index b6cc33943fe7e4667944f3e6f868b3033ea9ca18..27065ffc5473c518acee3a3096b83fac
while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 47ae79cb2a03b43cbb881bcdea7ca231082b6614..ff68eff051c5f50b20b26d33001e12741dd3000e 100644
index 47ae79cb2a03b43cbb881bcdea7ca231082b6614..117aca5a73dca70cd38c15e028c79d74eb834e81 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -48,6 +48,7 @@ import net.minecraft.world.level.storage.LevelStorageSource;
@ -6745,7 +6750,7 @@ index 47ae79cb2a03b43cbb881bcdea7ca231082b6614..ff68eff051c5f50b20b26d33001e1274
+ return null;
+ }
+
+ return holder.getLastAvailable();
+ return holder.getLatestChunk();
+ }
+
+ public <T> void addTicketAtLevel(TicketType<T> ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) {

Datei anzeigen

@ -1019,7 +1019,7 @@ index ce0d22452171857e3cf070bf01450a7653ec7142..6581566ca4e4fac0691e4f5851f8895d
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ff68eff051c5f50b20b26d33001e12741dd3000e..946cf6e186c6b283e705aa9a8cc9726889ebb954 100644
index 117aca5a73dca70cd38c15e028c79d74eb834e81..c0808b6026b94676c1c6457e4bb44dcbc5e2a55b 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -269,13 +269,15 @@ public class ServerChunkCache extends ChunkSource {

Datei anzeigen

@ -559,7 +559,7 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9
+ @NotNull GameProfile buildGameProfile();
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index 9e21566fc4d76ae2e305f0e1d47d8c2f1c1f2c4c..c95a0af32178fe24448a5ae7a229c86ec883e8de 100644
index eb36bef19e6729c1cc44aefa927317963aba929e..4f5badb9429b34ed999183321c98b60978715638 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -1,5 +1,7 @@

Datei anzeigen

@ -40,7 +40,7 @@ index 6581566ca4e4fac0691e4f5851f8895d9ac7a38f..c96346bd0207537899d266fe2c8f29a1
return true;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 946cf6e186c6b283e705aa9a8cc9726889ebb954..6032cdc1b169c8ed0890091bce5066fbbb73ae30 100644
index c0808b6026b94676c1c6457e4bb44dcbc5e2a55b..6e941ca68c2ca9d7753358f738704c4dc1a4d5bf 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -535,6 +535,15 @@ public class ServerChunkCache extends ChunkSource {

Datei anzeigen

@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
index e2b72817857a7a203aae4c9de4e01ba1396dc95b..8fa2dec0e4827421d41a9d14e19cf3ac3579bf1c 100644
index 82fc5133325a127890984d51c1381883759eb444..ae16cf5c803caae636860dd9b1a83abe479ca5a4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
@@ -189,10 +189,51 @@ public class ChunkStatusTasks {

Datei anzeigen

@ -7,7 +7,7 @@ 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 6032cdc1b169c8ed0890091bce5066fbbb73ae30..86453364a0433a0196099a8cd271fa2bc7924fbb 100644
index 6e941ca68c2ca9d7753358f738704c4dc1a4d5bf..cc899988e65907ab6bc49e864e3334ff36f07576 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -253,6 +253,12 @@ public class ServerChunkCache extends ChunkSource {

Datei anzeigen

@ -300,7 +300,7 @@ 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 86453364a0433a0196099a8cd271fa2bc7924fbb..7b85cf6aba07cb64f58b913dda5da9124146bddd 100644
index cc899988e65907ab6bc49e864e3334ff36f07576..6f506ed8c8052f56356f60c5987cca8aa34d1d78 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -280,6 +280,7 @@ public class ServerChunkCache extends ChunkSource {

Datei anzeigen

@ -16,6 +16,21 @@ index 58e7bb57ef9915cf9c497ad53e67e95535291ddd..c31d5459cdee1ba6ebb68bcf9785f982
public void resendItemInHands() {
this.containerMenu.findSlot(this.getInventory(), this.getInventory().selected).ifPresent(s -> {
this.containerSynchronizer.sendSlotChange(this.containerMenu, s, this.getMainHandItem());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 84d735d358e2b58df0fccc8ffc5ef3346e62071d..9afb2154a85da83ed50b1c80c21f03e4843ce63c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2640,8 +2640,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.level().isClientSide()) {
// CraftBukkit start - fire PlayerLeashEntityEvent
if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) {
- ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item
+ // ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item // Paper - Fix inventory desync
((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, leashable.getLeashHolder()));
+ player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
return InteractionResult.PASS;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java
index 5a7b1be351834a6b8889b1380cede1be025cb302..e336934f37075a827843e4b1bb2b6b660d2c60c9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java

Datei anzeigen

@ -31,7 +31,7 @@ index 8b5eabea1a0926c22b58ef8761caee3a06aa5ee0..53fdf4e104f36a2bd88fdf26d8c68cd3
if (entity.valid) {
MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 84d735d358e2b58df0fccc8ffc5ef3346e62071d..b425a0b309af4603b5341bff1b6c978121257c64 100644
index 9afb2154a85da83ed50b1c80c21f03e4843ce63c..e4ad97071ed0e82fc910c34e700c6c6eee99deea 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -625,7 +625,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

Datei anzeigen

@ -50,7 +50,7 @@ index 1e0089b379d0d01d119f385916cc4b3d8b04bae6..c39ba9d193122d08d3bf43bf3e148e98
if (entityitem == null) {
return null;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b425a0b309af4603b5341bff1b6c978121257c64..44c56b4e48d4d884db4bfed04d1b0f3fc64dc475 100644
index e4ad97071ed0e82fc910c34e700c6c6eee99deea..3d150ed6c3f7313628ccf110c1a67aa77b142326 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2564,6 +2564,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

Datei anzeigen

@ -68,10 +68,10 @@ index caf1d79e2bbdd257a5439e2973653747e678805f..e34584e4780f343d6c946af5377088d5
public DamageSource sonicBoom(Entity attacker) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 44c56b4e48d4d884db4bfed04d1b0f3fc64dc475..e91cf76a00f12581c8d14681188220f75fd6355b 100644
index 3d150ed6c3f7313628ccf110c1a67aa77b142326..8779d54c816bb97ccdeb268d1929f693d322ee14 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3274,7 +3274,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3275,7 +3275,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return;
}

Datei anzeigen

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 14 Jun 2024 17:19:59 +0200
Subject: [PATCH] stubs
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 67a715a812d700df912834874107078255d7c695..fc7fa260bb55ae28b17a3ea05682a51ad4fa39df 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -110,6 +110,7 @@ import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
import org.bukkit.BanEntry;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
@@ -192,6 +193,7 @@ import org.bukkit.scoreboard.Scoreboard;
import org.jetbrains.annotations.NotNull;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
+import org.jetbrains.annotations.Unmodifiable;
@DelegateDeserialization(CraftOfflinePlayer.class)
public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3480,6 +3482,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetIdleDuration() {
this.getHandle().resetLastActionTime();
}
+
+ @Override
+ public @NotNull @Unmodifiable Set<Long> getSentChunkKeys() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public @NotNull @Unmodifiable Set<Chunk> getSentChunks() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public boolean isChunkSent(final long chunkKey) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
// Paper end
public Player.Spigot spigot()