Compiler issues v3

This commit is contained in:
Bjarne Koll 2024-10-25 14:55:49 +02:00
parent 6fb86bb20a
commit 918ca965d9
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
53 changed files with 154 additions and 124 deletions

View file

@ -58,19 +58,6 @@ index 7344cff32fa6fe3dedb74ed98126072c55b0abd2..d98b28e9488a5a7736719cf656736bb0
entityliving1 = entityliving2; entityliving1 = entityliving2;
} else { } else {
entityliving1 = null; entityliving1 = null;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
index 33170f2f1d3f030fbf342e44a1baa109a34c31a7..db8bb6e47b28bac6cf568415af3ffdd6eeac6ac7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
@@ -349,7 +349,7 @@ public class Dolphin extends AgeableWaterCreature {
@Nullable
@Override
- protected SoundEvent getDeathSound() {
+ public SoundEvent getDeathSound() { // Paper - remap fixes
return SoundEvents.DOLPHIN_DEATH;
}
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
index f3a2612f0e27c36d5206334307eac1880ce8c4b7..4d4d413b8527e1a109276928611b8c857ad6f6aa 100644 index f3a2612f0e27c36d5206334307eac1880ce8c4b7..4d4d413b8527e1a109276928611b8c857ad6f6aa 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java

View file

@ -4,6 +4,19 @@ Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 5b9ca3d968fd4884b1b7f2c06477ae00c09f202e..0842080f1840a83b34c2cc829dfddba78ba12157 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -533,7 +533,7 @@ public class Util {
public static <K extends Enum<K>, V> EnumMap<K, V> makeEnumMap(Class<K> enumClass, Function<K, V> mapper) {
EnumMap<K, V> enumMap = new EnumMap<>(enumClass);
- for (K enum_ : (Enum[])enumClass.getEnumConstants()) {
+ for (K enum_ : enumClass.getEnumConstants()) { // Paper - decompile error
enumMap.put(enum_, mapper.apply(enum_));
}
diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
index 643bb8860962ad691b11073f6dbf406bf7ec5fb1..9b8ec1fd158f6e51779be263fd56b9119d0d9bbb 100644 index 643bb8860962ad691b11073f6dbf406bf7ec5fb1..9b8ec1fd158f6e51779be263fd56b9119d0d9bbb 100644
--- a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java --- a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
@ -70,6 +83,19 @@ index a614e960fcd5958ad17b679eee8a8e6926f58e62..da101bca71f4710812621b98f0a0d8ca
} }
if (!this.hasElementSeparator()) { if (!this.hasElementSeparator()) {
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index f4f1a99d53ffb953beb2a944f54d28fa6349fa29..a75f6fefdd72188fa8d16df2b5cbb34c4129f52d 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -74,7 +74,7 @@ import org.slf4j.Logger;
public class RegistryDataLoader {
private static final Logger LOGGER = LogUtils.getLogger();
- private static final Comparator<ResourceKey<?>> ERROR_KEY_COMPARATOR = Comparator.comparing(ResourceKey::registry).thenComparing(ResourceKey::location);
+ private static final Comparator<ResourceKey<?>> ERROR_KEY_COMPARATOR = Comparator.<ResourceKey<?>, ResourceLocation>comparing(ResourceKey::registry).thenComparing(ResourceKey::location); // Paper - decompile fix
private static final RegistrationInfo NETWORK_REGISTRATION_INFO = new RegistrationInfo(Optional.empty(), Lifecycle.experimental());
private static final Function<Optional<KnownPack>, RegistrationInfo> REGISTRATION_INFO_CACHE = Util.memoize(knownPacks -> {
Lifecycle lifecycle = knownPacks.map(KnownPack::isVanilla).map(vanilla -> Lifecycle.stable()).orElse(Lifecycle.experimental());
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3fc0abef2c4e2c8ceb3b8c4f02c59700aa3d0803..8e16bc7da15824723f1d7d4bff87fac181978500 100644 index 3fc0abef2c4e2c8ceb3b8c4f02c59700aa3d0803..8e16bc7da15824723f1d7d4bff87fac181978500 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
@ -96,6 +122,19 @@ index 661a6274a800ca9b91bdb809d026972d23c3b263..ea72dcb064a35bc6245bc5c94d592efe
} }
public static <T> SortedArraySet<T> create(Comparator<T> comparator) { public static <T> SortedArraySet<T> create(Comparator<T> comparator) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
index 33170f2f1d3f030fbf342e44a1baa109a34c31a7..dde1ccca98f58200910334160f0f79eb00dd2388 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
@@ -349,7 +349,7 @@ public class Dolphin extends AgeableWaterCreature {
@Nullable
@Override
- protected SoundEvent getDeathSound() {
+ public SoundEvent getDeathSound() { // Paper - decompile error
return SoundEvents.DOLPHIN_DEATH;
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Pillager.java b/src/main/java/net/minecraft/world/entity/monster/Pillager.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Pillager.java b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
index cf025d7a4392213db3cf04e7ace3e2b166e710eb..3e8631c7bd1e7591051ca21c6ae7acd87d3c7529 100644 index cf025d7a4392213db3cf04e7ace3e2b166e710eb..3e8631c7bd1e7591051ca21c6ae7acd87d3c7529 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java --- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java

View file

@ -3868,7 +3868,7 @@ index 0000000000000000000000000000000000000000..11b7f15755dde766140c29bedca456c8
+} +}
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..af9623240ff2d389aa7090623f507720e7dbab7d index 0000000000000000000000000000000000000000..561a1a3ff418393d0a0db58de91b336f4c33aa4e
--- /dev/null --- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java
@@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
@ -3882,11 +3882,11 @@ index 0000000000000000000000000000000000000000..af9623240ff2d389aa7090623f507720
+ // min, max are inclusive + // min, max are inclusive
+ +
+ public static int getMaxSection(final LevelHeightAccessor world) { + public static int getMaxSection(final LevelHeightAccessor world) {
+ return world.getMaxSection() - 1; // getMaxSection() is exclusive + return world.getMaxSectionY() - 1; // getMaxSection() is exclusive
+ } + }
+ +
+ public static int getMinSection(final LevelHeightAccessor world) { + public static int getMinSection(final LevelHeightAccessor world) {
+ return world.getMinSection(); + return world.getMinSectionY();
+ } + }
+ +
+ public static int getMaxLightSection(final LevelHeightAccessor world) { + public static int getMaxLightSection(final LevelHeightAccessor world) {
@ -4288,7 +4288,7 @@ index 0000000000000000000000000000000000000000..f7114d5b8f2f93f62883e24da29afaf9
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 5b9ca3d968fd4884b1b7f2c06477ae00c09f202e..5d0ef11671beb2381e0e1959f5e5f845789a2982 100644 index 0842080f1840a83b34c2cc829dfddba78ba12157..2ff5a6517d717bbd4c944572040bd30866347341 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -136,7 +136,7 @@ public class Util { @@ -136,7 +136,7 @@ public class Util {
@ -4538,7 +4538,7 @@ index 59bc334ade71c106e01e54db8d21fb65563dd3f1..b9ab241b930edc63a39dbbcf14cd0b5e
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 952936754cbe5a6fae543d19432599e30eb495b0..88e98f49565a098debcea8d58368e53d7623f6b5 100644 index 952936754cbe5a6fae543d19432599e30eb495b0..3bb6eaabe8f62b556a52b83227b48f8324a9d0f0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -174,6 +174,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -174,6 +174,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -4616,29 +4616,27 @@ index 952936754cbe5a6fae543d19432599e30eb495b0..88e98f49565a098debcea8d58368e53d
} }
private void processUnloads(BooleanSupplier shouldKeepTicking) { private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -568,9 +583,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -568,8 +583,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.scheduleUnload(pos, chunk); this.scheduleUnload(pos, chunk);
} else { } else {
ChunkAccess ichunkaccess = chunk.getLatestChunk(); ChunkAccess ichunkaccess = chunk.getLatestChunk();
- -
- if (this.pendingUnloads.remove(pos, chunk) && ichunkaccess != null) { - if (this.pendingUnloads.remove(pos, chunk) && ichunkaccess != null) {
- LevelChunk chunk1;
+ // Paper start + // Paper start
+ boolean removed; + boolean removed;
+ if ((removed = this.pendingUnloads.remove(pos, chunk)) && ichunkaccess != null) { + if ((removed = this.pendingUnloads.remove(pos, chunk)) && ichunkaccess != null) {
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk); + ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk);
+ // Paper end + // Paper end
+ LevelChunk chunk; LevelChunk chunk1;
if (ichunkaccess instanceof LevelChunk) { if (ichunkaccess instanceof LevelChunk) {
chunk1 = (LevelChunk) ichunkaccess;
@@ -587,7 +605,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -587,7 +605,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate(); this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.nextChunkSaveTime.remove(ichunkaccess.getPos().toLong()); this.nextChunkSaveTime.remove(ichunkaccess.getPos().toLong());
- } - }
+ } else if (removed) { // Paper start + } else if (removed) { // Paper start
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, holder); + ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk);
+ } // Paper end + } // Paper end
} }

View file

@ -991,7 +991,7 @@ index 9d6be455c3bbcdbcb9d3d24b0bad79f46ba6a8cb..de6cceeec4fc4a64d325b506ae9d9b0e
// CraftBukkit end // CraftBukkit end
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 88e98f49565a098debcea8d58368e53d7623f6b5..84ea1974445fc7be80ed474d8a2133b58ee4c8fe 100644 index 3bb6eaabe8f62b556a52b83227b48f8324a9d0f0..30b28d9523820ed138c837ab9ee9bbb23c0dd285 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@

View file

@ -109,7 +109,7 @@ index 0000000000000000000000000000000000000000..0699c60920333ea1fec04e3c94d95224
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..de528b8bafd75b6f14b1384157f3a8a27e06b4a2 index 0000000000000000000000000000000000000000..d933054535c83f877888cd36cd8bd8bf9d93a9df
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
@ -128,18 +128,18 @@ index 0000000000000000000000000000000000000000..de528b8bafd75b6f14b1384157f3a8a2
+ /* Lootable */ + /* Lootable */
+ @Override + @Override
+ default @Nullable LootTable getLootTable() { + default @Nullable LootTable getLootTable() {
+ return CraftLootTable.minecraftToBukkit(this.getHandle().getLootTable()); + return CraftLootTable.minecraftToBukkit(this.getHandle().getContainerLootTable());
+ } + }
+ +
+ @Override + @Override
+ default void setLootTable(final @Nullable LootTable table, final long seed) { + default void setLootTable(final @Nullable LootTable table, final long seed) {
+ this.getHandle().setLootTable(CraftLootTable.bukkitToMinecraft(table)); + this.getHandle().setContainerLootTable(CraftLootTable.bukkitToMinecraft(table));
+ this.getHandle().setLootTableSeed(seed); + this.getHandle().setContainerLootTableSeed(seed);
+ } + }
+ +
+ @Override + @Override
+ default long getSeed() { + default long getSeed() {
+ return this.getHandle().getLootTableSeed(); + return this.getHandle().getContainerLootTableSeed();
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java

View file

@ -80,21 +80,22 @@ index 4c284ccd5b2eb05f487aba18e1daa0b59c3e8129..10c79cbc25383c0b65fb22a734751313
double deltaLength = Math.sqrt(distanceSquared); double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
index 04fce5cc4350df81c7ea103b74b845313dd6cc37..770467bd319f8e2fdf3d713591368aa825cfa5ae 100644 index 04fce5cc4350df81c7ea103b74b845313dd6cc37..08cbf02bba3633a84cce90c202d13f2beb5b88a2 100644
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
@@ -66,11 +66,12 @@ public class EnderEyeItem extends Item { @@ -66,11 +66,13 @@ public class EnderEyeItem extends Item {
// world.globalLevelEvent(1038, blockposition1.offset(1, 0, 1), 0); // world.globalLevelEvent(1038, blockposition1.offset(1, 0, 1), 0);
int viewDistance = world.getCraftServer().getViewDistance() * 16; int viewDistance = world.getCraftServer().getViewDistance() * 16;
BlockPos soundPos = blockposition1.offset(1, 0, 1); BlockPos soundPos = blockposition1.offset(1, 0, 1);
- for (ServerPlayer player : world.getServer().getPlayerList().players) { - for (ServerPlayer player : world.getServer().getPlayerList().players) {
+ for (ServerPlayer player : world.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule + final net.minecraft.server.level.ServerLevel serverLevel = (net.minecraft.server.level.ServerLevel) world; // Paper - respect global sound events gamerule - ensured by isClientSide check above
+ for (ServerPlayer player : serverLevel.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule
double deltaX = soundPos.getX() - player.getX(); double deltaX = soundPos.getX() - player.getX();
double deltaZ = soundPos.getZ() - player.getZ(); double deltaZ = soundPos.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
- if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot - if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot
+ final double soundRadiusSquared = world.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule + final double soundRadiusSquared = serverLevel.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule
+ if (!world.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule + if (!serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule
if (distanceSquared > viewDistance * viewDistance) { if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared); double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;

View file

@ -10,7 +10,7 @@ out due to a sync load, as the worldgen threads will be
stalling on profile lookups. stalling on profile lookups.
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 5d0ef11671beb2381e0e1959f5e5f845789a2982..b87d3ac2700eedb492bd55a631c60630c2f9c96c 100644 index 2ff5a6517d717bbd4c944572040bd30866347341..8cac2075077b1d9c2b01e09c99780ff9e204abb2 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -95,6 +95,22 @@ public class Util { @@ -95,6 +95,22 @@ public class Util {

View file

@ -9,7 +9,7 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 84ea1974445fc7be80ed474d8a2133b58ee4c8fe..aa3155bb57c09895d13914b46c77de78a90f250a 100644 index 30b28d9523820ed138c837ab9ee9bbb23c0dd285..01c32ed14b1047671883911f8606ef2924ebee73 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1100,7 +1100,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1100,7 +1100,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -201,7 +201,7 @@ index 7a5045469bc2d383ed087dcc094b6f97df4ec7ab..fa92a1346825f00a585503d0a0825711
} }
} }
diff --git a/src/main/java/net/minecraft/world/item/SnowballItem.java b/src/main/java/net/minecraft/world/item/SnowballItem.java diff --git a/src/main/java/net/minecraft/world/item/SnowballItem.java b/src/main/java/net/minecraft/world/item/SnowballItem.java
index ada9bc42a788b5f472324a0765edf5766d729784..1e996276a80b34e353c6a7c7fee765c9db7123ea 100644 index ada9bc42a788b5f472324a0765edf5766d729784..57872ebef6beb8cdc03c9f8f19de94652ee19062 100644
--- a/src/main/java/net/minecraft/world/item/SnowballItem.java --- a/src/main/java/net/minecraft/world/item/SnowballItem.java
+++ b/src/main/java/net/minecraft/world/item/SnowballItem.java +++ b/src/main/java/net/minecraft/world/item/SnowballItem.java
@@ -26,17 +26,26 @@ public class SnowballItem extends Item implements ProjectileItem { @@ -26,17 +26,26 @@ public class SnowballItem extends Item implements ProjectileItem {
@ -212,7 +212,7 @@ index ada9bc42a788b5f472324a0765edf5766d729784..1e996276a80b34e353c6a7c7fee765c9
- itemstack.consume(1, user); - itemstack.consume(1, user);
+ // Paper start - PlayerLaunchProjectileEvent + // Paper start - PlayerLaunchProjectileEvent
+ final Projectile.Delayed<Snowball> snowball = Projectile.spawnProjectileFromRotationDelayed(Snowball::new, worldserver, itemstack, user, 0.0F, 1.5F, 1.0F); + final Projectile.Delayed<Snowball> snowball = Projectile.spawnProjectileFromRotationDelayed(Snowball::new, worldserver, itemstack, user, 0.0F, 1.5F, 1.0F);
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity()); + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) snowball.projectile().getBukkitEntity());
+ if (event.callEvent() && snowball.attemptSpawn()) { + if (event.callEvent() && snowball.attemptSpawn()) {
+ user.awardStat(Stats.ITEM_USED.get(this)); + user.awardStat(Stats.ITEM_USED.get(this));
+ if (event.shouldConsume()) { + if (event.shouldConsume()) {

View file

@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index b87d3ac2700eedb492bd55a631c60630c2f9c96c..0fbe4ea495a8101f6bc1b9830ce3f47af2aa5be4 100644 index 8cac2075077b1d9c2b01e09c99780ff9e204abb2..bf2833c92eca6491699b4a89410e4e46b5bbe4d1 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -92,7 +92,7 @@ public class Util { @@ -92,7 +92,7 @@ public class Util {

View file

@ -8,7 +8,7 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index aa3155bb57c09895d13914b46c77de78a90f250a..b849d24144dc9f7d24484398cec3b2b90befb507 100644 index 01c32ed14b1047671883911f8606ef2924ebee73..f8decd2f1841da947a3cff5b275efff63ba37def 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1604,6 +1604,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1604,6 +1604,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing. Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b849d24144dc9f7d24484398cec3b2b90befb507..f3b99cd96672363e0d60e56b744f0bea8fa00c3f 100644 index f8decd2f1841da947a3cff5b275efff63ba37def..926e1ebfe3a011a28fb82b855511aaabca0c4072 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1300,6 +1300,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1300,6 +1300,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -31,7 +31,7 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f3b99cd96672363e0d60e56b744f0bea8fa00c3f..8121f7f5fb4dadb1c929b3d81121e3649981bfac 100644 index 926e1ebfe3a011a28fb82b855511aaabca0c4072..4d8dcc47b39d28ab715110e55110869fe3c9b456 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1307,6 +1307,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1307,6 +1307,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerItemCooldownEvent
diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..872813ef19fc08cad93786367e15f59400825c33 100644 index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..2a80b8e962bf9d01e720b5967f0feac7d5dcaa28 100644
--- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java --- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
+++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java +++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java
@@ -11,6 +11,16 @@ public class ServerItemCooldowns extends ItemCooldowns { @@ -11,6 +11,16 @@ public class ServerItemCooldowns extends ItemCooldowns {
@ -14,8 +14,8 @@ index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..872813ef19fc08cad93786367e15f594
+ // Paper start - Add PlayerItemCooldownEvent + // Paper start - Add PlayerItemCooldownEvent
+ @Override + @Override
+ public void addCooldown(Item item, int duration) { + public void addCooldown(ItemStack item, int duration) {
+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item), duration); + io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item.getItem()), duration);
+ if (event.callEvent()) { + if (event.callEvent()) {
+ super.addCooldown(item, event.getCooldown()); + super.addCooldown(item, event.getCooldown());
+ } + }

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerShearBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
index 7e2a39a1ee092b46ab46caec0214255d9c333536..a5b84e6844e16cf1fdfb6f45efb8a7a165757d1c 100644 index 7e2a39a1ee092b46ab46caec0214255d9c333536..20f705c90a0a96321cfe29c0cf564013dcccd18f 100644
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
@@ -141,7 +141,7 @@ public class BeehiveBlock extends BaseEntityBlock { @@ -141,7 +141,7 @@ public class BeehiveBlock extends BaseEntityBlock {
@ -25,7 +25,7 @@ index 7e2a39a1ee092b46ab46caec0214255d9c333536..a5b84e6844e16cf1fdfb6f45efb8a7a1
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); + io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3))); + event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3)));
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS;
+ } + }
+ // Paper end + // Paper end
world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F);
@ -39,7 +39,7 @@ index 7e2a39a1ee092b46ab46caec0214255d9c333536..a5b84e6844e16cf1fdfb6f45efb8a7a1
flag = true; flag = true;
world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos); world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos);
diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
index dad7a610286b0ab6b916a6169fa8f6f641deb39a..42413723b3c826debb310ef1d5d2c9f80a616e86 100644 index dad7a610286b0ab6b916a6169fa8f6f641deb39a..2b43c77d5aa609d4716df827cefcf008dfd13a06 100644
--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
@@ -38,16 +38,24 @@ public class PumpkinBlock extends Block { @@ -38,16 +38,24 @@ public class PumpkinBlock extends Block {
@ -50,7 +50,7 @@ index dad7a610286b0ab6b916a6169fa8f6f641deb39a..42413723b3c826debb310ef1d5d2c9f8
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); + io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4))); + event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4)));
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS;
+ } + }
+ // Paper end - Add PlayerShearBlockEvent + // Paper end - Add PlayerShearBlockEvent
Direction direction = hit.getDirection(); Direction direction = hit.getDirection();

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerFlowerPotManipulateEvent
diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
index c6de1b6587b300404c38c27f566c80de11bc0814..863eec736b4941930c62ca357703a56d4d21c950 100644 index c6de1b6587b300404c38c27f566c80de11bc0814..bee71ed48365694c488af88317a738fc6a4e5893 100644
--- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
@@ -61,6 +61,18 @@ public class FlowerPotBlock extends Block { @@ -61,6 +61,18 @@ public class FlowerPotBlock extends Block {
@ -21,7 +21,7 @@ index c6de1b6587b300404c38c27f566c80de11bc0814..863eec736b4941930c62ca357703a56d
+ // Update client + // Update client
+ player.containerMenu.sendAllDataToRemote(); + player.containerMenu.sendAllDataToRemote();
+ +
+ return ItemInteractionResult.CONSUME; + return InteractionResult.CONSUME;
+ } + }
+ // Paper end - Add PlayerFlowerPotManipulateEvent + // Paper end - Add PlayerFlowerPotManipulateEvent
world.setBlock(pos, blockState, 3); world.setBlock(pos, blockState, 3);

View file

@ -719,7 +719,7 @@ index 3f72e30b57fb2a4231e22a2234729408c1240af4..4638ba98dbbdb0f880337347be85a6e0
LOADERS.put(resourceLocation, () -> initializer.run(registry)); LOADERS.put(resourceLocation, () -> initializer.run(registry));
WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN); // Paper - decompile fix WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN); // Paper - decompile fix
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index f4f1a99d53ffb953beb2a944f54d28fa6349fa29..144a6f5b0c53110804d6d099fe857d25f107d938 100644 index a75f6fefdd72188fa8d16df2b5cbb34c4129f52d..61774165a25209ee6d26cf8d80149b220c3874e6 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java --- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java +++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -351,6 +351,7 @@ public class RegistryDataLoader { @@ -351,6 +351,7 @@ public class RegistryDataLoader {

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add StructuresLocateEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 115deba41ec48143570489e8494785a3a48cd789..fd2dd6d25b8d6f3066c60a7f30a58a72cb418b85 100644 index 115deba41ec48143570489e8494785a3a48cd789..e3c5a49611d584fbd19a44da5aa78ff6d7c43881 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -126,6 +126,24 @@ public abstract class ChunkGenerator { @@ -126,6 +126,24 @@ public abstract class ChunkGenerator {
@ -23,12 +23,12 @@ index 115deba41ec48143570489e8494785a3a48cd789..fd2dd6d25b8d6f3066c60a7f30a58a72
+ return null; + return null;
+ } + }
+ if (event.getResult() != null) { + if (event.getResult() != null) {
+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure()))); + return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().lookupOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure())));
+ } + }
+ center = io.papermc.paper.util.MCUtil.toBlockPosition(event.getOrigin()); + center = io.papermc.paper.util.MCUtil.toBlockPosition(event.getOrigin());
+ radius = event.getRadius(); + radius = event.getRadius();
+ skipReferencedStructures = event.shouldFindUnexplored(); + skipReferencedStructures = event.shouldFindUnexplored();
+ structures = HolderSet.direct(api -> world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures()); + structures = HolderSet.direct(api -> world.registryAccess().lookupOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures());
+ } + }
+ // Paper end + // Paper end
ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState(); ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState();

