more compile fixes

This commit is contained in:
Jake Potrebic 2023-06-08 13:56:13 -07:00
parent 180fe2a014
commit 957d248aff
24 changed files with 101 additions and 74 deletions

View file

@ -12,3 +12,7 @@ public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/Tick
# AT remap issue? todo 1.18 # AT remap issue? todo 1.18
public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch; public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch;
public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag; public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag;
# TODO 1.20 remapSpigotAt.at doesn't remap the return type for this method for some reason
public net/minecraft/world/entity/Display$TextDisplay getText()Lnet/minecraft/network/chat/Component;
public net/minecraft/world/entity/Display$BlockDisplay getBlockState()Lnet/minecraft/world/level/block/state/BlockState;

View file

@ -19,9 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * + *
+ * @param blockChanges A map of the positions you want to change to their new block data + * @param blockChanges A map of the positions you want to change to their new block data
+ */ + */
+ default void sendMultiBlockChange(@NotNull Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges) { + void sendMultiBlockChange(@NotNull Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges);
+ this.sendMultiBlockChange(blockChanges, false);
+ }
+ +
+ /** + /**
+ * Send multiple block changes. This fakes a multi block change packet for each + * Send multiple block changes. This fakes a multi block change packet for each
@ -29,8 +27,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * + *
+ * @param blockChanges A map of the positions you want to change to their new block data + * @param blockChanges A map of the positions you want to change to their new block data
+ * @param suppressLightUpdates Whether to suppress light updates or not + * @param suppressLightUpdates Whether to suppress light updates or not
+ * @deprecated suppressLightUpdates is no longer available in 1.20+, use {@link #sendMultiBlockChange(Map)}
+ */ + */
+ void sendMultiBlockChange(@NotNull Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges, boolean suppressLightUpdates); + @Deprecated
+ default void sendMultiBlockChange(@NotNull Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges, boolean suppressLightUpdates) {
+ this.sendMultiBlockChange(blockChanges);
+ }
+ // Paper end + // Paper end
+ +
/** /**

View file

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return !entity.isSpectator(); return !entity.isSpectator();
}; };
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
- public static Predicate<Player> isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper - public static Predicate<Player> IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
+ // Paper start + // Paper start
+ public static Predicate<Player> isInsomniac = (player) -> { + public static Predicate<Player> IS_INSOMNIAC = (player) -> {
+ net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player; + net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player;
+ int playerInsomniaTicks = serverPlayer.getLevel().paperConfig().entities.behavior.playerInsomniaStartTicks; + int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks;
+ +
+ if (playerInsomniaTicks <= 0) { + if (playerInsomniaTicks <= 0) {
+ return false; + return false;

View file

@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ private static void glow(LivingEntity entity) { glow(entity, null); } + private static void glow(LivingEntity entity) { glow(entity, null); }
+ private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) { + private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) {
+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return; + if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level().getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level(), pos)), entity.getBukkitEntity()).callEvent()) return;
+ // Paper end + // Paper end
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
} }

View file

@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ merchantRecipe.increaseUses(); + merchantRecipe.increaseUses();
+ } + }
+ if (event == null || event.isRewardingExp()) { + if (event == null || event.isRewardingExp()) {
+ this.tradingPlayer.level.addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(tradingPlayer.level, tradingPlayer.getX(), tradingPlayer.getY(), tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); + this.tradingPlayer.level().addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(this.tradingPlayer.level(), this.tradingPlayer.getX(), this.tradingPlayer.getY(), this.tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null));
+ } + }
+ } + }
+ this.notifyTrade(merchantRecipe); + this.notifyTrade(merchantRecipe);

View file

@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ int activeAnger = this.angerManagement.getActiveAnger(entity); + int activeAnger = this.angerManagement.getActiveAnger(entity);
+ io.papermc.paper.event.entity.WardenAngerChangeEvent event = new io.papermc.paper.event.entity.WardenAngerChangeEvent((org.bukkit.entity.Warden) this.getBukkitEntity(), entity.getBukkitEntity(), activeAnger, Math.min(150, activeAnger + amount)); + io.papermc.paper.event.entity.WardenAngerChangeEvent event = new io.papermc.paper.event.entity.WardenAngerChangeEvent((org.bukkit.entity.Warden) this.getBukkitEntity(), entity.getBukkitEntity(), activeAnger, Math.min(150, activeAnger + amount));
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level().getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return; + return;
+ } + }

View file

@ -52,6 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public boolean canBeAffected(MobEffectInstance effect) { public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect); - return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper + return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper
} }
} }

View file

@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); + final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
+ final ServerLevel level = serverPlayer.getLevel(); + final ServerLevel level = serverPlayer.serverLevel();
+ +
+ if (!level.paperConfig().entities.spawning.perPlayerMobSpawns) { + if (!level.paperConfig().entities.spawning.perPlayerMobSpawns) {
+ sender.sendMessage(Component.text("Use '/paper mobcaps' for worlds where per-player mob spawning is disabled.", NamedTextColor.RED)); + sender.sendMessage(Component.text("Use '/paper mobcaps' for worlds where per-player mob spawning is disabled.", NamedTextColor.RED));

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return !entity.isSpectator(); return !entity.isSpectator();
}; };
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
+ public static Predicate<Player> isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper + public static Predicate<Player> IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
private EntitySelector() {} private EntitySelector() {}
// Paper start // Paper start
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Player entityhuman = (Player) iterator.next(); Player entityhuman = (Player) iterator.next();
if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) {
+ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper + if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.IS_INSOMNIAC.test(entityhuman)) // Paper
Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
return true; return true;
} }

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
float f = difficulty.getSpecialMultiplier(); float f = difficulty.getSpecialMultiplier();
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f);
+ this.setCanPickUpLoot(this.level.paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper + this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper
if (object == null) { if (object == null) {
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true);
} }

View file

@ -479,7 +479,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ final Set<Audience> viewers = event.viewers(); + final Set<Audience> viewers = event.viewers();
+ final ResourceKey<ChatType> chatTypeKey = renderer instanceof ChatRenderer.Default ? ChatType.CHAT : ChatType.RAW; + final ResourceKey<ChatType> chatTypeKey = renderer instanceof ChatRenderer.Default ? ChatType.CHAT : ChatType.RAW;
+ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player().level.registryAccess(), PaperAdventure.asVanilla(displayName(player))); + final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player.level().registryAccess(), PaperAdventure.asVanilla(displayName(player)));
+ +
+ OutgoingChat outgoingChat = viewers instanceof LazyChatAudienceSet lazyAudienceSet && lazyAudienceSet.isLazy() ? new ServerOutgoingChat() : new ViewersOutgoingChat(); + OutgoingChat outgoingChat = viewers instanceof LazyChatAudienceSet lazyAudienceSet && lazyAudienceSet.isLazy() ? new ServerOutgoingChat() : new ViewersOutgoingChat();
+ /* if (this.flags.get(FORCE_PREVIEW_USE)) { // TODO (future, maybe?) + /* if (this.flags.get(FORCE_PREVIEW_USE)) { // TODO (future, maybe?)

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ public BlockPos getPodium() { + public BlockPos getPodium() {
+ if (this.podium == null) { + if (this.podium == null) {
+ return EndPodiumFeature.END_PODIUM_LOCATION; + return EndPodiumFeature.getLocation(this.getFightOrigin());
+ } + }
+ return this.podium; + return this.podium;
+ } + }

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.vibrationData = listener; this.vibrationData = listener;
}); });
} }
+ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.listener.listenerRange = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper + if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.getListener().rangeOverride = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper
} }
@ -26,10 +26,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> {
nbt.put("listener", listenerNbt); nbt.put("listener", listenerNbt);
}); });
+ if (this.listener.listenerRange != ((SculkSensorBlock) net.minecraft.world.level.block.Blocks.SCULK_SENSOR).getListenerRange()) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.listener.listenerRange); // Paper - only save if it's different from the default + if (this.getListener().rangeOverride != null || this.getListener().rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.getListener().rangeOverride); // Paper - only save if it's different from the default
} }
@Override @Override
diff --git a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
@@ -0,0 +0,0 @@ public interface VibrationSystem {
public static class Listener implements GameEventListener {
private final VibrationSystem system;
+ @Nullable public Integer rangeOverride = null; // Paper
public Listener(VibrationSystem receiver) {
this.system = receiver;
@@ -0,0 +0,0 @@ public interface VibrationSystem {
@Override
public int getListenerRadius() {
+ if (this.rangeOverride != null) return this.rangeOverride; // Paper
return this.system.getVibrationUser().getListenerRadius();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java
@ -41,13 +61,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ @Override + @Override
+ public int getListenerRange() { + public int getListenerRange() {
+ return this.getSnapshot().getListener().listenerRange; + return this.getSnapshot().getListener().getListenerRadius();
+ } + }
+ +
+ @Override + @Override
+ public void setListenerRange(int range) { + public void setListenerRange(int range) {
+ Preconditions.checkArgument(range > 0, "Vibration listener range must be greater than 0"); + Preconditions.checkArgument(range > 0, "Vibration listener range must be greater than 0");
+ this.getSnapshot().getListener().listenerRange = range; + this.getSnapshot().getListener().rangeOverride = range;
+ } + }
+ // Paper end + // Paper end
} }

View file

@ -230,7 +230,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ String entityType = net.minecraft.world.entity.EntityType.getKey(entity.getType()).toString(); + String entityType = net.minecraft.world.entity.EntityType.getKey(entity.getType()).toString();
+ java.util.UUID entityUUID = entity.getUUID(); + java.util.UUID entityUUID = entity.getUUID();
+ net.minecraft.world.level.Level world = entity.level; + net.minecraft.world.level.Level world = entity.level();
+ +
+ log.log(Level.SEVERE, "Ticking entity: " + entityType + ", entity class: " + entity.getClass().getName()); + log.log(Level.SEVERE, "Ticking entity: " + entityType + ", entity class: " + entity.getClass().getName());
+ log.log(Level.SEVERE, "Entity status: removed: " + entity.isRemoved() + ", valid: " + entity.valid + ", alive: " + entity.isAlive() + ", is passenger: " + entity.isPassenger()); + log.log(Level.SEVERE, "Entity status: removed: " + entity.isRemoved() + ", valid: " + entity.valid + ", alive: " + entity.isAlive() + ", is passenger: " + entity.isPassenger());

View file

@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public org.bukkit.Location getTreasureLocation() { + public org.bukkit.Location getTreasureLocation() {
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level, this.getHandle().getTreasurePos()); + return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos());
+ } + }
+ +
+ @Override + @Override

View file

@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
} }
+ // Paper start - Fix invulnerable end crystals + // Paper start - Fix invulnerable end crystals
+ if (this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { + if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
+ if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld()) + if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld())
+ || ((ServerLevel) this.level).dragonFight() == null + || ((ServerLevel) this.level()).getDragonFight() == null
+ || ((ServerLevel) this.level).dragonFight().respawnStage == null + || ((ServerLevel) this.level()).getDragonFight().respawnStage == null
+ || ((ServerLevel) this.level).dragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) { + || ((ServerLevel) this.level()).getDragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) {
+ this.setInvulnerable(false); + this.setInvulnerable(false);
+ this.setBeamTarget(null); + this.setBeamTarget(null);
+ } + }

View file

@ -6202,21 +6202,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) { + public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
+ io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState(
+ this.level, x, z, ChunkHolder.FullChunkStatus.ENTITY_TICKING, true, + this.level, x, z, FullChunkStatus.ENTITY_TICKING, true,
+ ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad
+ ); + );
+ } + }
+ +
+ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) { + public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
+ io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState(
+ this.level, x, z, ChunkHolder.FullChunkStatus.TICKING, true, + this.level, x, z, FullChunkStatus.BLOCK_TICKING, true,
+ ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad
+ ); + );
+ } + }
+ +
+ public void getFullChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) { + public void getFullChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
+ io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState(
+ this.level, x, z, ChunkHolder.FullChunkStatus.BORDER, true, + this.level, x, z, FullChunkStatus.FULL, true,
+ ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad
+ ); + );
+ } + }

View file

@ -444,7 +444,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return null; + return null;
+ } + }
+ +
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); + return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
+ } + }
+ +
+ @Override + @Override
@ -885,7 +885,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return null; + return null;
+ } + }
+ +
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); + return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
+ } + }
+ +
+ @Override + @Override
@ -1172,7 +1172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return null; + return null;
+ } + }
+ +
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); + return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
+ } + }
+ +
+ @Override + @Override

View file

@ -13,11 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Paper start + // Paper start
+ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<BlockState> blockChanges, boolean suppressLightUpdates) { + public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<BlockState> blockChanges) {
+ this.sectionPos = sectionPos; + this.sectionPos = sectionPos;
+ this.positions = blockChanges.keySet().toShortArray(); + this.positions = blockChanges.keySet().toShortArray();
+ this.states = blockChanges.values().toArray(new BlockState[0]); + this.states = blockChanges.values().toArray(new BlockState[0]);
+ this.suppressLightUpdates = suppressLightUpdates;
+ } + }
+ // Paper end + // Paper end
+ +
@ -34,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ @Override + @Override
+ public void sendMultiBlockChange(final Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges, final boolean suppressLightUpdates) { + public void sendMultiBlockChange(final Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges) {
+ if (this.getHandle().connection == null) return; + if (this.getHandle().connection == null) return;
+ +
+ Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new HashMap<>(); + Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new HashMap<>();
@ -52,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ SectionPos sectionPos = entry.getKey(); + SectionPos sectionPos = entry.getKey();
+ it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState> blockData = entry.getValue(); + it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState> blockData = entry.getValue();
+ +
+ net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket packet = new net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket(sectionPos, blockData, suppressLightUpdates); + net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket packet = new net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket(sectionPos, blockData);
+ this.getHandle().connection.send(packet); + this.getHandle().connection.send(packet);
+ } + }
+ } + }

View file

@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ net.minecraft.server.level.ServerEntity serverEntity = this.entity.tracker.serverEntity; + net.minecraft.server.level.ServerEntity serverEntity = this.entity.tracker.serverEntity;
+ if (player.getBukkitEntity().canSee(entity.getBukkitEntity())) { + if (player.getBukkitEntity().canSee(entity.getBukkitEntity())) {
+ serverEntity.sendPairingData(player.connection::send, player); + serverEntity.sendPairingData(player, player.connection::send);
+ } + }
+ } + }
+ // Paper end + // Paper end

View file

@ -10939,6 +10939,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet; +import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet;
+import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.CompoundTag;
+import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ChunkHolder;
+import net.minecraft.server.level.ChunkLevel;
+import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ChunkMap;
+import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.server.level.FullChunkStatus;
+import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerLevel;
@ -11520,8 +11521,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ // ticket level state + // ticket level state
+ private int oldTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1; + private int oldTicketLevel = ChunkLevel.MAX_LEVEL + 1;
+ private int currentTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1; + private int currentTicketLevel = ChunkLevel.MAX_LEVEL + 1;
+ +
+ public int getTicketLevel() { + public int getTicketLevel() {
+ return this.currentTicketLevel; + return this.currentTicketLevel;
@ -11605,7 +11606,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ // chunk must be marked inaccessible (i.e unloaded to plugins) + // chunk must be marked inaccessible (i.e unloaded to plugins)
+ if (this.getChunkStatus() != ChunkHolder.FullChunkStatus.INACCESSIBLE) { + if (this.getChunkStatus() != FullChunkStatus.INACCESSIBLE) {
+ return "fullchunkstatus"; + return "fullchunkstatus";
+ } + }
+ +
@ -11844,8 +11845,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ this.oldTicketLevel = newLevel; + this.oldTicketLevel = newLevel;
+ +
+ final ChunkHolder.FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel); + final FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel);
+ final ChunkHolder.FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel); + final FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel);
+ final boolean oldUnloaded = oldLevel > ChunkHolderManager.MAX_TICKET_LEVEL; + final boolean oldUnloaded = oldLevel > ChunkHolderManager.MAX_TICKET_LEVEL;
+ final boolean newUnloaded = newLevel > ChunkHolderManager.MAX_TICKET_LEVEL; + final boolean newUnloaded = newLevel > ChunkHolderManager.MAX_TICKET_LEVEL;
+ +
@ -11853,7 +11854,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final ChunkStatus maxGenerationStatusNew = ChunkHolder.getStatus(newLevel); + final ChunkStatus maxGenerationStatusNew = ChunkHolder.getStatus(newLevel);
+ +
+ // check for cancellations from downgrading ticket level + // check for cancellations from downgrading ticket level
+ if (this.requestedGenStatus != null && !newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newLevel > oldLevel) { + if (this.requestedGenStatus != null && !newState.isOrAfter(FullChunkStatus.FULL) && newLevel > oldLevel) {
+ // note: cancel() may invoke onChunkGenComplete synchronously here + // note: cancel() may invoke onChunkGenComplete synchronously here
+ if (newUnloaded) { + if (newUnloaded) {
+ // need to cancel all tasks + // need to cancel all tasks
@ -11888,7 +11889,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (newState != oldState) { + if (newState != oldState) {
+ if (newState.isOrAfter(oldState)) { + if (newState.isOrAfter(oldState)) {
+ // status upgrade + // status upgrade
+ if (!oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { + if (!oldState.isOrAfter(FullChunkStatus.FULL) && newState.isOrAfter(FullChunkStatus.FULL)) {
+ // may need to schedule full load + // may need to schedule full load
+ if (this.currentGenStatus != ChunkStatus.FULL) { + if (this.currentGenStatus != ChunkStatus.FULL) {
+ if (this.requestedGenStatus != null) { + if (this.requestedGenStatus != null) {
@ -11905,16 +11906,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } else { + } else {
+ // status downgrade + // status downgrade
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING)) { + if (!newState.isOrAfter(FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(FullChunkStatus.ENTITY_TICKING)) {
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.ENTITY_TICKING, null); + this.completeFullStatusConsumers(FullChunkStatus.ENTITY_TICKING, null);
+ } + }
+ +
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING)) { + if (!newState.isOrAfter(FullChunkStatus.BLOCK_TICKING) && oldState.isOrAfter(FullChunkStatus.BLOCK_TICKING)) {
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.TICKING, null); + this.completeFullStatusConsumers(FullChunkStatus.BLOCK_TICKING, null);
+ } + }
+ +
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { + if (!newState.isOrAfter(FullChunkStatus.FULL) && oldState.isOrAfter(FullChunkStatus.FULL)) {
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.BORDER, null); + this.completeFullStatusConsumers(FullChunkStatus.FULL, null);
+ } + }
+ } + }
+ } + }
@ -13942,6 +13943,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.util.MCUtil; +import io.papermc.paper.util.MCUtil;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ChunkHolder;
+import net.minecraft.server.level.FullChunkStatus;
+import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkAccess;
+import net.minecraft.world.level.chunk.ImposterProtoChunk; +import net.minecraft.world.level.chunk.ImposterProtoChunk;
@ -14031,8 +14033,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ int total = 0; + int total = 0;
+ int inactive = 0; + int inactive = 0;
+ int border = 0; + int full = 0;
+ int ticking = 0; + int blockTicking = 0;
+ int entityTicking = 0; + int entityTicking = 0;
+ +
+ for (final ChunkHolder chunk : io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(world)) { + for (final ChunkHolder chunk : io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(world)) {
@ -14042,29 +14044,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ ++total; + ++total;
+ +
+ ChunkHolder.FullChunkStatus state = chunk.getFullStatus(); + FullChunkStatus state = chunk.getFullStatus();
+ +
+ switch (state) { + switch (state) {
+ case INACCESSIBLE -> ++inactive; + case INACCESSIBLE -> ++inactive;
+ case BORDER -> ++border; + case FULL -> ++full;
+ case TICKING -> ++ticking; + case BLOCK_TICKING -> ++blockTicking;
+ case ENTITY_TICKING -> ++entityTicking; + case ENTITY_TICKING -> ++entityTicking;
+ } + }
+ } + }
+ +
+ accumulatedTotal += total; + accumulatedTotal += total;
+ accumulatedInactive += inactive; + accumulatedInactive += inactive;
+ accumulatedBorder += border; + accumulatedBorder += full;
+ accumulatedTicking += ticking; + accumulatedTicking += blockTicking;
+ accumulatedEntityTicking += entityTicking; + accumulatedEntityTicking += entityTicking;
+ +
+ sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":"))); + sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":")));
+ sender.sendMessage(text().color(DARK_AQUA).append( + sender.sendMessage(text().color(DARK_AQUA).append(
+ text("Total: ", BLUE), text(total), + text("Total: ", BLUE), text(total),
+ text(" Inactive: ", BLUE), text(inactive), + text(" Inactive: ", BLUE), text(inactive),
+ text(" Border: ", BLUE), text(border), + text(" Full: ", BLUE), text(full),
+ text(" Ticking: ", BLUE), text(ticking), + text(" Block Ticking: ", BLUE), text(blockTicking),
+ text(" Entity: ", BLUE), text(entityTicking) + text(" Entity Ticking: ", BLUE), text(entityTicking)
+ )); + ));
+ } + }
+ if (worlds.size() > 1) { + if (worlds.size() > 1) {
@ -14072,9 +14074,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ sender.sendMessage(text().color(DARK_AQUA).append( + sender.sendMessage(text().color(DARK_AQUA).append(
+ text("Total: ", BLUE), text(accumulatedTotal), + text("Total: ", BLUE), text(accumulatedTotal),
+ text(" Inactive: ", BLUE), text(accumulatedInactive), + text(" Inactive: ", BLUE), text(accumulatedInactive),
+ text(" Border: ", BLUE), text(accumulatedBorder), + text(" Full: ", BLUE), text(accumulatedBorder),
+ text(" Ticking: ", BLUE), text(accumulatedTicking), + text(" Block Ticking: ", BLUE), text(accumulatedTicking),
+ text(" Entity: ", BLUE), text(accumulatedEntityTicking) + text(" Entity Ticking: ", BLUE), text(accumulatedEntityTicking)
+ )); + ));
+ } + }
+ } + }
@ -14387,7 +14389,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ JsonObject playerData = new JsonObject(); + JsonObject playerData = new JsonObject();
+ players.add(playerData); + players.add(playerData);
+ +
+ Level playerWorld = player.getLevel(); + Level playerWorld = player.level();
+ org.bukkit.World craftWorld = playerWorld.getWorld(); + org.bukkit.World craftWorld = playerWorld.getWorld();
+ Entity.RemovalReason removalReason = player.getRemovalReason(); + Entity.RemovalReason removalReason = player.getRemovalReason();
+ +

View file

@ -71,27 +71,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ @Override + @Override
+ public org.bukkit.Location getHome() { + public org.bukkit.Location getHome() {
+ return io.papermc.paper.util.MCUtil.toLocation(getHandle().getLevel(), getHandle().getHomePos()); + return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getHomePos());
+ } + }
+ +
+ @Override + @Override
+ public void setHome(org.bukkit.Location location) { + public void setHome(org.bukkit.Location location) {
+ getHandle().setHomePos(io.papermc.paper.util.MCUtil.toBlockPosition(location)); + this.getHandle().setHomePos(io.papermc.paper.util.MCUtil.toBlockPosition(location));
+ } + }
+ +
+ @Override + @Override
+ public boolean isGoingHome() { + public boolean isGoingHome() {
+ return getHandle().isGoingHome(); + return this.getHandle().isGoingHome();
+ } + }
+ +
+ @Override + @Override
+ public boolean isDigging() { + public boolean isDigging() {
+ return getHandle().isLayingEgg(); + return this.getHandle().isLayingEgg();
+ } + }
+ +
+ @Override + @Override
+ public void setHasEgg(boolean hasEgg) { + public void setHasEgg(boolean hasEgg) {
+ getHandle().setHasEgg(hasEgg); + this.getHandle().setHasEgg(hasEgg);
+ } + }
+ // Paper end + // Paper end
} }

View file

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - extend PlayerGameModeChangeEvent + // Paper start - extend PlayerGameModeChangeEvent
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty()); + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty());
+ if (event != null && event.isCancelled()) { + if (event != null && event.isCancelled()) {
+ source.sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); + source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false);
} }
+ // Paper end + // Paper end
+ ++i; + ++i;
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
logGamemodeChange(context.getSource(), serverPlayer, gameMode); logGamemodeChange(context.getSource(), serverPlayer, gameMode);
++i; ++i;
+ } else if (event != null && event.cancelMessage() != null) { + } else if (event != null && event.cancelMessage() != null) {
+ context.getSource().sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); + context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
+ // Paper end + // Paper end
} }
} }

View file

@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static ServerPlayer tryGetPlayer(@Nullable Entity entity) { public static ServerPlayer tryGetPlayer(@Nullable Entity entity) {
+ // Paper start - ensure level is the same for sculk events + // Paper start - ensure level is the same for sculk events
+ final ServerPlayer player = tryGetPlayer0(entity); + final ServerPlayer player = tryGetPlayer0(entity);
+ return player != null && player.level == entity.level ? player : null; + return player != null && player.level() == entity.level() ? player : null;
+ } + }
+ @Nullable + @Nullable
+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) { + private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {