mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
48 lines
3.5 KiB
Diff
48 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 20 Dec 2016 15:26:27 -0500
|
|
Subject: [PATCH] Configurable Cartographer Treasure Maps
|
|
|
|
Allow configuring for cartographers to return the same map location
|
|
|
|
Also allow turning off treasure maps all together as they can eat up Map ID's
|
|
which are limited in quantity.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
|
|
index 672301d47037f96f32c52fa400ed28694f3b138b..96240f8ed0675ebfd403fcef144657885c4bb9a9 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
|
|
@@ -1667,7 +1667,8 @@ public class VillagerTrades {
|
|
return null;
|
|
} else {
|
|
ServerLevel serverLevel = (ServerLevel)entity.level();
|
|
- BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, true);
|
|
+ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) return null; // Paper - Configurable cartographer treasure maps
|
|
+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredVillager); // Paper - Configurable cartographer treasure maps
|
|
if (blockPos != null) {
|
|
ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true);
|
|
MapItem.renderBiomePreviewMap(serverLevel, itemStack);
|
|
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
|
|
index e7f2cc799e7c50a9525845347a3f235f7bfefe41..709bc6838d20c420c5a4b3a994a041e594bd6210 100644
|
|
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
|
|
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
|
|
@@ -84,8 +84,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction {
|
|
Vec3 vec3 = context.getParamOrNull(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);
|