This repository has been archived by the owner on Nov 27, 2021. It is now read-only.
forked from MariaTheDinkus/cc-tweaked-fabric
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from ga2mer/1.17-alpha
fix: more correct mouseReleased event
- Loading branch information
Showing
5 changed files
with
41 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
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
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
38 changes: 38 additions & 0 deletions
38
src/main/java/dan200/computercraft/fabric/mixin/MixinHandledScreen.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* This file is part of ComputerCraft - http://www.computercraft.info | ||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. | ||
* Send enquiries to [email protected] | ||
*/ | ||
package dan200.computercraft.fabric.mixin; | ||
|
||
import dan200.computercraft.client.gui.widgets.WidgetTerminal; | ||
import net.minecraft.client.gui.Element; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.screen.ingame.HandledScreen; | ||
import net.minecraft.screen.ScreenHandler; | ||
import net.minecraft.text.Text; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin( HandledScreen.class ) | ||
public class MixinHandledScreen<T extends ScreenHandler> extends Screen | ||
{ | ||
protected MixinHandledScreen( Text title ) | ||
{ | ||
super( title ); | ||
} | ||
|
||
@Inject( method = "mouseReleased", at = @At ( "HEAD" ) ) | ||
public void mouseReleased( double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir ) | ||
{ | ||
for ( Element child : this.children() ) | ||
{ | ||
if ( child instanceof WidgetTerminal ) | ||
{ | ||
child.mouseReleased( mouseX, mouseY, button ); | ||
} | ||
} | ||
} | ||
} |
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