-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 10 additions & 9 deletions
19
src/main/java/eu/pb4/cctpatch/mixin/mod/ComputerCraftMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |