mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 07:15:10 +01:00
Move cursor to end of text in book
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
||||||
|
import net.minecraft.client.util.SelectionManager;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
@@ -16,6 +17,9 @@ public interface BookEditScreenAccessor {
|
|||||||
@Accessor("title")
|
@Accessor("title")
|
||||||
void midnightcontrols$setTitle(String title);
|
void midnightcontrols$setTitle(String title);
|
||||||
|
|
||||||
|
@Accessor("currentPageSelectionManager")
|
||||||
|
SelectionManager midnightcontrols$getCurrentPageSelectionManager();
|
||||||
|
|
||||||
@Invoker("getCurrentPageContent")
|
@Invoker("getCurrentPageContent")
|
||||||
String midnightcontrols$getCurrentPageContent();
|
String midnightcontrols$getCurrentPageContent();
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class MouseClickListener implements ScreenMouseEvents.AllowMouseClick {
|
|||||||
virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getCurrentPageContent(), (text) -> {
|
virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getCurrentPageContent(), (text) -> {
|
||||||
client.setScreen(bookEditScreen);
|
client.setScreen(bookEditScreen);
|
||||||
accessor.midnightcontrols$setPageContent(text);
|
accessor.midnightcontrols$setPageContent(text);
|
||||||
|
accessor.midnightcontrols$getCurrentPageSelectionManager().putCursorAtEnd();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user