From 7eb213264ce12c34ed632d3404d20c05cd0951f9 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 21 Jun 2024 13:38:30 -0700 Subject: [PATCH] feat: update to 1.21 --- build.gradle.kts | 10 ++++------ gradle/libs.versions.toml | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- .../treasuremapsplus/RegistryOverride.java | 2 +- .../treasuremapsplus/listener/PlayerInteract.java | 6 +++--- .../loot/ExplorationMapItemFunctionOverride.java | 2 +- .../villager/VillagerTradeOverride.java | 2 +- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9c26d10..9e2a661 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { } group = "me.machinemaker" -version = "0.6.0" +version = "0.7.0" repositories { mavenCentral() @@ -44,18 +44,16 @@ spotless { } } -tasks { - assemble { - dependsOn(reobfJar) - } +paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION +tasks { shadowJar { isEnableRelocation = true relocationPrefix = "me.machinemaker.treasuremapsplus.libs" } compileJava { - options.release.set(21) + options.release = 21 options.encoding = Charsets.UTF_8.toString() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a151fa..4dd673a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] -minecraft = "1.20.6" +minecraft = "1.21" junit = "5.9.1" mirror = "0.2.0" -reflectionRemapper = "0.1.0" +reflectionRemapper = "0.1.1" paperweight = "1.7.1" runPaper = "2.3.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/src/main/java/me/machinemaker/treasuremapsplus/RegistryOverride.java b/src/main/java/me/machinemaker/treasuremapsplus/RegistryOverride.java index 7ba7ca1..87142de 100644 --- a/src/main/java/me/machinemaker/treasuremapsplus/RegistryOverride.java +++ b/src/main/java/me/machinemaker/treasuremapsplus/RegistryOverride.java @@ -39,7 +39,7 @@ public record RegistryOverride(ResourceKey> registryKey static { try { - final ReflectionRemapper remapper = ReflectionRemapper.forReobfMappingsInPaperJar(); + final ReflectionRemapper remapper = ReflectionRemapper.noop(); final MethodHandles.Lookup mappedRegistryLookup = MethodHandles.privateLookupIn(MappedRegistry.class, MethodHandles.lookup()); TO_ID_MAP = mappedRegistryLookup.findGetter(MappedRegistry.class, remapper.remapFieldName(MappedRegistry.class, "toId"), Reference2IntMap.class); BY_VALUE_MAP = mappedRegistryLookup.findGetter(MappedRegistry.class, remapper.remapFieldName(MappedRegistry.class, "byValue"), Map.class); diff --git a/src/main/java/me/machinemaker/treasuremapsplus/listener/PlayerInteract.java b/src/main/java/me/machinemaker/treasuremapsplus/listener/PlayerInteract.java index 1ed0077..6da6f65 100644 --- a/src/main/java/me/machinemaker/treasuremapsplus/listener/PlayerInteract.java +++ b/src/main/java/me/machinemaker/treasuremapsplus/listener/PlayerInteract.java @@ -81,7 +81,7 @@ private static List rollLootTable(final Item final PersistentDataContainer pdc = item.getItemMeta().getPersistentDataContainer(); final @Nullable String tagKey = pdc.get(TreasureMapsPlus.MAP_STRUCTURE_TAG_KEY, PersistentDataType.STRING); if (tagKey != null) { - final TagKey structureTagKey = TagKey.create(Registries.STRUCTURE, new ResourceLocation(tagKey)); + final TagKey structureTagKey = TagKey.create(Registries.STRUCTURE, ResourceLocation.parse(tagKey)); if (structureTagKey == StructureTags.ON_TREASURE_MAPS) { lootTable = BuiltInLootTables.BURIED_TREASURE; } else if (structureTagKey == StructureTags.ON_OCEAN_EXPLORER_MAPS) { @@ -116,8 +116,8 @@ private static LootParams createEntityParams(final ServerPlayer player) { .withParameter(LootContextParams.THIS_ENTITY, guardian) .withParameter(LootContextParams.ORIGIN, player.position()) .withParameter(LootContextParams.DAMAGE_SOURCE, player.serverLevel().damageSources().playerAttack(player)) - .withOptionalParameter(LootContextParams.KILLER_ENTITY, player) - .withOptionalParameter(LootContextParams.DIRECT_KILLER_ENTITY, player) + .withOptionalParameter(LootContextParams.ATTACKING_ENTITY, player) + .withOptionalParameter(LootContextParams.DIRECT_ATTACKING_ENTITY, player) .withParameter(LootContextParams.LAST_DAMAGE_PLAYER, player) .withLuck(player.getLuck()) .create(LootContextParamSets.ENTITY); diff --git a/src/main/java/me/machinemaker/treasuremapsplus/loot/ExplorationMapItemFunctionOverride.java b/src/main/java/me/machinemaker/treasuremapsplus/loot/ExplorationMapItemFunctionOverride.java index 0b379cc..fd1111a 100644 --- a/src/main/java/me/machinemaker/treasuremapsplus/loot/ExplorationMapItemFunctionOverride.java +++ b/src/main/java/me/machinemaker/treasuremapsplus/loot/ExplorationMapItemFunctionOverride.java @@ -46,7 +46,7 @@ public class ExplorationMapItemFunctionOverride { @VisibleForTesting - static final ResourceKey> EXPLORATION_FUNCTION_KEY = ResourceKey.create(Registries.LOOT_FUNCTION_TYPE, new ResourceLocation(ResourceLocation.DEFAULT_NAMESPACE, "exploration_map")); + static final ResourceKey> EXPLORATION_FUNCTION_KEY = ResourceKey.create(Registries.LOOT_FUNCTION_TYPE, ResourceLocation.parse("exploration_map")); private static final LootItemFunction.Builder SET_PDC_FUNCTION; static { diff --git a/src/main/java/me/machinemaker/treasuremapsplus/villager/VillagerTradeOverride.java b/src/main/java/me/machinemaker/treasuremapsplus/villager/VillagerTradeOverride.java index b9c09b9..c5214fe 100644 --- a/src/main/java/me/machinemaker/treasuremapsplus/villager/VillagerTradeOverride.java +++ b/src/main/java/me/machinemaker/treasuremapsplus/villager/VillagerTradeOverride.java @@ -66,7 +66,7 @@ public class VillagerTradeOverride { static { - final ReflectionRemapper remapper = ReflectionRemapper.forReobfMappingsInPaperJar(); + final ReflectionRemapper remapper = ReflectionRemapper.noop(); TREASURE_MAP_TRADE_LISTING_CLASS = sneaky(() -> Class.forName(remapper.remapClassName("net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds"))); TYPE_SPECIFIC_TRADE_CLASS = sneaky(() -> Class.forName(remapper.remapClassName("net.minecraft.world.entity.npc.VillagerTrades$TypeSpecificTrade")));