View file

@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e546cf93d79b109d50840ebf1fb133ad3c9331d3..1ae77ef4bd47a4aea894242cd48dbf042477da33 100644 index e546cf93d79b109d50840ebf1fb133ad3c9331d3..844dbd996858aa02e81a4256383df6992b87bde2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -532,6 +532,14 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -532,6 +532,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -18,7 +18,7 @@ index e546cf93d79b109d50840ebf1fb133ad3c9331d3..1ae77ef4bd47a4aea894242cd48dbf04
+ if (!itemToBeRepaired.getType().isItem() || !repairMaterial.getType().isItem()) { + if (!itemToBeRepaired.getType().isItem() || !repairMaterial.getType().isItem()) {
+ return false; + return false;
+ } + }
+ return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); + return CraftItemStack.unwrap(itemToBeRepaired).isValidRepairItem(CraftItemStack.unwrap(repairMaterial));
+ } + }
// Paper end // Paper end

View file

@ -62,7 +62,7 @@ index 68756419ac6ee292db9569eab380a5c14d748002..6d76cc1db3ac3f1ae74c13511937fb86
return defaultAttributes.build(); return defaultAttributes.build();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1ae77ef4bd47a4aea894242cd48dbf042477da33..0d9c90a99aa2d8fcf421680aeef4c2fd7ec0fd57 100644 index 844dbd996858aa02e81a4256383df6992b87bde2..7e33f55e4a269fd8e96080776c97f49d65e895c4 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -391,7 +391,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -391,7 +391,11 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -81,23 +81,23 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0d9c90a99aa2d8fcf421680aeef4c2fd7ec0fd57..5c0a6d93b424db91a5f6474165434f5db3d15a8a 100644 index 7e33f55e4a269fd8e96080776c97f49d65e895c4..c9e0a2a4c7c8ab50f6dbb6079f2cba06652a92a3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -544,6 +544,18 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -544,6 +544,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
} }
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); return CraftItemStack.unwrap(itemToBeRepaired).isValidRepairItem(CraftItemStack.unwrap(repairMaterial));
} }
+ +
+ @Override + @Override
+ public boolean hasDefaultEntityAttributes(NamespacedKey bukkitEntityKey) { + public boolean hasDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); + return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
+ } + }
+ +
+ @Override + @Override
+ public org.bukkit.attribute.Attributable getDefaultEntityAttributes(NamespacedKey bukkitEntityKey) { + public org.bukkit.attribute.Attributable getDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
+ Preconditions.checkArgument(hasDefaultEntityAttributes(bukkitEntityKey), bukkitEntityKey + " doesn't have default attributes"); + Preconditions.checkArgument(hasDefaultEntityAttributes(bukkitEntityKey), bukkitEntityKey + " doesn't have default attributes");
+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); + var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
+ return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); + return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
+ } + }
// Paper end // Paper end

