Skip to content

Commit

Permalink
Fixed some bugs caused by terrible reflection hacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Feb 10, 2025
1 parent 67a2beb commit 6451f08
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ version = project.mod_version
loom {
noIntermediateMappings()
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${project.bta_channel}/v${project.bta_version}/manifest.json")
accessWidenerPath = file("src/main/resources/halplibe.accesswidener")
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ loader_version=0.15.6-bta.7
mod_menu_version=3.0.0

# Mod
mod_version=5.1.3
mod_version=5.1.4
mod_group=turniplabs
mod_name=halplibe
6 changes: 1 addition & 5 deletions src/main/java/turniplabs/halplibe/helper/ItemBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,7 @@ public <T extends Item> T build(T item){
}

if (maxDamage != null){
try {
item.getClass().getMethod("setMaxDamage", int.class).invoke(item, maxDamage);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
item.setMaxDamage(maxDamage);
}

List<String> newTokens = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public int compareTo(@NotNull NetworkEntry o) {

f.setAccessible(false);

addMapping = Packet.class.getDeclaredMethod("addIdClassMapping", int.class, boolean.class, boolean.class, Class.class);
addMapping = Packet.class.getDeclaredMethod("addMapping", int.class, boolean.class, boolean.class, Class.class);
} catch (Throwable err) {
throw new RuntimeException(err);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/halplibe.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessWidener v2 named

accessible method net/minecraft/core/item/Item setMaxDamage (I)Lnet/minecraft/core/item/Item;

0 comments on commit 6451f08

Please sign in to comment.