Skip to content
This repository has been archived by the owner on Jul 20, 2021. It is now read-only.

Commit

Permalink
add support for getOrEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
Draylar committed May 29, 2021
1 parent f16c850 commit 55fe34e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ yarn_mappings=1.16.5+build.9
loader_version=0.11.3

# Mod Properties
mod_version=1.0.0
mod_version=1.0.1
maven_group=draylar
archives_base_name=budget-dfu

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,27 @@ private Identifier remapRegistryRetrieval(Identifier id) {

return id;
}

@ModifyVariable(method = "getOrEmpty", at = @At("HEAD"), index = 1)
private Identifier remapOptionalRegistryRetrieval(Identifier id) {
// If the ID passed in is null, return the default value of this registry.
if(id == null) {
return defaultId;
}

@Nullable Identifier direct = BudgetDFU.remapDirect((DefaultedRegistry) (Object) this, id);

// If a direct Identifier remap was found, apply it now & return.
if(direct != null) {
return direct;
}

// If a namespace remap is applicable, apply now & return.
String updatedNamespace = BudgetDFU.remapNamespace((DefaultedRegistry) (Object) this, id.getNamespace());
if(updatedNamespace != null) {
return new Identifier(updatedNamespace, id.getPath());
}

return id;
}
}

0 comments on commit 55fe34e

Please sign in to comment.