Skip to content

Commit

Permalink
feat: update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Dec 9, 2023
1 parent 1b6eb2e commit c8af12a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

This plugin provides a solution to the lag spikes that are caused by treasure maps searching for a location to put on a map. This plugin just makes those maps provide the loot table when you right click with the map in your hand.

Currently, it only supports map generated in chests from vanilla loot tables, but I plan to add support for maps from villager trading as well.
Supports maps found in loot tables and villager trades.

## Build
`./gradlew build`

## Test
### On re-obfuscated server
`./gradlew runServer`
### On mojang-mapped server
If a version has not been released but a dev-bundle has, you can
run a mojang-mapped server with
`./gradlew runMojangMappedServer`
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}

group = "me.machinemaker"
version = "0.4.0"
version = "0.5.0"

repositories {
mavenCentral()
Expand All @@ -35,7 +35,7 @@ java {
checkstyle {
configDirectory.set(rootProject.file(".checkstyle"))
isShowViolations = true
toolVersion = "10.12.3"
toolVersion = "10.12.5"
}

spotless {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
minecraft = "1.20.2"
minecraft = "1.20.4"
junit = "5.9.1"
mirror = "0.1.2"
reflectionRemapper = "0.1.0-SNAPSHOT"
reflectionRemapper = "0.1.0"

paperweight = "1.5.6"
runPaper = "2.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package me.machinemaker.treasuremapsplus;

import com.mojang.serialization.Lifecycle;
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.util.Map;
Expand All @@ -43,7 +43,7 @@ public record RegistryOverride<T>(ResourceKey<? extends Registry<T>> registryKey
try {
final ReflectionRemapper remapper = ReflectionRemapper.forReobfMappingsInPaperJar();
final MethodHandles.Lookup mappedRegistryLookup = MethodHandles.privateLookupIn(MappedRegistry.class, MethodHandles.lookup());
TO_ID_MAP = mappedRegistryLookup.findGetter(MappedRegistry.class, remapper.remapFieldName(MappedRegistry.class, "toId"), Reference2IntOpenHashMap.class);
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);
LIFECYCLES_MAP = mappedRegistryLookup.findGetter(MappedRegistry.class, remapper.remapFieldName(MappedRegistry.class, "lifecycles"), Map.class);

Expand All @@ -70,7 +70,7 @@ public void override(final RegistryAccess access) {
@SuppressWarnings("unchecked")
private static <T> void swapToIdMap(final Registry<T> registry, final int id, final T oldValue, final T newValue) {
try {
final Reference2IntOpenHashMap<T> map = (Reference2IntOpenHashMap<T>) TO_ID_MAP.invoke(registry);
final Reference2IntMap<T> map = (Reference2IntMap<T>) TO_ID_MAP.invoke(registry);
map.put(newValue, id);
map.remove(oldValue, id);
} catch (final Throwable e) {
Expand Down

0 comments on commit c8af12a

Please sign in to comment.