Skip to content

Commit

Permalink
Fix keybind registration
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Jul 18, 2024
1 parent a354e3a commit 529d621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
import com.copycatsplus.copycats.CCKeys;
import com.copycatsplus.copycats.Copycats;
import net.minecraft.client.KeyMapping;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.ClientRegistry;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class CCKeysImpl {

public static void register() {
// no-op: registration is handled by the event subscriber
}

public static void register() {
@SubscribeEvent
public static void register(FMLClientSetupEvent event) {
for (CCKeys key : CCKeys.values()) {
key.keybind = new KeyMapping(key.description, key.key, Copycats.NAME);
if (!key.modifiable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ public class CopycatsClientImpl {

public static void init() {
CopycatsClient.init();
CCKeysImpl.register();
}
}

0 comments on commit 529d621

Please sign in to comment.