13
0
geforkt von Mirrors/Paper

More more compile fixes

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-25 22:34:46 +02:00
Ursprung b432863793
Commit ca25aa1859
12 geänderte Dateien mit 47 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final var stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle);
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY;
+ if (!itemstack.isEmpty() && itemstack.getItem().canBeDepleted()) {
+ if (!itemstack.isEmpty() && itemstack.getItem().components().has(net.minecraft.core.component.DataComponents.MAX_STACK_SIZE)) {
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
+ orb.value = amount;
+ orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM;

Datei anzeigen

@ -1869,7 +1869,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // positions of the network to a set and filter out block updates to wires in
+ // the network that way.
+ if (!state.isAir() && !state.is(Blocks.REDSTONE_WIRE)) {
+ state.neighborChanged(level, pos, neighborBlock, neighborPos, false);
+ state.handleNeighborChanged(level, pos, neighborBlock, neighborPos, false);
+ }
+ }
+

Datei anzeigen

@ -4,6 +4,19 @@ Date: Wed, 26 Aug 2020 02:12:31 -0400
Subject: [PATCH] Add additional open container api to HumanEntity
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement {
}
@Nullable
- protected MenuProvider getMenuProvider(BlockState state, Level world, BlockPos pos) {
+ public MenuProvider getMenuProvider(BlockState state, Level world, BlockPos pos) { // Paper - public
return null;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java

Datei anzeigen

@ -3084,7 +3084,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
boolean flag1 = false;
boolean flag2;
+ Packet<?> disguised = sender != null && unsignedFunction == null ? new net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket(outgoingchatmessage.content(), params.toNetwork(sender.level().registryAccess())) : null; // Paper - don't send player chat packets from vanished players
+ Packet<?> disguised = sender != null && unsignedFunction == null ? new net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket(outgoingchatmessage.content(), params) : null; // Paper - don't send player chat packets from vanished players
for (Iterator iterator = this.players.iterator(); iterator.hasNext(); flag1 |= flag2 && message.isFullyFiltered()) {
ServerPlayer entityplayer1 = (ServerPlayer) iterator.next();
@ -3094,7 +3094,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - don't send player chat packets from vanished players
+ if (sender != null && !entityplayer1.getBukkitEntity().canSee(sender.getBukkitEntity())) {
+ entityplayer1.connection.send(unsignedFunction != null
+ ? new net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket(unsignedFunction.apply(entityplayer1.getBukkitEntity()), params.toNetwork(sender.level().registryAccess()))
+ ? new net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket(unsignedFunction.apply(entityplayer1.getBukkitEntity()), params)
+ : disguised);
+ continue;
+ }
@ -4287,7 +4287,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final Component prompt = io.papermc.paper.adventure.PaperAdventure.asVanilla(request.prompt());
+ for (final java.util.Iterator<net.kyori.adventure.resource.ResourcePackInfo> iter = request.packs().iterator(); iter.hasNext();) {
+ final net.kyori.adventure.resource.ResourcePackInfo pack = iter.next();
+ packs.add(new ClientboundResourcePackPushPacket(pack.id(), pack.uri().toASCIIString(), pack.hash(), request.required(), iter.hasNext() ? null : prompt));
+ packs.add(new ClientboundResourcePackPushPacket(pack.id(), pack.uri().toASCIIString(), pack.hash(), request.required(), iter.hasNext() ? Optional.empty() : Optional.of(prompt)));
+ if (request.callback() != net.kyori.adventure.resource.ResourcePackCallback.noOp()) {
+ this.getHandle().connection.packCallbacks.put(pack.id(), request.callback()); // just override if there is a previously existing callback
+ }

Datei anzeigen

@ -187,7 +187,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ if (regionfile.isOversized(pos.x, pos.z)) {
+ printOversizedLog("Loading Oversized Chunk!", regionfile.regionFile, pos.x, pos.z);
+ printOversizedLog("Loading Oversized Chunk!", regionfile.getPath(), pos.x, pos.z);
+ return readOversizedChunk(regionfile, pos);
+ }
+ // Paper end

Datei anzeigen

@ -69,18 +69,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ chunkStatus.generate(
+ new net.minecraft.world.level.chunk.status.WorldGenContext(
+ serverLevel,
+ chunkGenerator,
+ serverLevel.getStructureManager(),
+ serverLevel.chunkSource.getLightEngine()
+ ),
+ mailbox::tell,
+ serverLevel,
+ chunkGenerator,
+ serverLevel.getStructureManager(),
+ serverLevel.chunkSource.getLightEngine(),
+ chunk -> {
+ throw new UnsupportedOperationException("Not creating full chunks here");
+ },
+ chunks
+ ).thenAccept(either -> {
+ if (chunkStatus == net.minecraft.world.level.chunk.status.ChunkStatus.NOISE) {
+ either.left().ifPresent(chunk -> net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, net.minecraft.world.level.chunk.status.ChunkStatus.POST_FEATURES));
+ ).thenAccept(chunk -> {
+ if (chunk != null && chunkStatus == net.minecraft.world.level.chunk.status.ChunkStatus.NOISE) {
+ net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, net.minecraft.world.level.chunk.status.ChunkStatus.POST_FEATURES);
+ }
+ }).join();
+ }

Datei anzeigen

@ -749,12 +749,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (this.isChunkData) {
+ ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
+ if (!chunkPos.equals(pos)) {
+ net.minecraft.server.MinecraftServer.LOGGER.error("Attempting to read chunk data at " + pos + " but got chunk data for " + chunkPos + " instead! Attempting regionfile recalculation for regionfile " + regionfile.regionFile.toAbsolutePath());
+ net.minecraft.server.MinecraftServer.LOGGER.error("Attempting to read chunk data at " + pos + " but got chunk data for " + chunkPos + " instead! Attempting regionfile recalculation for regionfile " + regionfile.getPath().toAbsolutePath());
+ if (regionfile.recalculateHeader()) {
+ regionfile.fileLock.lock(); // otherwise we will unlock twice and only lock once.
+ return this.read(pos, regionfile);
+ }
+ net.minecraft.server.MinecraftServer.LOGGER.error("Can't recalculate regionfile header, regenerating chunk " + pos + " for " + regionfile.regionFile.toAbsolutePath());
+ net.minecraft.server.MinecraftServer.LOGGER.error("Can't recalculate regionfile header, regenerating chunk " + pos + " for " + regionfile.getPath().toAbsolutePath());
+ return null;
+ }
+ }

Datei anzeigen

@ -15,12 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - with type
+ @Override
+ public ItemStack withType(final Material type) {
+ if (type == Material.AIR) return CraftItemStack.asCraftMirror(null);
+ if (type == Material.AIR) {
+ return CraftItemStack.asCraftMirror(null);
+ }
+
+ final net.minecraft.world.item.ItemStack copy = new net.minecraft.world.item.ItemStack(
+ CraftItemType.bukkitToMinecraft(type), this.getAmount()
+ );
+ if (this.handle != null && this.handle.getTag() != null) copy.setTag(this.handle.getTag().copy());
+
+ if (this.handle != null) {
+ copy.applyComponents(this.handle.getComponents());
+ }
+
+ final CraftItemStack mirrored = CraftItemStack.asCraftMirror(copy);
+ mirrored.setItemMeta(mirrored.getItemMeta());

Datei anzeigen

@ -21,14 +21,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Call missing map initialize event and set id
+ final DimensionDataStorage storage = this.getServer().overworld().getDataStorage();
+
+ final net.minecraft.world.level.saveddata.SavedData existing = storage.cache.get(id);
+ if (existing == null && !storage.cache.containsKey(id)) {
+ final net.minecraft.world.level.saveddata.SavedData existing = storage.cache.get(id.key());
+ if (existing == null && !storage.cache.containsKey(id.key())) {
+ final MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id.key());
+ storage.cache.put(id, map);
+ if (map != null) {
+ map.id = id;
+ new MapInitializeEvent(map.mapView).callEvent();
+ return map;
+ storage.cache.put(id.key(), worldmap);
+ if (worldmap != null) {
+ worldmap.id = id;
+ new MapInitializeEvent(worldmap.mapView).callEvent();
+ return worldmap;
+ }
+ } else if (existing instanceof MapItemSavedData mapItemSavedData) {
+ mapItemSavedData.id = id;

Datei anzeigen

@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.getRemainingItemsFor(type, inventory, world, null);
+ }
+ public <C extends Container, T extends Recipe<C>> NonNullList<ItemStack> getRemainingItemsFor(RecipeType<T> type, C inventory, Level world, @Nullable ResourceLocation firstToCheck) {
+ Optional<RecipeHolder<T>> optional = firstToCheck == null ? this.getRecipeFor(type, inventory, world) : this.getRecipeFor(type, inventory, world, firstToCheck).map(Pair::getSecond);
+ Optional<RecipeHolder<T>> optional = firstToCheck == null ? this.getRecipeFor(type, inventory, world) : this.getRecipeFor(type, inventory, world, firstToCheck);
+ // Paper end - Perf: Improve mass crafting
if (optional.isPresent()) {

Datei anzeigen

@ -212,7 +212,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Resend their XP and effects because the respawn packet resets it
+ connection.send(new net.minecraft.network.protocol.game.ClientboundSetExperiencePacket(handle.experienceProgress, handle.totalExperience, handle.experienceLevel));
+ for (net.minecraft.world.effect.MobEffectInstance mobEffect : handle.getActiveEffects()) {
+ connection.send(new net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket(handle.getId(), mobEffect));
+ connection.send(new net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket(handle.getId(), mobEffect, false));
+ }
+ }
+ // Paper end

Datei anzeigen

@ -206,7 +206,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- entityTracker.broadcast(this.getHandle().getAddEntityPacket());
+ // Paper start, resend possibly desynced entity instead of add entity packet
+ for (ServerPlayerConnection playerConnection : entityTracker.seenBy) {
+ this.getHandle().getEntityData().resendPossiblyDesyncedEntityData(playerConnection.getPlayer());
+ this.getHandle().resendPossiblyDesyncedEntityData(playerConnection.getPlayer());
+ }
+ // Paper end
}