Skip to content

Commit

Permalink
Fix crash on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Aug 12, 2024
1 parent 0e3eafd commit b8d5c4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.1
loader_version=0.15.11

# Mod Properties
mod_version=1.112.0.0+1.21
mod_version=1.112.0.1+1.21
maven_group=eu.pb4.cctpatch
archives_base_name=cc-tweaked-polymer-patch

Expand Down
19 changes: 10 additions & 9 deletions src/main/java/eu/pb4/cctpatch/mixin/mod/ComputerCraftMixin.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package eu.pb4.cctpatch.mixin.mod;

import dan200.computercraft.shared.CommonHooks;
import dan200.computercraft.shared.ComputerCraft;
import eu.pb4.polymer.core.api.item.PolymerItemGroupUtils;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.minecraft.item.ItemGroup;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.Overwrite;

import java.util.Optional;

@Mixin(value = ComputerCraft.class, remap = false)
public class ComputerCraftMixin {
@Redirect(method = "lambda$init$18", at = @At(value = "INVOKE", target = "Lnet/minecraft/registry/Registry;getKey(Ljava/lang/Object;)Ljava/util/Optional;"))
private static Optional<RegistryKey<ItemGroup>> replaceKey(Registry instance, Object t) {
return Optional.of(PolymerItemGroupUtils.getKey((ItemGroup) t));
/**
* @author Patbox
* @reason I need to replace item group key getting logic.
*/
@Overwrite(remap = false)
private static void lambda$init$18(ItemGroup group, FabricItemGroupEntries entries) {
CommonHooks.onBuildCreativeTab(PolymerItemGroupUtils.getKey(group), entries.getContext(), entries);
}
}

0 comments on commit b8d5c4b

Please sign in to comment.