Updated Upstream (Bukkit/CraftBukkit) (#8823)

This commit is contained in:
Jake Potrebic 2023-02-07 07:55:53 -08:00
parent 3212d9fcf5
commit 5fba40cc67
6 changed files with 10 additions and 43 deletions

View File

@ -8,27 +8,12 @@ diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chun
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Chunk.java --- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java
@@ -0,0 +0,0 @@
package org.bukkit;
import java.util.Collection;
+import java.util.function.Predicate;
+
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder { @@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder {
@NotNull
Entity[] getEntities();
+ // Paper start
/**
* Get a list of all tile entities in the chunk.
*
* @return The tile entities. * @return The tile entities.
*/ */
@NotNull @NotNull
- BlockState[] getTileEntities(); - BlockState[] getTileEntities();
+ // Paper start
+ default BlockState[] getTileEntities() { + default BlockState[] getTileEntities() {
+ return getTileEntities(true); + return getTileEntities(true);
+ } + }
@ -50,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return The tile entities. + * @return The tile entities.
+ */ + */
+ @NotNull + @NotNull
+ Collection<BlockState> getTileEntities(@NotNull Predicate<Block> blockPredicate, boolean useSnapshot); + Collection<BlockState> getTileEntities(java.util.function.@NotNull Predicate<Block> blockPredicate, boolean useSnapshot);
+ // Paper end + // Paper end
/** /**

View File

@ -126,8 +126,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/ */
- @Deprecated - @Deprecated
public NamespacedKey(@NotNull String namespace, @NotNull String key) { public NamespacedKey(@NotNull String namespace, @NotNull String key) {
Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace); Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key); Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key);
diff --git a/src/main/java/org/bukkit/NetherWartsState.java b/src/main/java/org/bukkit/NetherWartsState.java diff --git a/src/main/java/org/bukkit/NetherWartsState.java b/src/main/java/org/bukkit/NetherWartsState.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/NetherWartsState.java --- a/src/main/java/org/bukkit/NetherWartsState.java

View File

@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
PalettedContainerRO<Holder<Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; PalettedContainerRO<Holder<net.minecraft.world.level.biome.Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null;
Registry<Biome> iregistry = this.worldServer.registryAccess().registryOrThrow(Registries.BIOME); Registry<net.minecraft.world.level.biome.Biome> iregistry = this.worldServer.registryAccess().registryOrThrow(Registries.BIOME);
- Codec<PalettedContainerRO<Holder<Biome>>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); - Codec<PalettedContainerRO<Holder<net.minecraft.world.level.biome.Biome>>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
for (int i = 0; i < cs.length; i++) { for (int i = 0; i < cs.length; i++) {
- CompoundTag data = new CompoundTag(); - CompoundTag data = new CompoundTag();
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (biome != null) { if (biome != null) {
- data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get()); - data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get());
- biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get(); - biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get();
+ biome[i] = ((PalettedContainer<Holder<Biome>>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs + biome[i] = ((PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs
} }
} }

View File

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sun, 4 Apr 2021 14:25:04 -0400
Subject: [PATCH] Fix checkReach check for Shulker boxes
diff --git a/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java b/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java
@@ -0,0 +0,0 @@ public class ShulkerBoxMenu extends AbstractContainerMenu {
@Override
public boolean stillValid(Player player) {
+ if (!this.checkReachable) return true; // Paper - Add reachable override for ContainerShulkerBox
return this.container.stillValid(player);
}

@ -1 +1 @@
Subproject commit 79e3967192566bce29eb6688fc3abafa69a2be24 Subproject commit 22f8c20898698bdd5fe348404a49d0cad36fef0b

@ -1 +1 @@
Subproject commit ab8ace68577ab6c0eb2f84b19bbf1adf3ad4a01d Subproject commit 39462a898595280d1a1c6197c2ad66082434ba80