Skip to content

Commit

Permalink
Add try-catch to PolymerItemGroupUtils.getContentsFor (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
unascribed authored Aug 3, 2023
1 parent 8ebbcdb commit 576089d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ allprojects {
maven { url "https://maven.theepicblock.nl" }
maven { url "https://lazurite.dev/maven/releases" }
maven { url "https://repo.opencollab.dev/maven-snapshots/" }
maven {
name = 'Ladysnake Mods'
url = 'https://ladysnake.jfrog.io/artifactory/mods'
}
maven { url 'https://maven.ladysnake.org/releases' }
mavenLocal()
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fabric_version=0.83.0+1.20.1

maven_group = eu.pb4

mod_version = 0.5.6
mod_version = 0.5.7

minecraft_version_supported = ">=1.20-"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ public static Contents getContentsFor(ServerPlayerEntity player, ItemGroup group
}

public static Contents getContentsFor(ItemGroup group, RegistryWrapper.WrapperLookup lookup, FeatureSet featureSet, boolean operator) {
return ((ItemGroupExtra) group).polymer$getContentsWith(featureSet, operator, lookup);
try {
return ((ItemGroupExtra) group).polymer$getContentsWith(featureSet, operator, lookup);
} catch (Throwable t) {
// Some 1.20 mods use client classes in their item groups because vanilla doesn't call them on the server anymore
// Catch instead of letting the game crash, even though it's their fault...
PolymerImpl.LOGGER.warn("Failed to load contents for an ItemGroup", t);
return new Contents(List.of(), List.of());
}
}

/**
Expand Down

0 comments on commit 576089d

Please sign in to comment.