mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
compile fixes
This commit is contained in:
parent
ce02863322
commit
9c8593cb14
@ -925,7 +925,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ private net.kyori.adventure.chat.ChatType.Bound adventure(ChatType.Bound chatType) {
|
||||
+ @Subst("key:value") final String stringKey = Objects.requireNonNull(
|
||||
+ ChatProcessor.this.server.registryAccess().registryOrThrow(Registries.CHAT_TYPE).getKey(chatType.chatType()),
|
||||
+ chatType.chatType().unwrapKey().orElseThrow().location(),
|
||||
+ () -> "No key for '%s' in CHAT_TYPE registry.".formatted(chatType)
|
||||
+ ).toString();
|
||||
+ net.kyori.adventure.chat.@Nullable ChatType adventure = BUILT_IN_CHAT_TYPES.get(stringKey);
|
||||
@ -934,7 +934,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ return adventure.bind(
|
||||
+ PaperAdventure.asAdventure(chatType.name()),
|
||||
+ PaperAdventure.asAdventure(chatType.targetName())
|
||||
+ chatType.targetName().map(PaperAdventure::asAdventure).orElse(null)
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
@ -3603,7 +3603,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public void name(net.kyori.adventure.text.Component name) {
|
||||
+ getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
||||
+ getSnapshot().getCommandBlock().setCustomName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+package io.papermc.paper.world.worldgen;
|
||||
+
|
||||
+import com.mojang.serialization.Codec;
|
||||
+import com.mojang.serialization.MapCodec;
|
||||
+import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
@ -46,7 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public record OptionallyFlatBedrockConditionSource(ResourceLocation randomName, VerticalAnchor trueAtAndBelow, VerticalAnchor falseAtAndAbove, boolean isRoof) implements SurfaceRules.ConditionSource {
|
||||
+
|
||||
+ private static final ResourceKey<Codec<? extends SurfaceRules.ConditionSource>> CODEC_RESOURCE_KEY = ResourceKey.create(Registries.MATERIAL_CONDITION, new ResourceLocation(ResourceLocation.PAPER_NAMESPACE, "optionally_flat_bedrock_condition_source"));
|
||||
+ private static final ResourceKey<MapCodec<? extends SurfaceRules.ConditionSource>> CODEC_RESOURCE_KEY = ResourceKey.create(
|
||||
+ Registries.MATERIAL_CONDITION,
|
||||
+ new ResourceLocation(ResourceLocation.PAPER_NAMESPACE, "optionally_flat_bedrock_condition_source")
|
||||
+ );
|
||||
+ private static final KeyDispatchDataCodec<OptionallyFlatBedrockConditionSource> CODEC = KeyDispatchDataCodec.of(RecordCodecBuilder.mapCodec((instance) -> {
|
||||
+ return instance.group(
|
||||
+ ResourceLocation.CODEC.fieldOf("random_name").forGetter(OptionallyFlatBedrockConditionSource::randomName),
|
||||
|
@ -273,7 +273,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ public static String getUsableName(Class<?> clazz) {
|
||||
+ String name = MappingEnvironment.reobf() ? ObfHelper.INSTANCE.deobfClassName(clazz.getName()) : clazz.getName();
|
||||
+ String name = io.papermc.paper.util.MappingEnvironment.reobf() ? ObfHelper.INSTANCE.deobfClassName(clazz.getName()) : clazz.getName();
|
||||
+ name = name.substring(name.lastIndexOf(".") + 1);
|
||||
+ boolean flag = false;
|
||||
+ // inner classes
|
||||
@ -625,7 +625,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public <T extends Mob> Collection<Goal<T>> getRunningGoals(T mob, GoalType type) {
|
||||
+ CraftMob craftMob = (CraftMob) mob;
|
||||
+ Set<Goal<T>> goals = new HashSet<>();
|
||||
+ getHandle(craftMob, type).getRunningGoals()
|
||||
+ getHandle(craftMob, type).getAvailableGoals()
|
||||
+ .stream().filter(WrappedGoal::isRunning)
|
||||
+ .filter(item -> item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type)))
|
||||
+ .forEach(item -> {
|
||||
+ if (item.getGoal() instanceof PaperCustomGoal) {
|
||||
@ -646,7 +647,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (internalType == type) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ getHandle(craftMob, internalType).getRunningGoals()
|
||||
+ getHandle(craftMob, internalType).getAvailableGoals()
|
||||
+ .stream()
|
||||
+ .filter(WrappedGoal::isRunning)
|
||||
+ .filter(item -> !item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type)))
|
||||
+ .forEach(item -> {
|
||||
+ if (item.getGoal() instanceof PaperCustomGoal) {
|
||||
|
@ -20,7 +20,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (tooltipContext.isCreative()) {
|
||||
+ flag = flag.asCreative();
|
||||
+ }
|
||||
+ final java.util.List<net.minecraft.network.chat.Component> lines = CraftItemStack.asNMSCopy(itemStack).getTooltipLines(player == null ? null : ((org.bukkit.craftbukkit.entity.CraftPlayer) player).getHandle(), flag);
|
||||
+ final java.util.List<net.minecraft.network.chat.Component> lines = CraftItemStack.asNMSCopy(itemStack).getTooltipLines(
|
||||
+ net.minecraft.world.item.Item.TooltipContext.of(player == null ? net.minecraft.server.MinecraftServer.getServer().registryAccess() : ((org.bukkit.craftbukkit.entity.CraftPlayer) player).getHandle().level().registryAccess()),
|
||||
+ player == null ? null : ((org.bukkit.craftbukkit.entity.CraftPlayer) player).getHandle(), flag);
|
||||
+ return lines.stream().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).toList();
|
||||
+ }
|
||||
+ // Paper end - expose itemstack tooltip lines
|
||||
|
@ -96,8 +96,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemStack);
|
||||
+ net.minecraft.nbt.CompoundTag entity = new net.minecraft.nbt.CompoundTag();
|
||||
+ entity.putString("id", net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getKey(net.minecraft.world.entity.EntityType.ITEM).toString());
|
||||
+ entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag()));
|
||||
+ this.getSnapshot().getSpawner().setNextSpawnData(this.isPlaced() ? this.world.getHandle() : null, this.getPosition(), new net.minecraft.world.level.SpawnData(entity, java.util.Optional.empty()));
|
||||
+ entity.put("Item", item.save(this.world.getHandle().registryAccess()));
|
||||
+ this.getSnapshot().getSpawner().setNextSpawnData(
|
||||
+ this.isPlaced() ? this.world.getHandle() : null,
|
||||
+ this.getPosition(),
|
||||
+ new net.minecraft.world.level.SpawnData(
|
||||
+ entity,
|
||||
+ java.util.Optional.empty(),
|
||||
+ Optional.ofNullable(this.getSnapshot().getSpawner().nextSpawnData).flatMap(SpawnData::equipment)
|
||||
+ )
|
||||
+ );
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
super(world, tileEntity);
|
||||
@@ -0,0 +0,0 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
|
||||
public void name(net.kyori.adventure.text.Component name) {
|
||||
getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
||||
getSnapshot().getCommandBlock().setCustomName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
|
@ -57,6 +57,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ private void doDumpItem(final CommandSender sender) {
|
||||
+ if (true) throw new UnsupportedOperationException("FIXME"); // TODO
|
||||
+ /*
|
||||
+ if (!(sender instanceof Player)) {
|
||||
+ sender.sendMessage("Only players can use this command");
|
||||
+ return;
|
||||
@ -80,5 +82,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ .color(GRAY)
|
||||
+ .decorate(ITALIC)
|
||||
+ .clickEvent(ClickEvent.copyToClipboard(tag == null ? itemId : (itemId + tag))));
|
||||
+ */
|
||||
+ }
|
||||
+}
|
||||
|
@ -8869,15 +8869,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
|
||||
+import ca.spottedleaf.concurrentutil.util.ConcurrentUtil;
|
||||
+import com.mojang.datafixers.util.Either;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import net.minecraft.server.level.ChunkHolder;
|
||||
+import net.minecraft.server.level.ChunkMap;
|
||||
+import net.minecraft.server.level.ChunkResult;
|
||||
+import net.minecraft.server.level.ServerChunkCache;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
+import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
+import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
+import net.minecraft.world.level.chunk.status.WorldGenContext;
|
||||
+import org.slf4j.Logger;
|
||||
+import java.lang.invoke.VarHandle;
|
||||
+import java.util.List;
|
||||
@ -8931,7 +8931,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ final ServerChunkCache serverChunkCache = this.world.chunkSource;
|
||||
+ final ChunkMap chunkMap = serverChunkCache.chunkMap;
|
||||
+
|
||||
+ final CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completeFuture;
|
||||
+ final CompletableFuture<ChunkAccess> completeFuture;
|
||||
+
|
||||
+ final boolean generation;
|
||||
+ boolean completing = false;
|
||||
@ -8939,6 +8939,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // note: should optimise the case where the chunk does not need to execute the status, because
|
||||
+ // schedule() calls this synchronously if it will run through that path
|
||||
+
|
||||
+ final WorldGenContext ctx = new WorldGenContext(
|
||||
+ this.world,
|
||||
+ chunkMap.generator,
|
||||
+ chunkMap.getWorldGenContext().structureManager(),
|
||||
+ serverChunkCache.getLightEngine()
|
||||
+ );
|
||||
+ try {
|
||||
+ generation = !chunk.getStatus().isOrAfter(this.toStatus);
|
||||
+ if (generation) {
|
||||
@ -8950,12 +8956,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.complete(chunk, null);
|
||||
+ return;
|
||||
+ }
|
||||
+ completeFuture = this.toStatus.generate(Runnable::run, this.world, chunkMap.generator, chunkMap.structureTemplateManager,
|
||||
+ serverChunkCache.getLightEngine(), null, this.neighbours)
|
||||
+ .whenComplete((final Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either, final Throwable throwable) -> {
|
||||
+ final ChunkAccess newChunk = (either == null) ? null : either.left().orElse(null);
|
||||
+ if (newChunk instanceof ProtoChunk) {
|
||||
+ ((ProtoChunk)newChunk).setStatus(ChunkUpgradeGenericStatusTask.this.toStatus);
|
||||
+ completeFuture = this.toStatus.generate(ctx, Runnable::run, null, this.neighbours)
|
||||
+ .whenComplete((final ChunkAccess either, final Throwable throwable) -> {
|
||||
+ if (either instanceof ProtoChunk proto) {
|
||||
+ proto.setStatus(ChunkUpgradeGenericStatusTask.this.toStatus);
|
||||
+ }
|
||||
+ }
|
||||
+ );
|
||||
@ -8965,7 +8969,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.complete(chunk, null);
|
||||
+ return;
|
||||
+ }
|
||||
+ completeFuture = this.toStatus.load(this.world, chunkMap.structureTemplateManager, serverChunkCache.getLightEngine(), null, chunk);
|
||||
+ completeFuture = this.toStatus.load(ctx, null, chunk);
|
||||
+ }
|
||||
+ } catch (final Throwable throwable) {
|
||||
+ if (!completing) {
|
||||
@ -8996,12 +9000,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ LOGGER.warn("Future status not complete after scheduling: " + this.toStatus.toString() + ", generate: " + generation);
|
||||
+ }
|
||||
+
|
||||
+ final Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either;
|
||||
+ final ChunkResult<ChunkAccess> either;
|
||||
+ final ChunkAccess newChunk;
|
||||
+
|
||||
+ try {
|
||||
+ either = completeFuture.join();
|
||||
+ newChunk = (either == null) ? null : either.left().orElse(null);
|
||||
+ newChunk = (either == null) ? null : either.orElse(null);
|
||||
+ } catch (final Throwable throwable) {
|
||||
+ this.complete(null, throwable);
|
||||
+ // ensure the chunk system can respond, then die
|
||||
|
Loading…
Reference in New Issue
Block a user