View file

@ -50,7 +50,7 @@ index 0c1c9033646dedcf1d11dee74d6965683adadf0a..1ed01978611cddb2558e441863dadc46
@Override @Override
public boolean isInvisible() { // Paper - moved up from LivingEntity public boolean isInvisible() { // Paper - moved up from LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 5c0a6d93b424db91a5f6474165434f5db3d15a8a..e2873a1eeb01516b689d0175b091808b2797995f 100644 index c9e0a2a4c7c8ab50f6dbb6079f2cba06652a92a3..8d51786837448db1a96d0071293025d07e14c225 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -494,7 +494,33 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -494,7 +494,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -80,7 +80,7 @@ index 5c0a6d93b424db91a5f6474165434f5db3d15a8a..e2873a1eeb01516b689d0175b091808b
+ // Generate a new UUID so we don't have to worry about deserializing the same entity twice + // Generate a new UUID so we don't have to worry about deserializing the same entity twice
+ compound.remove("UUID"); + compound.remove("UUID");
+ } + }
+ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle()) + return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle(), net.minecraft.world.entity.EntitySpawnReason.LOAD)
+ .orElseThrow(() -> new IllegalArgumentException("An ID was not found for the data. Did you downgrade?")).getBukkitEntity(); + .orElseThrow(() -> new IllegalArgumentException("An ID was not found for the data. Did you downgrade?")).getBukkitEntity();
+ } + }
+ +

View file

@ -7,7 +7,7 @@ Reference2BooleanOpenHashMap is going to have
better lookups than HashMap. better lookups than HashMap.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 8121f7f5fb4dadb1c929b3d81121e3649981bfac..7f18146c0dea654c62b3e01e6848fd1c05f87946 100644 index 4d8dcc47b39d28ab715110e55110869fe3c9b456..75854574aa8d4aef35d84ba4c0fc7df9a67ae48c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1520,7 +1520,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1520,7 +1520,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -19,7 +19,7 @@ index 49028463ba47e760281545c2f7597e3db8d6c453..7620c72a4c243cbeea245203ce03a97c
} }
final Object val = config.get(key); final Object val = config.get(key);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index fd2dd6d25b8d6f3066c60a7f30a58a72cb418b85..575fa665ff9c8f52056a0e7305540ec5c3da4785 100644 index e3c5a49611d584fbd19a44da5aa78ff6d7c43881..fc8e3edd9734fa7b69f0fc6b4eefd8a704e451cf 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -436,7 +436,14 @@ public abstract class ChunkGenerator { @@ -436,7 +436,14 @@ public abstract class ChunkGenerator {

View file

@ -7,7 +7,7 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 0fbe4ea495a8101f6bc1b9830ce3f47af2aa5be4..60e523f4de1cbafc2c58a5d568fe3989b7b07c34 100644 index bf2833c92eca6491699b4a89410e4e46b5bbe4d1..57223285860f61119b6cf348aa78e59384a04e22 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -1082,16 +1082,7 @@ public class Util { @@ -1082,16 +1082,7 @@ public class Util {

View file

@ -20,7 +20,7 @@ seeds/salts to the frequency reducer which has a similar effect.
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com> Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 575fa665ff9c8f52056a0e7305540ec5c3da4785..906f56d07c26ef3c2dc1a3b62e9349dd91a37742 100644 index fc8e3edd9734fa7b69f0fc6b4eefd8a704e451cf..31c5f54c90d6e35875f762747f8618e58e2eed91 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -573,7 +573,7 @@ public abstract class ChunkGenerator { @@ -573,7 +573,7 @@ public abstract class ChunkGenerator {

View file

@ -40,7 +40,7 @@ index e000a918230187f6841b03b7b0dd73687f3cc15e..5c3e5c348e6fececccd8097355f423b9
return true; return true;
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
index a5b84e6844e16cf1fdfb6f45efb8a7a165757d1c..90f69a0c4d0707fd2319db71aea7dfdc14636d82 100644 index 20f705c90a0a96321cfe29c0cf564013dcccd18f..d5ed53c37bba79f84b60d616887cd5176e124f10 100644
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
@@ -103,7 +103,7 @@ public class BeehiveBlock extends BaseEntityBlock { @@ -103,7 +103,7 @@ public class BeehiveBlock extends BaseEntityBlock {

View file

@ -24,7 +24,7 @@ index 37111113f6ab6d77c558b10c4162758135db99b0..911b6391455402922e8bd52cfe9e5694
EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
index db8bb6e47b28bac6cf568415af3ffdd6eeac6ac7..59b00aa57f62ec9d56c28d18c493e952e66f39c7 100644 index dde1ccca98f58200910334160f0f79eb00dd2388..5af4d590a9b0f17ba53c6959d9c18bd1269878a4 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java --- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java +++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
@@ -604,7 +604,7 @@ public class Dolphin extends AgeableWaterCreature { @@ -604,7 +604,7 @@ public class Dolphin extends AgeableWaterCreature {

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e2873a1eeb01516b689d0175b091808b2797995f..66913ab43bb1e9066487749ff60248c22fc8e824 100644 index 8d51786837448db1a96d0071293025d07e14c225..9e0af05e066132b66fafff84ff0a0957c1a44f9f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -584,6 +584,21 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -584,6 +584,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -17,13 +17,13 @@ index e2873a1eeb01516b689d0175b091808b2797995f..66913ab43bb1e9066487749ff60248c2
+ @Override + @Override
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) { + public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor; + org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value())); + return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value()));
+ } + }
+ +
+ @Override + @Override
+ public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) { + public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor; + org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey))); + net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
+ cra.setBiome(x, y, z, biomeBase); + cra.setBiome(x, y, z, biomeBase);
+ } + }
+ // Paper end - namespaced key biome methods + // Paper end - namespaced key biome methods

