mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
more compile fixes
This commit is contained in:
parent
180fe2a014
commit
957d248aff
24 changed files with 101 additions and 74 deletions
|
@ -12,3 +12,7 @@ public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/Tick
|
|||
# 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.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;
|
||||
|
|
|
@ -19,9 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @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) {
|
||||
+ this.sendMultiBlockChange(blockChanges, false);
|
||||
+ }
|
||||
+ void sendMultiBlockChange(@NotNull Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges);
|
||||
+
|
||||
+ /**
|
||||
+ * 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 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
|
||||
+
|
||||
/**
|
||||
|
|
|
@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return !entity.isSpectator();
|
||||
};
|
||||
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
|
||||
+ 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;
|
||||
+ int playerInsomniaTicks = serverPlayer.getLevel().paperConfig().entities.behavior.playerInsomniaStartTicks;
|
||||
+ int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks;
|
||||
+
|
||||
+ if (playerInsomniaTicks <= 0) {
|
||||
+ return false;
|
||||
|
|
|
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ private static void glow(LivingEntity entity) { glow(entity, null); }
|
||||
+ 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
|
||||
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ merchantRecipe.increaseUses();
|
||||
+ }
|
||||
+ 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);
|
||||
|
|
|
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ 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));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
|
|
|
@ -52,6 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance 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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
|
||||
+ final ServerLevel level = serverPlayer.getLevel();
|
||||
+ final ServerLevel level = serverPlayer.serverLevel();
|
||||
+
|
||||
+ if (!level.paperConfig().entities.spawning.perPlayerMobSpawns) {
|
||||
+ sender.sendMessage(Component.text("Use '/paper mobcaps' for worlds where per-player mob spawning is disabled.", NamedTextColor.RED));
|
||||
|
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return !entity.isSpectator();
|
||||
};
|
||||
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() {}
|
||||
// Paper start
|
||||
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Player entityhuman = (Player) iterator.next();
|
||||
|
||||
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
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
float f = difficulty.getSpecialMultiplier();
|
||||
|
||||
- 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) {
|
||||
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true);
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ final Set<Audience> viewers = event.viewers();
|
||||
+ 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();
|
||||
+ /* if (this.flags.get(FORCE_PREVIEW_USE)) { // TODO (future, maybe?)
|
||||
|
|
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ public BlockPos getPodium() {
|
||||
+ if (this.podium == null) {
|
||||
+ return EndPodiumFeature.END_PODIUM_LOCATION;
|
||||
+ return EndPodiumFeature.getLocation(this.getFightOrigin());
|
||||
+ }
|
||||
+ return this.podium;
|
||||
+ }
|
||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
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) -> {
|
||||
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
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java
|
||||
|
@ -41,13 +61,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ @Override
|
||||
+ public int getListenerRange() {
|
||||
+ return this.getSnapshot().getListener().listenerRange;
|
||||
+ return this.getSnapshot().getListener().getListenerRadius();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setListenerRange(int range) {
|
||||
+ Preconditions.checkArgument(range > 0, "Vibration listener range must be greater than 0");
|
||||
+ this.getSnapshot().getListener().listenerRange = range;
|
||||
+ this.getSnapshot().getListener().rangeOverride = range;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ String entityType = net.minecraft.world.entity.EntityType.getKey(entity.getType()).toString();
|
||||
+ 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, "Entity status: removed: " + entity.isRemoved() + ", valid: " + entity.valid + ", alive: " + entity.isAlive() + ", is passenger: " + entity.isPassenger());
|
||||
|
|
|
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Override
|
||||
+ 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
|
||||
|
|
|
@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// CraftBukkit end
|
||||
}
|
||||
+ // Paper start - Fix invulnerable end crystals
|
||||
+ if (this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
|
||||
+ if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld())
|
||||
+ || ((ServerLevel) this.level).dragonFight() == null
|
||||
+ || ((ServerLevel) this.level).dragonFight().respawnStage == null
|
||||
+ || ((ServerLevel) this.level).dragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) {
|
||||
+ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
|
||||
+ if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld())
|
||||
+ || ((ServerLevel) this.level()).getDragonFight() == null
|
||||
+ || ((ServerLevel) this.level()).getDragonFight().respawnStage == null
|
||||
+ || ((ServerLevel) this.level()).getDragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) {
|
||||
+ this.setInvulnerable(false);
|
||||
+ this.setBeamTarget(null);
|
||||
+ }
|
||||
|
|
|
@ -6202,21 +6202,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
|
||||
+ 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
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
|
||||
+ 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
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ public void getFullChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
|
||||
+ 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
|
||||
+ );
|
||||
+ }
|
||||
|
|
|
@ -444,7 +444,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ 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
|
||||
|
@ -885,7 +885,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ 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
|
||||
|
@ -1172,7 +1172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ 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
|
||||
|
|
|
@ -13,11 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
+ // 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.positions = blockChanges.keySet().toShortArray();
|
||||
+ this.states = blockChanges.values().toArray(new BlockState[0]);
|
||||
+ this.suppressLightUpdates = suppressLightUpdates;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
@ -34,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
+ // Paper start
|
||||
+ @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;
|
||||
+
|
||||
+ 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();
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
|
|
|
@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ net.minecraft.server.level.ServerEntity serverEntity = this.entity.tracker.serverEntity;
|
||||
+ if (player.getBukkitEntity().canSee(entity.getBukkitEntity())) {
|
||||
+ serverEntity.sendPairingData(player.connection::send, player);
|
||||
+ serverEntity.sendPairingData(player, player.connection::send);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
|
|
@ -10939,6 +10939,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.server.level.ChunkHolder;
|
||||
+import net.minecraft.server.level.ChunkLevel;
|
||||
+import net.minecraft.server.level.ChunkMap;
|
||||
+import net.minecraft.server.level.FullChunkStatus;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
|
@ -11520,8 +11521,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ // ticket level state
|
||||
+ private int oldTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1;
|
||||
+ private int currentTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1;
|
||||
+ private int oldTicketLevel = ChunkLevel.MAX_LEVEL + 1;
|
||||
+ private int currentTicketLevel = ChunkLevel.MAX_LEVEL + 1;
|
||||
+
|
||||
+ public int getTicketLevel() {
|
||||
+ return this.currentTicketLevel;
|
||||
|
@ -11605,7 +11606,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ // chunk must be marked inaccessible (i.e unloaded to plugins)
|
||||
+ if (this.getChunkStatus() != ChunkHolder.FullChunkStatus.INACCESSIBLE) {
|
||||
+ if (this.getChunkStatus() != FullChunkStatus.INACCESSIBLE) {
|
||||
+ return "fullchunkstatus";
|
||||
+ }
|
||||
+
|
||||
|
@ -11844,8 +11845,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ this.oldTicketLevel = newLevel;
|
||||
+
|
||||
+ final ChunkHolder.FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel);
|
||||
+ final ChunkHolder.FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel);
|
||||
+ final FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel);
|
||||
+ final FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel);
|
||||
+ final boolean oldUnloaded = oldLevel > 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);
|
||||
+
|
||||
+ // 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
|
||||
+ if (newUnloaded) {
|
||||
+ // need to cancel all tasks
|
||||
|
@ -11888,7 +11889,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (newState != oldState) {
|
||||
+ if (newState.isOrAfter(oldState)) {
|
||||
+ // 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
|
||||
+ if (this.currentGenStatus != ChunkStatus.FULL) {
|
||||
+ if (this.requestedGenStatus != null) {
|
||||
|
@ -11905,16 +11906,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ } else {
|
||||
+ // status downgrade
|
||||
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING)) {
|
||||
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.ENTITY_TICKING, null);
|
||||
+ if (!newState.isOrAfter(FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(FullChunkStatus.ENTITY_TICKING)) {
|
||||
+ this.completeFullStatusConsumers(FullChunkStatus.ENTITY_TICKING, null);
|
||||
+ }
|
||||
+
|
||||
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING)) {
|
||||
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.TICKING, null);
|
||||
+ if (!newState.isOrAfter(FullChunkStatus.BLOCK_TICKING) && oldState.isOrAfter(FullChunkStatus.BLOCK_TICKING)) {
|
||||
+ this.completeFullStatusConsumers(FullChunkStatus.BLOCK_TICKING, null);
|
||||
+ }
|
||||
+
|
||||
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.BORDER, null);
|
||||
+ if (!newState.isOrAfter(FullChunkStatus.FULL) && oldState.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.completeFullStatusConsumers(FullChunkStatus.FULL, null);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
@ -13942,6 +13943,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import io.papermc.paper.util.MCUtil;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ChunkHolder;
|
||||
+import net.minecraft.server.level.FullChunkStatus;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
+import net.minecraft.world.level.chunk.ImposterProtoChunk;
|
||||
|
@ -14031,8 +14033,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ int total = 0;
|
||||
+ int inactive = 0;
|
||||
+ int border = 0;
|
||||
+ int ticking = 0;
|
||||
+ int full = 0;
|
||||
+ int blockTicking = 0;
|
||||
+ int entityTicking = 0;
|
||||
+
|
||||
+ for (final ChunkHolder chunk : io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(world)) {
|
||||
|
@ -14042,29 +14044,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ ++total;
|
||||
+
|
||||
+ ChunkHolder.FullChunkStatus state = chunk.getFullStatus();
|
||||
+ FullChunkStatus state = chunk.getFullStatus();
|
||||
+
|
||||
+ switch (state) {
|
||||
+ case INACCESSIBLE -> ++inactive;
|
||||
+ case BORDER -> ++border;
|
||||
+ case TICKING -> ++ticking;
|
||||
+ case FULL -> ++full;
|
||||
+ case BLOCK_TICKING -> ++blockTicking;
|
||||
+ case ENTITY_TICKING -> ++entityTicking;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ accumulatedTotal += total;
|
||||
+ accumulatedInactive += inactive;
|
||||
+ accumulatedBorder += border;
|
||||
+ accumulatedTicking += ticking;
|
||||
+ accumulatedBorder += full;
|
||||
+ accumulatedTicking += blockTicking;
|
||||
+ accumulatedEntityTicking += entityTicking;
|
||||
+
|
||||
+ sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":")));
|
||||
+ sender.sendMessage(text().color(DARK_AQUA).append(
|
||||
+ text("Total: ", BLUE), text(total),
|
||||
+ text(" Inactive: ", BLUE), text(inactive),
|
||||
+ text(" Border: ", BLUE), text(border),
|
||||
+ text(" Ticking: ", BLUE), text(ticking),
|
||||
+ text(" Entity: ", BLUE), text(entityTicking)
|
||||
+ text(" Full: ", BLUE), text(full),
|
||||
+ text(" Block Ticking: ", BLUE), text(blockTicking),
|
||||
+ text(" Entity Ticking: ", BLUE), text(entityTicking)
|
||||
+ ));
|
||||
+ }
|
||||
+ if (worlds.size() > 1) {
|
||||
|
@ -14072,9 +14074,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ sender.sendMessage(text().color(DARK_AQUA).append(
|
||||
+ text("Total: ", BLUE), text(accumulatedTotal),
|
||||
+ text(" Inactive: ", BLUE), text(accumulatedInactive),
|
||||
+ text(" Border: ", BLUE), text(accumulatedBorder),
|
||||
+ text(" Ticking: ", BLUE), text(accumulatedTicking),
|
||||
+ text(" Entity: ", BLUE), text(accumulatedEntityTicking)
|
||||
+ text(" Full: ", BLUE), text(accumulatedBorder),
|
||||
+ text(" Block Ticking: ", BLUE), text(accumulatedTicking),
|
||||
+ text(" Entity Ticking: ", BLUE), text(accumulatedEntityTicking)
|
||||
+ ));
|
||||
+ }
|
||||
+ }
|
||||
|
@ -14387,7 +14389,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ JsonObject playerData = new JsonObject();
|
||||
+ players.add(playerData);
|
||||
+
|
||||
+ Level playerWorld = player.getLevel();
|
||||
+ Level playerWorld = player.level();
|
||||
+ org.bukkit.World craftWorld = playerWorld.getWorld();
|
||||
+ Entity.RemovalReason removalReason = player.getRemovalReason();
|
||||
+
|
||||
|
|
|
@ -71,27 +71,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ @Override
|
||||
+ 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
|
||||
+ 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
|
||||
+ public boolean isGoingHome() {
|
||||
+ return getHandle().isGoingHome();
|
||||
+ return this.getHandle().isGoingHome();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isDigging() {
|
||||
+ return getHandle().isLayingEgg();
|
||||
+ return this.getHandle().isLayingEgg();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setHasEgg(boolean hasEgg) {
|
||||
+ getHandle().setHasEgg(hasEgg);
|
||||
+ this.getHandle().setHasEgg(hasEgg);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // 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());
|
||||
+ 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
|
||||
+ ++i;
|
||||
|
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
logGamemodeChange(context.getSource(), serverPlayer, gameMode);
|
||||
++i;
|
||||
+ } 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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public static ServerPlayer tryGetPlayer(@Nullable Entity entity) {
|
||||
+ // Paper start - ensure level is the same for sculk events
|
||||
+ final ServerPlayer player = tryGetPlayer0(entity);
|
||||
+ return player != null && player.level == entity.level ? player : null;
|
||||
+ return player != null && player.level() == entity.level() ? player : null;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {
|
||||
|
|
Loading…
Reference in a new issue