Skip to content

Commit

Permalink
Datafix wild_explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugman76 committed Apr 19, 2021
1 parent 53dbe80 commit dc56b36
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.hugman.promenade.mixin;

import com.hugman.promenade.Promenade;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.DefaultedRegistry;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(DefaultedRegistry.class)
public class DefaultedRegistryMixin {
@ModifyVariable(at = @At("HEAD"), method = "get(Lnet/minecraft/util/Identifier;)Ljava/lang/Object;", ordinal = 0)
Identifier fixMissingFromRegistry(@Nullable Identifier id) {
if(id != null) {
if(id.getNamespace().equals("wild_explorer")) return new Identifier(Promenade.MOD_DATA.getModName(), id.getPath());
}
return id;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/promenade.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"package": "com.hugman.promenade.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"DefaultBiomeFeaturesMixin"
"DefaultBiomeFeaturesMixin", "DefaultedRegistryMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit dc56b36

Please sign in to comment.