mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-16 07:24:32 +01:00
edb1b59f41
- Added an .editorconfig - Auto-Reformatted most .java files - Auto-Organized Imports
55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package com.simibubi.create.events;
|
|
|
|
import com.simibubi.create.CreateClient;
|
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringHandler;
|
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueHandler;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
|
|
import net.minecraftforge.client.event.InputEvent.MouseInputEvent;
|
|
import net.minecraftforge.client.event.InputEvent.MouseScrollEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|
|
|
@EventBusSubscriber(value = Dist.CLIENT)
|
|
public class InputEvents {
|
|
|
|
@SubscribeEvent
|
|
public static void onKeyInput(KeyInputEvent event) {
|
|
int key = event.getKey();
|
|
boolean pressed = !(event.getAction() == 0);
|
|
|
|
if (Minecraft.getInstance().currentScreen != null)
|
|
return;
|
|
|
|
CreateClient.schematicHandler.onKeyInput(key, pressed);
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public static void onMouseScrolled(MouseScrollEvent event) {
|
|
if (Minecraft.getInstance().currentScreen != null)
|
|
return;
|
|
|
|
double delta = event.getScrollDelta();
|
|
// CollisionDebugger.onScroll(delta);
|
|
boolean cancelled = CreateClient.schematicHandler.mouseScrolled(delta)
|
|
|| CreateClient.schematicAndQuillHandler.mouseScrolled(delta) || FilteringHandler.onScroll(delta)
|
|
|| ScrollValueHandler.onScroll(delta);
|
|
event.setCanceled(cancelled);
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public static void onMouseInput(MouseInputEvent event) {
|
|
if (Minecraft.getInstance().currentScreen != null)
|
|
return;
|
|
|
|
int button = event.getButton();
|
|
boolean pressed = !(event.getAction() == 0);
|
|
|
|
CreateClient.schematicHandler.onMouseInput(button, pressed);
|
|
CreateClient.schematicAndQuillHandler.onMouseInput(button, pressed);
|
|
}
|
|
|
|
}
|