-
Notifications
You must be signed in to change notification settings - Fork 275
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
some planned screen anvancement and let functions of screen support crafter. #1833
base: master
Are you sure you want to change the base?
Conversation
{ | ||
this.screenHandler = player.containerMenu; | ||
|
||
this.name = Component.literal("seems that the game forgot that");//should i make something like a weak map to remember it? |
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 would not use a map, since you aren't gonna know whether a screen will ever be retrieved from get_current_screen
at all. It just creates additional overhead, that would be required even if no scripts are running. Setting it to null and returning a null value when querying name is probably the best option IMO.
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.
ok. i let it be null now.
try to support crafter
i want to try my best to do that....... maybe i will need others help in the future....
that pr is to add a scarpet usage like this:
to make script can touch vanilla screens. (after getting the screen object, users can use it.)
because the user may want to append a callback to the returned screen, i let the 2nd argument of __on_player_open_screen be
screen_type
instead of a screenvalue itself.=================================
it supports crafters now.
use create_screen(player(),'crafter_3x3', 'screen name') to create one.
which has following property:
crafter_slot_disable_0
crafter_slot_disable_1
...
crafter_slot_disable_8
(the slots "lock")crafter_enable
(the red arrow in the middle of the GUI) (should it be called red_arrow directly?)===================================
example 1:
/execute as @p run script run create_screen(p,'crafter_3x3','333',_(s,p,x,y)->(if(!s,return());screen_property(s,'crafter_slot_disable_0',screen_property(s,'crafter_slot_disable_8'))))
Minecraft__1.20.3_-_Singleplayer_2023-12-10_05-55-53.1.webm
===============
example 2:
Minecraft__1.20.3_-_Singleplayer_2023-12-10_06-02-03.webm
the script creates an callback function to be run on player opens a vanilla screen. and in which, another callback is added to that vanilla screen.