forked from Clones/Controlify
improve bindings
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
package dev.isxander.controlify.mixins.compat.fapi;
|
||||
|
||||
import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(KeyBindingRegistryImpl.class)
|
||||
public interface KeyBindingRegistryImplAccessor {
|
||||
@Accessor("MODDED_KEY_BINDINGS")
|
||||
static List<KeyMapping> getCustomKeys() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package dev.isxander.controlify.mixins.feature.bind;
|
||||
|
||||
import net.minecraft.client.ToggleKeyMapping;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@Mixin(ToggleKeyMapping.class)
|
||||
public interface ToggleKeyMappingAccessor {
|
||||
@Accessor
|
||||
BooleanSupplier getNeedsToggle();
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package dev.isxander.controlify.mixins.feature.screenop;
|
||||
|
||||
import dev.isxander.controlify.screenop.ComponentProcessorProvider;
|
||||
import dev.isxander.controlify.screenop.ScreenProcessorProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MinecraftMixin {
|
||||
@Inject(method = "setScreen", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/BufferUploader;reset()V"))
|
||||
private void changeScreen(Screen screen, CallbackInfo ci) {
|
||||
ScreenProcessorProvider.REGISTRY.clearCache();
|
||||
ComponentProcessorProvider.REGISTRY.clearCache();
|
||||
}
|
||||
}
|
@ -26,10 +26,4 @@ public class ScreenMixin implements ScreenProcessorProvider {
|
||||
// cannot use screenProcessor() because it may be overriden by registry
|
||||
ScreenProcessorProvider.provide((Screen) (Object) this).onWidgetRebuild();
|
||||
}
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At("HEAD"))
|
||||
private void clearRegistryCaches(Minecraft client, int width, int height, CallbackInfo ci) {
|
||||
ScreenProcessorProvider.REGISTRY.clearCache();
|
||||
ComponentProcessorProvider.REGISTRY.clearCache();
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,9 @@ import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
@Mixin(CreativeModeInventoryScreen.class)
|
||||
public interface CreativeModeInventoryScreenAccessor {
|
||||
@Accessor
|
||||
CreativeModeTab getSelectedTab();
|
||||
static CreativeModeTab getSelectedTab() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Invoker
|
||||
void invokeSelectTab(CreativeModeTab tab);
|
||||
|
Reference in New Issue
Block a user