-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard #659
base: dev/0.8
Are you sure you want to change the base?
Keyboard #659
Conversation
…and simple screen to unlock the mouse
…oard Also fixed colored messages for the memory card and cleaned up the translation keys
So the keyboard works now I now want to remove JEI from the keyboard screen and place a little info text at the top The last thing I need to do is to implement this as a smart glasses module |
…dule keybind. I will see what I will do with the hotkey module or if I will create a new Keybind I've created two new nbt tags to bind the module to the glasses to sync that to the container, I am not sure if there is maybe a better way, but it works
…it was bound to different glasses before
I think everything is done now. Mouse and keyboard events are working, I got the little info text rendered, JEI does not render anymore and everything works fine as a glasses module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just have some detail need to deal with
float textX = (screenWidth / 2f - minecraft.font.width(text) * scale / 2f) / scale; | ||
minecraft.font.drawShadow(poseStack, text, textX, 1, 0xFFFFFF); | ||
|
||
// Prevents JEI/REI/EMI from rendering. Maybe not the best way, but it works for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind explain a bit what are you doing here to prevent them render? Or I mean I want to know if this won't disable other mods that decides to constant render something on the screen, such as inventory hud+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have actually no clue if it also disables other ui addon stuff
So I just render an empty string on the far lower right and jei thinks it does not have space to render
There is maybe a better way, maybe using the JEI API
|
||
@Override | ||
public boolean charTyped(char ch, int modifiers) { | ||
if (ch >= 32 && ch <= 126 || ch >= 160 && ch <= 255) { // printable chars in byte range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASCII char has a maximum value of 0x7f
(127) btw, not 0xff
or 255, above 0x7f will be considers as a two or more bytes UTF8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything below charTyped is borrowed from CCs screen itself, so I don't know why squid did what 😅
clipboard = SharedConstants.filterText(clipboard); | ||
if (!clipboard.isEmpty()) { | ||
// Clip to 512 characters and queue the event | ||
if (clipboard.length() > 512) clipboard = clipboard.substring(0, 512); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we better clip before check anything should we not?
Sorry to annoy you @SquidDev, just asking you because of #650 (comment) I used a piece of the TerminalWidget implementation for our keyboard screen. Just asking if this is okay And maybe you can answer the two comments related to that from zyxkad |
It might be easier to copy what |
Thank you, I didn't see that |
What kind of change does this PR introduce? (Bug fix, feature, ...)
Feature
What is the new behavior (if this is a feature change)?
Added the keyboard item. An item which can be linked to a computer. A user can now right click the item to unlock their mouse, they can now freely type while the typed characters are send to the linked computer. Will also be a module for the smart glasses.
Does this PR introduce a breaking change? (What changes might users need to make in their scripts due to this PR?)
No
Other information: