diff --git a/paper-server/patches/sources/net/minecraft/server/bossevents/CustomBossEvent.java.patch b/paper-server/patches/sources/net/minecraft/server/bossevents/CustomBossEvent.java.patch new file mode 100644 index 0000000000..9aa2e7d869 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/server/bossevents/CustomBossEvent.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/server/bossevents/CustomBossEvent.java ++++ b/net/minecraft/server/bossevents/CustomBossEvent.java +@@ -23,6 +_,16 @@ + private final Set players = Sets.newHashSet(); + private int value; + private int max = 100; ++ // CraftBukkit start ++ private org.bukkit.boss.KeyedBossBar bossBar; ++ ++ public org.bukkit.boss.KeyedBossBar getBukkitEntity() { ++ if (this.bossBar == null) { ++ this.bossBar = new org.bukkit.craftbukkit.boss.CraftKeyedBossbar(this); ++ } ++ return this.bossBar; ++ } ++ // CraftBukkit end + + public CustomBossEvent(ResourceLocation id, Component name) { + super(name, BossEvent.BossBarColor.WHITE, BossEvent.BossBarOverlay.PROGRESS); diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/gossip/GossipContainer.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/gossip/GossipContainer.java.patch similarity index 96% rename from paper-server/patches/unapplied/net/minecraft/world/entity/ai/gossip/GossipContainer.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/ai/gossip/GossipContainer.java.patch index 55d0a4951d..1a74963cdf 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/ai/gossip/GossipContainer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/gossip/GossipContainer.java.patch @@ -1,12 +1,13 @@ --- a/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/net/minecraft/world/entity/ai/gossip/GossipContainer.java -@@ -216,6 +216,43 @@ +@@ -216,6 +_,44 @@ public void remove(GossipType gossipType) { this.entries.removeInt(gossipType); } + + // Paper start - Add villager reputation API + private static final GossipType[] TYPES = GossipType.values(); ++ + public com.destroystokyo.paper.entity.villager.Reputation getPaperReputation() { + Map map = new java.util.EnumMap<>(com.destroystokyo.paper.entity.villager.ReputationType.class); + for (Object2IntMap.Entry type : this.entries.object2IntEntrySet()) { @@ -43,4 +44,4 @@ + // Paper end - Add villager reputation API } - static record GossipEntry(UUID target, GossipType type, int value) { + record GossipEntry(UUID target, GossipType type, int value) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java.patch new file mode 100644 index 0000000000..f034ad2abb --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java ++++ b/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java +@@ -26,6 +_,7 @@ + + @Override + public void place(TreeDecorator.Context context) { ++ if (context.logs().isEmpty()) return; // Paper - Fix crash when trying to generate without logs + RandomSource randomSource = context.random(); + if (!(randomSource.nextFloat() >= this.probability)) { + List list = context.logs(); diff --git a/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch b/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch new file mode 100644 index 0000000000..1d206d5719 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java ++++ b/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +@@ -89,7 +_,16 @@ + Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN); + if (vec3 != null) { + ServerLevel level = context.getLevel(); +- BlockPos blockPos = level.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures); ++ // Paper start - Configurable cartographer treasure maps ++ if (!level.paperConfig().environment.treasureMaps.enabled) { ++ /* ++ * NOTE: I fear users will just get a plain map as their "treasure" ++ * This is preferable to disrespecting the config. ++ */ ++ return stack; ++ } ++ // Paper end - Configurable cartographer treasure maps ++ BlockPos blockPos = level.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); // Paper - Configurable cartographer treasure maps + if (blockPos != null) { + ItemStack itemStack = MapItem.create(level, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); + MapItem.renderBiomePreviewMap(level, itemStack); diff --git a/paper-server/patches/unapplied/net/minecraft/server/bossevents/CustomBossEvent.java.patch b/paper-server/patches/unapplied/net/minecraft/server/bossevents/CustomBossEvent.java.patch deleted file mode 100644 index 6e80d59765..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/server/bossevents/CustomBossEvent.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/minecraft/server/bossevents/CustomBossEvent.java -+++ b/net/minecraft/server/bossevents/CustomBossEvent.java -@@ -18,6 +18,10 @@ - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.util.Mth; - import net.minecraft.world.BossEvent; -+// CraftBukkit start -+import org.bukkit.boss.KeyedBossBar; -+import org.bukkit.craftbukkit.boss.CraftKeyedBossbar; -+// CraftBukkit end - - public class CustomBossEvent extends ServerBossEvent { - -@@ -25,7 +29,17 @@ - private final Set players = Sets.newHashSet(); - private int value; - private int max = 100; -+ // CraftBukkit start -+ private KeyedBossBar bossBar; - -+ public KeyedBossBar getBukkitEntity() { -+ if (this.bossBar == null) { -+ this.bossBar = new CraftKeyedBossbar(this); -+ } -+ return this.bossBar; -+ } -+ // CraftBukkit end -+ - public CustomBossEvent(ResourceLocation id, Component displayName) { - super(displayName, BossEvent.BossBarColor.WHITE, BossEvent.BossBarOverlay.PROGRESS); - this.id = id; diff --git a/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java.patch b/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java.patch deleted file mode 100644 index 4df0e3925c..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -+++ b/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -@@ -26,6 +26,7 @@ - - @Override - public void place(TreeDecorator.Context generator) { -+ if (generator.logs().isEmpty()) return; // Paper - Fix crash when trying to generate without logs - RandomSource randomSource = generator.random(); - if (!(randomSource.nextFloat() >= this.probability)) { - List list = generator.logs(); diff --git a/paper-server/patches/unapplied/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch b/paper-server/patches/unapplied/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch deleted file mode 100644 index 130a1b59c6..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -+++ b/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -@@ -83,8 +83,17 @@ - Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN); - if (vec3 != null) { - ServerLevel serverLevel = context.getLevel(); -+ // Paper start - Configurable cartographer treasure maps -+ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) { -+ /* -+ * NOTE: I fear users will just get a plain map as their "treasure" -+ * This is preferable to disrespecting the config. -+ */ -+ return stack; -+ } -+ // Paper end - Configurable cartographer treasure maps - BlockPos blockPos = serverLevel.findNearestMapStructure( -- this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures -+ this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures) // Paper - Configurable cartographer treasure maps - ); - if (blockPos != null) { - ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true);