mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-06 02:14:58 +01:00
Overclicked
- Fixed Schematic and Quill selection registering mouse clicks twice
This commit is contained in:
parent
97906cb4cc
commit
4985a521a4
3 changed files with 20 additions and 17 deletions
|
@ -98,40 +98,41 @@ public class SchematicAndQuillHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void onMouseInput(int button, boolean pressed) {
|
||||
public boolean onMouseInput(int button, boolean pressed) {
|
||||
if (!pressed || button != 1)
|
||||
return;
|
||||
return false;
|
||||
if (!isActive())
|
||||
return;
|
||||
return false;
|
||||
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
|
||||
if (player.isShiftKeyDown()) {
|
||||
discard();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (secondPos != null) {
|
||||
ScreenOpener.open(new SchematicPromptScreen());
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (selectedPos == null) {
|
||||
Lang.translate("schematicAndQuill.noTarget")
|
||||
.sendStatus(player);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (firstPos != null) {
|
||||
secondPos = selectedPos;
|
||||
Lang.translate("schematicAndQuill.secondPos")
|
||||
.sendStatus(player);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
firstPos = selectedPos;
|
||||
Lang.translate("schematicAndQuill.firstPos")
|
||||
.sendStatus(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void discard() {
|
||||
|
|
|
@ -243,23 +243,23 @@ public class SchematicHandler {
|
|||
selectionScreen.renderPassive(poseStack, partialTicks);
|
||||
}
|
||||
|
||||
public void onMouseInput(int button, boolean pressed) {
|
||||
public boolean onMouseInput(int button, boolean pressed) {
|
||||
if (!active)
|
||||
return;
|
||||
return false;
|
||||
if (!pressed || button != 1)
|
||||
return;
|
||||
return false;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.player.isShiftKeyDown())
|
||||
return;
|
||||
return false;
|
||||
if (mc.hitResult instanceof BlockHitResult) {
|
||||
BlockHitResult blockRayTraceResult = (BlockHitResult) mc.hitResult;
|
||||
BlockState clickedBlock = mc.level.getBlockState(blockRayTraceResult.getBlockPos());
|
||||
if (AllBlocks.SCHEMATICANNON.has(clickedBlock))
|
||||
return;
|
||||
return false;
|
||||
if (AllBlocks.DEPLOYER.has(clickedBlock))
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
currentTool.getTool()
|
||||
return currentTool.getTool()
|
||||
.handleRightClick();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,15 +45,17 @@ public class InputEvents {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMouseInput(InputEvent.MouseButton event) {
|
||||
public static void onMouseInput(InputEvent.MouseButton.Pre event) {
|
||||
if (Minecraft.getInstance().screen != null)
|
||||
return;
|
||||
|
||||
int button = event.getButton();
|
||||
boolean pressed = !(event.getAction() == 0);
|
||||
|
||||
CreateClient.SCHEMATIC_HANDLER.onMouseInput(button, pressed);
|
||||
CreateClient.SCHEMATIC_AND_QUILL_HANDLER.onMouseInput(button, pressed);
|
||||
if (CreateClient.SCHEMATIC_HANDLER.onMouseInput(button, pressed))
|
||||
event.setCanceled(true);
|
||||
else if (CreateClient.SCHEMATIC_AND_QUILL_HANDLER.onMouseInput(button, pressed))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
Loading…
Reference in a new issue