View file

@ -7,18 +7,23 @@ Co-authored-by: ChristopheG <61288881+chrisgdt@users.noreply.github.com>
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com> Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java diff --git a/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java
index e311f94918fb03e9d202cbae71b0909ea3219180..d090126dbe6b69489490e6b1e2d443fa171ddde6 100644 index e311f94918fb03e9d202cbae71b0909ea3219180..b751748196b458c8a89d512fdd9f9632d25e8be8 100644
--- a/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java --- a/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java
+++ b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java +++ b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java
@@ -25,7 +25,7 @@ class WeavingMobEffect extends MobEffect { @@ -25,11 +25,11 @@ class WeavingMobEffect extends MobEffect {
@Override @Override
public void onMobRemoved(ServerLevel world, LivingEntity entity, int amplifier, Entity.RemovalReason reason) { public void onMobRemoved(ServerLevel world, LivingEntity entity, int amplifier, Entity.RemovalReason reason) {
if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) {
- this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition()); - this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition());
+ this.spawnCobwebsRandomlyAround(entity, world, entity.getRandom(), entity.blockPosition()); // Paper - Fire EntityChangeBlockEvent in more places + this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition(), entity); // Paper - Fire EntityChangeBlockEvent in more places
} }
} }
- private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos) {
+ private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos, LivingEntity entity) { // Paper - Fire EntityChangeBlockEvent in more places
Set<BlockPos> set = Sets.newHashSet();
int i = this.maxCobwebs.applyAsInt(random);
@@ -46,6 +46,7 @@ class WeavingMobEffect extends MobEffect { @@ -46,6 +46,7 @@ class WeavingMobEffect extends MobEffect {
} }
@ -117,7 +122,7 @@ index 74c9966093377b67e31b50483c2f24b70734faf6..abff08f2d61014944235ffe2f5494a71
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack); CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
} }
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
index 770467bd319f8e2fdf3d713591368aa825cfa5ae..b00a2fe4cefff26b65789829777b25bbc8e024fa 100644 index 08cbf02bba3633a84cce90c202d13f2beb5b88a2..c71a426c47e0ebc57ecb8c9c1d171737a084ccab 100644
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
@@ -45,6 +45,11 @@ public class EnderEyeItem extends Item { @@ -45,6 +45,11 @@ public class EnderEyeItem extends Item {
@ -152,7 +157,7 @@ index 6c0fe41692c9d1fa50a4f421eb4735860a9ae0e9..d7924825823b2bf79ca3a26272de11ff
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(serverPlayer, blockPos, itemStack); CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(serverPlayer, blockPos, itemStack);
} }
diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java
index 1c8fd643c32226d72d51abc869a49e256dd2432b..627439c3aa8171e9a54dbcb8842af50cc58f7f23 100644 index 1c8fd643c32226d72d51abc869a49e256dd2432b..f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d 100644
--- a/src/main/java/net/minecraft/world/item/PotionItem.java --- a/src/main/java/net/minecraft/world/item/PotionItem.java
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java +++ b/src/main/java/net/minecraft/world/item/PotionItem.java
@@ -42,6 +42,12 @@ public class PotionItem extends Item { @@ -42,6 +42,12 @@ public class PotionItem extends Item {
@ -160,8 +165,8 @@ index 1c8fd643c32226d72d51abc869a49e256dd2432b..627439c3aa8171e9a54dbcb8842af50c
BlockState blockState = level.getBlockState(blockPos); BlockState blockState = level.getBlockState(blockPos);
if (context.getClickedFace() != Direction.DOWN && blockState.is(BlockTags.CONVERTABLE_TO_MUD) && potionContents.is(Potions.WATER)) { if (context.getClickedFace() != Direction.DOWN && blockState.is(BlockTags.CONVERTABLE_TO_MUD) && potionContents.is(Potions.WATER)) {
+ // Paper start + // Paper start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState())) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, Blocks.MUD.defaultBlockState())) {
+ entityhuman.containerMenu.sendAllDataToRemote(); + player.containerMenu.sendAllDataToRemote();
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
+ // Paper end + // Paper end
@ -204,7 +209,7 @@ index c0377341227e8f4f1f7b1448580b3c7bc1b65f48..55c18f182166f4905d623d6f5e909eef
level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, blockState3)); level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, blockState3));
if (player != null) { if (player != null) {
diff --git a/src/main/java/net/minecraft/world/level/block/CakeBlock.java b/src/main/java/net/minecraft/world/level/block/CakeBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CakeBlock.java b/src/main/java/net/minecraft/world/level/block/CakeBlock.java
index 7629b9212ded7155e94f67ca429f62271e5f5aa0..1104f620a050555f71d058711cc34fadb964222f 100644 index 7629b9212ded7155e94f67ca429f62271e5f5aa0..648c2510beb162e73aed236a3169d0bbb8fc5050 100644
--- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java --- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java
@@ -66,6 +66,12 @@ public class CakeBlock extends Block { @@ -66,6 +66,12 @@ public class CakeBlock extends Block {
@ -214,7 +219,7 @@ index 7629b9212ded7155e94f67ca429f62271e5f5aa0..1104f620a050555f71d058711cc34fad
+ // Paper start - call change block event + // Paper start - call change block event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(candleblock))) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(candleblock))) {
+ player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease + player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.TRY_WITH_EMPTY_HAND;
+ } + }
+ // Paper end - call change block event + // Paper end - call change block event
stack.consume(1, player); stack.consume(1, player);
@ -245,7 +250,7 @@ index 7629b9212ded7155e94f67ca429f62271e5f5aa0..1104f620a050555f71d058711cc34fad
world.gameEvent((Entity) player, (Holder) GameEvent.EAT, pos); world.gameEvent((Entity) player, (Holder) GameEvent.EAT, pos);
if (i < 6) { if (i < 6) {
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
index 2bcd246a26dad560cf69682b29983d320ebf1884..60bf63c2cff3ce8a1892ba5c2303738c35b83d79 100644 index 2bcd246a26dad560cf69682b29983d320ebf1884..05b2eab26e2dc8e143e9fff2dcec40cfe927a197 100644
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
@@ -243,6 +243,11 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -243,6 +243,11 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
@ -254,7 +259,7 @@ index 2bcd246a26dad560cf69682b29983d320ebf1884..60bf63c2cff3ce8a1892ba5c2303738c
BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, stack); BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, stack);
+ // Paper start - handle cancelled events + // Paper start - handle cancelled events
+ if (iblockdata1 == null) { + if (iblockdata1 == null) {
+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS;
+ } + }
+ // Paper end + // Paper end

View file

@ -5,7 +5,7 @@ Subject: [PATCH] fix Jigsaw block kicking user
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
index 42300114e3baf31fd26090fca3b497c8157d4bb9..8fda7f812ba266cf8051f6796d2c35cba197e904 100644 index 42300114e3baf31fd26090fca3b497c8157d4bb9..6410cd7a7324bb04e9285a5b090b1675a5ffa16f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
@@ -131,7 +131,12 @@ public class JigsawBlockEntity extends BlockEntity { @@ -131,7 +131,12 @@ public class JigsawBlockEntity extends BlockEntity {
@ -14,7 +14,7 @@ index 42300114e3baf31fd26090fca3b497c8157d4bb9..8fda7f812ba266cf8051f6796d2c35cb
Registry<StructureTemplatePool> registry = world.registryAccess().lookupOrThrow(Registries.TEMPLATE_POOL); Registry<StructureTemplatePool> registry = world.registryAccess().lookupOrThrow(Registries.TEMPLATE_POOL);
- Holder<StructureTemplatePool> holder = registry.getOrThrow(this.pool); - Holder<StructureTemplatePool> holder = registry.getOrThrow(this.pool);
+ // Paper start - Replace getHolderOrThrow with a null check + // Paper start - Replace getHolderOrThrow with a null check
+ Holder<StructureTemplatePool> holder = registry.getHolder(this.pool).orElse(null); + Holder<StructureTemplatePool> holder = registry.get(this.pool).orElse(null);
+ if (holder == null) { + if (holder == null) {
+ return; + return;
+ } + }

View file

@ -91,7 +91,7 @@ index 6854ca4d4fec2b4fa541c3fabf63787665572609..e7b444a10b244828827b3c66c5346520
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 7f18146c0dea654c62b3e01e6848fd1c05f87946..1a724f9bb6ef82a0b5fdd9ade036d7365167f14b 100644 index 75854574aa8d4aef35d84ba4c0fc7df9a67ae48c..3f3124bbb5077a18c3d3afac7748a47e84b8fe35 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1080,7 +1080,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1080,7 +1080,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Player Entity Tracking Events
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 1a724f9bb6ef82a0b5fdd9ade036d7365167f14b..ec19eb88705a07db45f1a3541571fb7f43efb5a9 100644 index 3f3124bbb5077a18c3d3afac7748a47e84b8fe35..7810df9c5045a78c2731ee416366da4f973e5d29 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1592,7 +1592,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1592,7 +1592,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
index 60bf63c2cff3ce8a1892ba5c2303738c35b83d79..2d7712fae0801b6ae48d23cabd46a7700c0c0bec 100644 index 05b2eab26e2dc8e143e9fff2dcec40cfe927a197..db837b250fc35af5b528bf973b3b07f63e79bc46 100644
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
@@ -340,7 +340,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -340,7 +340,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix custom statistic criteria creation
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 66913ab43bb1e9066487749ff60248c22fc8e824..78b5578ece76c88a4dafcd4220a82081e85cf735 100644 index 9e0af05e066132b66fafff84ff0a0957c1a44f9f..766ef49d72eef0ff80247a807db5379f7fc60302 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -599,6 +599,14 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -599,6 +599,14 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -24,7 +24,7 @@ index 2aee9c2fbe38076317a3de7c3fdbd6988b64b389..3bd4ab8161c29bb8df2ba496a4430393
// return true; // CraftBukkit // return true; // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
index 90f69a0c4d0707fd2319db71aea7dfdc14636d82..9591870420390fe1a69d44855a8f4de779332b7d 100644 index d5ed53c37bba79f84b60d616887cd5176e124f10..6c0ea0bde1c36edda92807e317ed37f8b1bdac6a 100644
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
@@ -94,8 +94,8 @@ public class BeehiveBlock extends BaseEntityBlock { @@ -94,8 +94,8 @@ public class BeehiveBlock extends BaseEntityBlock {

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Configurable entity tracking range by Y coordinate
Options to configure entity tracking by Y coordinate, also for each entity category. Options to configure entity tracking by Y coordinate, also for each entity category.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ec19eb88705a07db45f1a3541571fb7f43efb5a9..49d926313b0d0f2ed2e93ca824009c8d0a988f67 100644 index 7810df9c5045a78c2731ee416366da4f973e5d29..502d73830ed87e06529f194090a4ffb895b2623c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1583,7 +1583,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1583,7 +1583,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -14,7 +14,7 @@ ensure that the returned found structure (which may for example be a buried
treasure that will be marked on a treasure map) is the same as in vanilla. treasure that will be marked on a treasure map) is the same as in vanilla.
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 906f56d07c26ef3c2dc1a3b62e9349dd91a37742..4cbc68d8e950f8d7c8b00535b82e916964c88ce0 100644 index 31c5f54c90d6e35875f762747f8618e58e2eed91..582065b2d4e818c0edec36b2e9847f8ed3266b10 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -265,12 +265,15 @@ public abstract class ChunkGenerator { @@ -265,12 +265,15 @@ public abstract class ChunkGenerator {

View file

@ -8,7 +8,7 @@ disables saving any forced stats, so it stays at the same value (without enablin
fixes stat initialization to not cause a NullPointerException fixes stat initialization to not cause a NullPointerException
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
index ec437644adff6a6ec1e3fe2dd3a6354edafde1db..fb7342f7a5008a283c3400c6313c637de8210dfa 100644 index ec437644adff6a6ec1e3fe2dd3a6354edafde1db..da7e1a69ecb4e6b3be2d8544ac406aa519bd196e 100644
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java --- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java +++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
@@ -48,13 +48,6 @@ public class ServerStatsCounter extends StatsCounter { @@ -48,13 +48,6 @@ public class ServerStatsCounter extends StatsCounter {
@ -36,7 +36,7 @@ index ec437644adff6a6ec1e3fe2dd3a6354edafde1db..fb7342f7a5008a283c3400c6313c637d
+ // Spigot start + // Spigot start
+ for ( Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() ) + for ( Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() )
+ { + {
+ Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.get(entry.getKey()))); // Paper - ensured by SpigotConfig#stats + Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.getValue(entry.getKey()))); // Paper - ensured by SpigotConfig#stats
+ this.stats.put( wrapper, entry.getValue().intValue() ); + this.stats.put( wrapper, entry.getValue().intValue() );
+ } + }
+ // Spigot end + // Spigot end

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 78b5578ece76c88a4dafcd4220a82081e85cf735..bd77a942a264a5d9cdaba4cc63099b8ae00c48f6 100644 index 766ef49d72eef0ff80247a807db5379f7fc60302..3900f95f3ea41b010b8ea79c043fe322fa233461 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -308,9 +308,30 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -308,9 +308,30 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Don't check if we can see non-visible entities
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 49d926313b0d0f2ed2e93ca824009c8d0a988f67..29a28e160f6ca87d263b84fbf0c5429d30e34a21 100644 index 502d73830ed87e06529f194090a4ffb895b2623c..95c70de2c9f0e26742c0d66ad6c3bcc310a923f6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1596,7 +1596,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1596,7 +1596,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -18,7 +18,7 @@ index a043ac10834562d357ef0b5aded2e916e2a0d056..74276c368016fcc4dbf9579b2ecbadc9
@VisibleForTesting @VisibleForTesting
static long encode(double value) { static long encode(double value) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 29a28e160f6ca87d263b84fbf0c5429d30e34a21..a43eef8bf05855270601761494b6a67dc55cb1c9 100644 index 95c70de2c9f0e26742c0d66ad6c3bcc310a923f6..182513bb175feb5f30f0fb1cd5db501b6d483afd 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1578,10 +1578,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1578,10 +1578,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add api for spawn egg texture colors
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index bd77a942a264a5d9cdaba4cc63099b8ae00c48f6..db177cb5a99b3529b2eed291bc794234214f8e7c 100644 index 3900f95f3ea41b010b8ea79c043fe322fa233461..7ae4567bc6f2f0374d1a4a3859f6329eaace7415 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -643,6 +643,15 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -643,6 +643,15 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -743,7 +743,7 @@ index dbdf52a306d7018f0bf01fcf6c24a6d1dc269be5..fb55dced981d16a82e4cc233fbf25695
this.reloadCount++; this.reloadCount++;
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile()); this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index db177cb5a99b3529b2eed291bc794234214f8e7c..5a94b9a5c400818818cc427160d696f10470f3a2 100644 index 7ae4567bc6f2f0374d1a4a3859f6329eaace7415..ca201861b383bac4ea93284ac017e85ae0b3b17c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -652,6 +652,13 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -652,6 +652,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack Tooltip API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 5a94b9a5c400818818cc427160d696f10470f3a2..b24ccbff89db873f5bdf62cbebcca0049b94a8d5 100644 index ca201861b383bac4ea93284ac017e85ae0b3b17c..8feba2bd411abe36e64a39a0c599c73d07c19e20 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -628,6 +628,21 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -628,6 +628,21 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -199,7 +199,7 @@ index 0000000000000000000000000000000000000000..52d2e2b744f91914802506e52a071617
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a89502a49a12 index 0000000000000000000000000000000000000000..4b44053cf7704e3889440361bb4971d7aa03e3ba
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,676 @@ @@ -0,0 +1,676 @@
@ -331,7 +331,7 @@ index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a895
+ } + }
+ } + }
+ +
+ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS)); + EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS));
+ BlockPos zeroPos = new BlockPos(0, 0, 0); + BlockPos zeroPos = new BlockPos(0, 0, 0);
+ +
+ for (int i = 0; i < solidGlobal.length; i++) { + for (int i = 0; i < solidGlobal.length; i++) {
@ -427,7 +427,7 @@ index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a895
+ LevelChunkSection[] nearbyChunkSections = new LevelChunkSection[4]; + LevelChunkSection[] nearbyChunkSections = new LevelChunkSection[4];
+ LevelChunk chunk = chunkPacketInfoAntiXray.getChunk(); + LevelChunk chunk = chunkPacketInfoAntiXray.getChunk();
+ Level level = chunk.getLevel(); + Level level = chunk.getLevel();
+ int maxChunkSectionIndex = Math.min((maxBlockHeight >> 4) - chunk.getMinSection(), chunk.getSectionsCount()) - 1; + int maxChunkSectionIndex = Math.min((maxBlockHeight >> 4) - chunk.getMinSectionY(), chunk.getSectionsCount()) - 1;
+ boolean[] solidTemp = null; + boolean[] solidTemp = null;
+ boolean[] obfuscateTemp = null; + boolean[] obfuscateTemp = null;
+ bitStorageReader.setBuffer(chunkPacketInfoAntiXray.getBuffer()); + bitStorageReader.setBuffer(chunkPacketInfoAntiXray.getBuffer());
@ -485,7 +485,7 @@ index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a895
+ presetBlockStateBitsTemp = switch (level.getWorld().getEnvironment()) { + presetBlockStateBitsTemp = switch (level.getWorld().getEnvironment()) {
+ case NETHER -> presetBlockStateBitsNetherrackGlobal; + case NETHER -> presetBlockStateBitsNetherrackGlobal;
+ case THE_END -> presetBlockStateBitsEndStoneGlobal; + case THE_END -> presetBlockStateBitsEndStoneGlobal;
+ default -> chunkSectionIndex + chunk.getMinSection() < 0 ? presetBlockStateBitsDeepslateGlobal : presetBlockStateBitsStoneGlobal; + default -> chunkSectionIndex + chunk.getMinSectionY() < 0 ? presetBlockStateBitsDeepslateGlobal : presetBlockStateBitsStoneGlobal;
+ }; + };
+ } else { + } else {
+ presetBlockStateBitsTemp = presetBlockStateBitsGlobal; + presetBlockStateBitsTemp = presetBlockStateBitsGlobal;
@ -1519,7 +1519,7 @@ index 303e59be721d0e16e8822cf4e407595348ee7abf..51f74dd7b276e858889803d7f341d735
int getSerializedSize(); int getSerializedSize();
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
index b86b3bf713668999a21c4120b1d16c295531b2ad..57998a47fa39cac141226c75bd68d4b37e8424ae 100644 index b86b3bf713668999a21c4120b1d16c295531b2ad..f6c42532d4921628072d44313404696890087b9f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
@@ -111,6 +111,7 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun @@ -111,6 +111,7 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
@ -1540,7 +1540,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..57998a47fa39cac141226c75bd68d4b3
if (nbttagcompound3.contains("block_states", 10)) { if (nbttagcompound3.contains("block_states", 10)) {
- datapaletteblock = (PalettedContainer) SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound3.getCompound("block_states")).promotePartial((s1) -> { - datapaletteblock = (PalettedContainer) SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound3.getCompound("block_states")).promotePartial((s1) -> {
+ Codec<PalettedContainer<BlockState>> blockStateCodec = presetBlockStates == null ? ChunkSerializer.BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray + Codec<PalettedContainer<BlockState>> blockStateCodec = presetBlockStates == null ? BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray
+ datapaletteblock = blockStateCodec.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s1) -> { // Paper - Anti-Xray + datapaletteblock = blockStateCodec.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s1) -> { // Paper - Anti-Xray
logErrors(chunkcoordintpair, b0, s1); logErrors(chunkcoordintpair, b0, s1);
}).getOrThrow(SerializableChunkData.ChunkReadException::new); }).getOrThrow(SerializableChunkData.ChunkReadException::new);

View file

@ -114,7 +114,7 @@ index 9d31e29ec62f437e642ed60da69c4b106bd9e770..ce200e673b54c66cfdf34657db28d3ee
this.level = MinMaxBounds.Ints.ANY; this.level = MinMaxBounds.Ints.ANY;
this.rotX = WrappedMinMaxBounds.ANY; this.rotX = WrappedMinMaxBounds.ANY;
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
index 5d0c82ba9465bf75640e52bf71924ee5862937f0..e27bd295adcf3289a7c71e044ae392884fe01e0a 100644 index 5d0c82ba9465bf75640e52bf71924ee5862937f0..9d5c766416cf34ddf0d7e250f13c0985195cb135 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java --- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
@@ -76,6 +76,19 @@ public class EntitySelectorOptions { @@ -76,6 +76,19 @@ public class EntitySelectorOptions {
@ -142,7 +142,7 @@ index 5d0c82ba9465bf75640e52bf71924ee5862937f0..e27bd295adcf3289a7c71e044ae39288
if (reader.isTag()) { if (reader.isTag()) {
TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader()));
+ // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior) + // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior)
+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { + if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(tagKey).isEmpty()) {
+ reader.getReader().setCursor(i); + reader.getReader().setCursor(i);
+ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); + throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey);
+ } + }

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Check distance in entity interactions
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 60e523f4de1cbafc2c58a5d568fe3989b7b07c34..dd2037fe9389765f79330036ec7fa3c5e7c7327a 100644 index 57223285860f61119b6cf348aa78e59384a04e22..ccfe9ef24dce9f34613692adb13738d3ad0e7aac 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -128,6 +128,7 @@ public class Util { @@ -128,6 +128,7 @@ public class Util {

View file

@ -1134,7 +1134,7 @@ index 71e04e5c1bc0722abf8ca2e0738bd60b6d7ae21c..063630c1ffcce099139c59d598fc5a21
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index 4638ba98dbbdb0f880337347be85a6e0fbed2191..12ba8bc0a946c107b076e2c995aca6a3aeb3811f 100644 index 4638ba98dbbdb0f880337347be85a6e0fbed2191..bc448f8511c629d1f13d4baf717a11e6a6ad24f9 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -296,6 +296,17 @@ public class BuiltInRegistries { @@ -296,6 +296,17 @@ public class BuiltInRegistries {
@ -1145,9 +1145,9 @@ index 4638ba98dbbdb0f880337347be85a6e0fbed2191..12ba8bc0a946c107b076e2c995aca6a3
+ public static final io.papermc.paper.registry.data.util.Conversions BUILT_IN_CONVERSIONS = new io.papermc.paper.registry.data.util.Conversions(new net.minecraft.resources.RegistryOps.RegistryInfoLookup() { + public static final io.papermc.paper.registry.data.util.Conversions BUILT_IN_CONVERSIONS = new io.papermc.paper.registry.data.util.Conversions(new net.minecraft.resources.RegistryOps.RegistryInfoLookup() {
+ @Override + @Override
+ public <T> java.util.Optional<net.minecraft.resources.RegistryOps.RegistryInfo<T>> lookup(final ResourceKey<? extends Registry<? extends T>> registryRef) { + public <T> java.util.Optional<net.minecraft.resources.RegistryOps.RegistryInfo<T>> lookup(final ResourceKey<? extends Registry<? extends T>> registryRef) {
+ final Registry<T> registry = net.minecraft.server.RegistryLayer.STATIC_ACCESS.registryOrThrow(registryRef); + final Registry<T> registry = net.minecraft.server.RegistryLayer.STATIC_ACCESS.lookupOrThrow(registryRef);
+ return java.util.Optional.of( + return java.util.Optional.of(
+ new net.minecraft.resources.RegistryOps.RegistryInfo<>(registry.asLookup(), registry.asTagAddingLookup(), Lifecycle.experimental()) + new net.minecraft.resources.RegistryOps.RegistryInfo<>(registry, registry, Lifecycle.experimental())
+ ); + );
+ } + }
+ }); + });
@ -1172,7 +1172,7 @@ index 4638ba98dbbdb0f880337347be85a6e0fbed2191..12ba8bc0a946c107b076e2c995aca6a3
} }
} }
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index 144a6f5b0c53110804d6d099fe857d25f107d938..f2236665eaf3e6d0f9d44605db3cd5afe0cced4e 100644 index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b68f8daaf8 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java --- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java +++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -130,7 +130,7 @@ public class RegistryDataLoader { @@ -130,7 +130,7 @@ public class RegistryDataLoader {
@ -1323,7 +1323,7 @@ index 6fddef967b6314ca0158f5bd4b8898670ea5e9ec..b5ca1a0acb16d0cd8dccc854f309d425
return writableRegistry; return writableRegistry;
}, prepareExecutor); }, prepareExecutor);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index f8450a2abd1e96fac7827d252cc00038b9dee839..a812a42ea81b1543287e78ea55da6cbf4e0d27f8 100644 index f8450a2abd1e96fac7827d252cc00038b9dee839..891ccc39d52331648a11b4e7cce78d4c848cdea0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -167,11 +167,11 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> { @@ -167,11 +167,11 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@ -1348,18 +1348,18 @@ index f8450a2abd1e96fac7827d252cc00038b9dee839..a812a42ea81b1543287e78ea55da6cbf
+ // Paper start - RegistrySet API + // Paper start - RegistrySet API
+ @Override + @Override
+ public boolean hasTag(final io.papermc.paper.registry.tag.TagKey<B> key) { + public boolean hasTag(final io.papermc.paper.registry.tag.TagKey<B> key) {
+ return this.minecraftRegistry.getTag(net.minecraft.tags.TagKey.create(this.minecraftRegistry.key(), io.papermc.paper.adventure.PaperAdventure.asVanilla(key.key()))).isPresent(); + return this.minecraftRegistry.get(net.minecraft.tags.TagKey.create(this.minecraftRegistry.key(), io.papermc.paper.adventure.PaperAdventure.asVanilla(key.key()))).isPresent();
+ } + }
+ +
+ @Override + @Override
+ public io.papermc.paper.registry.tag.Tag<B> getTag(final io.papermc.paper.registry.tag.TagKey<B> key) { + public io.papermc.paper.registry.tag.Tag<B> getTag(final io.papermc.paper.registry.tag.TagKey<B> key) {
+ final net.minecraft.core.HolderSet.Named<M> namedHolderSet = this.minecraftRegistry.getTag(io.papermc.paper.registry.PaperRegistries.toNms(key)).orElseThrow(); + final net.minecraft.core.HolderSet.Named<M> namedHolderSet = this.minecraftRegistry.get(io.papermc.paper.registry.PaperRegistries.toNms(key)).orElseThrow();
+ return new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(key, namedHolderSet); + return new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(key, namedHolderSet);
+ } + }
+ // Paper end - RegistrySet API + // Paper end - RegistrySet API
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b24ccbff89db873f5bdf62cbebcca0049b94a8d5..49b898ed5e9de2507a6a6aac61dea4fe902649ca 100644 index 8feba2bd411abe36e64a39a0c599c73d07c19e20..75b5ec1023e2cf974696ee077195b195025ddc74 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -674,6 +674,21 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -674,6 +674,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -1373,9 +1373,9 @@ index b24ccbff89db873f5bdf62cbebcca0049b94a8d5..49b898ed5e9de2507a6a6aac61dea4fe
+ throw new UnsupportedOperationException(tagKey.registryKey() + " doesn't have tags"); + throw new UnsupportedOperationException(tagKey.registryKey() + " doesn't have tags");
+ } + }
+ final net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<M>> nmsKey = io.papermc.paper.registry.PaperRegistries.registryToNms(tagKey.registryKey()); + final net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<M>> nmsKey = io.papermc.paper.registry.PaperRegistries.registryToNms(tagKey.registryKey());
+ final net.minecraft.core.Registry<M> nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().registryOrThrow(nmsKey); + final net.minecraft.core.Registry<M> nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().lookupOrThrow(nmsKey);
+ return nmsRegistry + return nmsRegistry
+ .getTag(io.papermc.paper.registry.PaperRegistries.toNms(tagKey)) + .get(io.papermc.paper.registry.PaperRegistries.toNms(tagKey))
+ .map(named -> new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(tagKey, named)) + .map(named -> new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(tagKey, named))
+ .orElse(null); + .orElse(null);
+ } + }

