What do I need to know to write scripts for liquid bounce in java script
-
It can be quite difficult to write script if you are new to programming. https://liquidbounce.net/docs/script-api/installation this is the official docs for writing scripts, and gpt(or generally all frontier models) are your friend you can just ask those however you want. But note that current script api is not perfect and neither is gpt's answer, the only thing you could to is to try write and test, and also see the debug session. If you have difficulties writing a specific script you can just ask help in this forum(I prefer this one though) or on discord.
-
It can be quite difficult to write script if you are new to programming. https://liquidbounce.net/docs/script-api/installation this is the official docs for writing scripts, and gpt(or generally all frontier models) are your friend you can just ask those however you want. But note that current script api is not perfect and neither is gpt's answer, the only thing you could to is to try write and test, and also see the debug session. If you have difficulties writing a specific script you can just ask help in this forum(I prefer this one though) or on discord.
@commandblock2 Oh, btw, about AIs, ChatGPT sucks for these type of scripts. I recommend at least Gemini 2.5 version (Flash or Pro, but I prefer the Pro version) with internet access and grounding search with Google.
You can do it for free through Google AI Studio. -
@commandblock2 Oh, btw, about AIs, ChatGPT sucks for these type of scripts. I recommend at least Gemini 2.5 version (Flash or Pro, but I prefer the Pro version) with internet access and grounding search with Google.
You can do it for free through Google AI Studio.@dj You are probably right about the ChatGPT thing, I personally have never used the ChatGPT in website for anything related. My model of choice is usually sonnet, used with continue.dev or roo code. You do need to remind them that they are writing graaljs and needs to be aware of how it works. They may also sometimes give wrong/outdated Minecraft api reference to the Class/Function definitions.
-
@dj You are probably right about the ChatGPT thing, I personally have never used the ChatGPT in website for anything related. My model of choice is usually sonnet, used with continue.dev or roo code. You do need to remind them that they are writing graaljs and needs to be aware of how it works. They may also sometimes give wrong/outdated Minecraft api reference to the Class/Function definitions.
@commandblock2 Yee, had the same problems, I've made custom system instructions for the Gemini with Gem feature (https://support.google.com/gemini/answer/15146780?hl=en)
I also fed the whole liquidbounce documentation page just to be sure...
The AIs tends to write scripts for liquidbounce legacy, maybe sonnet scrapped the liquidbounce legacy as it's training data? We'll never know.. haha.. -
@commandblock2 Yee, had the same problems, I've made custom system instructions for the Gemini with Gem feature (https://support.google.com/gemini/answer/15146780?hl=en)
I also fed the whole liquidbounce documentation page just to be sure...
The AIs tends to write scripts for liquidbounce legacy, maybe sonnet scrapped the liquidbounce legacy as it's training data? We'll never know.. haha..@dj It actually makes much more sense if they knew about the legacy script api because it had more examples and exists longer. ScriptApi has not been a static and unified thing.
I was recently working on writing typescript for scriptapi (would probably still take a bit of time to get the changes into master branch), and I made the following prompt for roo code for my specific setup. And it turned out to be better than I thought.You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. You are working with a project with the runtime environment of Liquidbounce Next Generation script api (graaljs on jvm) with typescript support. You may assume that classes use the yarn mapping on the latest minecraft protocol. When you are not confident about if a api exists in current api, you may look up the type information at `node_modules/jvm-types/`. eg. `node_modules/jvm-types/types/net/minecraft/client/MinecraftClient.d.ts` contains the definition for `export class MinecraftClient extends ReentrantThreadExecutor<() => void> implements WindowEventHandler, MinecraftClientAccessor {` and `node_modules/jvm-types/types/net/ccbluex/liquidbounce/utils/movement/MovementUtilsKt.d.ts` contains `export class MovementUtilsKt extends Object {` The manually maintained augmentations can be found at `node_modules/jvm-types/augmentations/ScriptModule.augmentation.d.ts` (with all events definined in LiquidBounce avaliable). Before you are going to use a event, view this file to make sure you are using the correct event. If no existing script examples are given, use `src/complete.ts` to understand the script api. You will use `Outter$innver` syntax to access inner classes. You will use `import` instead of `Java.type` for imports from JVM, as the custom `require`/`import` implementation will be redirected to the graaljs's `Java.type`, direct useage of `Java.type` will loose all type information. Seeing errors like the following may suggest that the generated TypeScript definition has some problems instead of your work does. When seeing those errors, you will consider if they are errors made by the definition generator and ignore them if appropriate. ``` Conversion of type 'LivingEntity' to type 'Entity' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Types of property 'getBoundingBox' are incompatible. Type '(pose: EntityPose) => Box' is not comparable to type '() => Box'. Target signature provides too few arguments. Expected 1 or more, but got 0. ```
btw, gemini 2.5 flash is definitely a great model of choice. It is significantly cheaper/faster than sonnet and is good enough to write scripts, and I almost couldn't believe how powerful it is given it's price.
-
@dj It actually makes much more sense if they knew about the legacy script api because it had more examples and exists longer. ScriptApi has not been a static and unified thing.
I was recently working on writing typescript for scriptapi (would probably still take a bit of time to get the changes into master branch), and I made the following prompt for roo code for my specific setup. And it turned out to be better than I thought.You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices. You are working with a project with the runtime environment of Liquidbounce Next Generation script api (graaljs on jvm) with typescript support. You may assume that classes use the yarn mapping on the latest minecraft protocol. When you are not confident about if a api exists in current api, you may look up the type information at `node_modules/jvm-types/`. eg. `node_modules/jvm-types/types/net/minecraft/client/MinecraftClient.d.ts` contains the definition for `export class MinecraftClient extends ReentrantThreadExecutor<() => void> implements WindowEventHandler, MinecraftClientAccessor {` and `node_modules/jvm-types/types/net/ccbluex/liquidbounce/utils/movement/MovementUtilsKt.d.ts` contains `export class MovementUtilsKt extends Object {` The manually maintained augmentations can be found at `node_modules/jvm-types/augmentations/ScriptModule.augmentation.d.ts` (with all events definined in LiquidBounce avaliable). Before you are going to use a event, view this file to make sure you are using the correct event. If no existing script examples are given, use `src/complete.ts` to understand the script api. You will use `Outter$innver` syntax to access inner classes. You will use `import` instead of `Java.type` for imports from JVM, as the custom `require`/`import` implementation will be redirected to the graaljs's `Java.type`, direct useage of `Java.type` will loose all type information. Seeing errors like the following may suggest that the generated TypeScript definition has some problems instead of your work does. When seeing those errors, you will consider if they are errors made by the definition generator and ignore them if appropriate. ``` Conversion of type 'LivingEntity' to type 'Entity' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Types of property 'getBoundingBox' are incompatible. Type '(pose: EntityPose) => Box' is not comparable to type '() => Box'. Target signature provides too few arguments. Expected 1 or more, but got 0. ```
btw, gemini 2.5 flash is definitely a great model of choice. It is significantly cheaper/faster than sonnet and is good enough to write scripts, and I almost couldn't believe how powerful it is given it's price.
@commandblock2 yup, Gemini 2.5 flash is miracle. Your project is very nice, good luck making it!