View file

@ -205,7 +205,7 @@ index 6cc9d7a9e6d4bfdc27e52fc581b2bb832616f121..6930d0afb230a88aa813b02e4d55c95d
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 49b898ed5e9de2507a6a6aac61dea4fe902649ca..02745957a08a27af6a032453b8b20a8fed2911b3 100644 index 75b5ec1023e2cf974696ee077195b195025ddc74..f1178a6c8ccd1ad099d67b906f755eea1dfc0e53 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -689,6 +689,13 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -689,6 +689,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -282,7 +282,7 @@ index 6cf790c9fa23ea313423fdaeb7c181bf530828c6..0bcb9df1103050441f8922a688b163dc
public static PotionEffectType minecraftHolderToBukkit(Holder<MobEffect> minecraft) { public static PotionEffectType minecraftHolderToBukkit(Holder<MobEffect> minecraft) {
return CraftPotionEffectType.minecraftToBukkit(minecraft.value()); return CraftPotionEffectType.minecraftToBukkit(minecraft.value());
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 02745957a08a27af6a032453b8b20a8fed2911b3..293757b8e96ae7b0e807d807affa3fdab5181d39 100644 index f1178a6c8ccd1ad099d67b906f755eea1dfc0e53..e1186f840670aabb73668e03d66789f9e306e234 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -47,7 +47,7 @@ import org.bukkit.advancement.Advancement; @@ -47,7 +47,7 @@ import org.bukkit.advancement.Advancement;

View file

@ -461,7 +461,7 @@ index 0000000000000000000000000000000000000000..d6d4bfc6f45d646afeace422a038c670
+) { +) {
+} +}
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index f2236665eaf3e6d0f9d44605db3cd5afe0cced4e..28d809a0e2fccd15a09bc6b55ca024526867ada7 100644 index fdc88e52235a152dbe3cca273990b4b68f8daaf8..13797035494a1e010e1da529fb46040f8a6e859f 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java --- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java +++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -278,7 +278,7 @@ public class RegistryDataLoader { @@ -278,7 +278,7 @@ public class RegistryDataLoader {

View file

@ -28,7 +28,7 @@ index c80fd4960dfbb0fde37363e7df25b0a5411bdb11..ff7f6916f65466c25a7bde35d64682c1
public static final Codec<CustomData> CODEC_WITH_ID = CODEC.validate( public static final Codec<CustomData> CODEC_WITH_ID = CODEC.validate(
component -> component.getUnsafe().contains("id", 8) ? DataResult.success(component) : DataResult.error(() -> "Missing id for entity in: " + component) component -> component.getUnsafe().contains("id", 8) ? DataResult.success(component) : DataResult.error(() -> "Missing id for entity in: " + component)
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 293757b8e96ae7b0e807d807affa3fdab5181d39..f880bf91155b017c954e3e321c5a203c05c2162f 100644 index e1186f840670aabb73668e03d66789f9e306e234..2a5c5e9e04d90c4e218b200bb55ff6bf2877ad73 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -511,6 +511,39 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -511,6 +511,39 @@ public final class CraftMagicNumbers implements UnsafeValues {