[SCRIPT BASE] Core 4.11 - Simple, yet powerful ScriptAPI base
-
Core 3.28 brings artificial events!
All events are available for you
Thanks to @commandblock2 for giving me this idea, you can now use all events implemented in LiquidBounce, such as:
- onBlockBB
- onClientShutdown
- onEntityMovement
- onPushOut
- onRenderEntity
- onScreen
- onText
- onTick
Here is an example from https://github.com/CzechHek/Core/blob/master/Examples/artificial events.js
///api_version=2 (script = registerScript({ name: "ArtificialEvents", authors: ["CzechHek"], version: "1.0" })).import("Core.lib"); module = { onBlockBB: function (e) { var x = e.getX(), y = e.getY(), z = e.getZ(), block = e.getBlock(), bb = e.getBoundingBox(); e.setBoundingBox(bb.expand(0, 0.5, 0)); }, onClientShutdown: function () {}, onEntityMovement: function (e) { var entity = e.getMovedEntity(); }, onPushOut: function (e) { e.cancelEvent() }, onRenderEntity: function (e) { var entity = e.getEntity(), x = e.getX(), y = e.getY(), z = e.getZ(), yaw = e.getEntityYaw(), partialTicks = e.getPartialTicks(); }, onScreen: function (e) { var screen = e.getGuiScreen(); }, onText: function (e) { if (mc.thePlayer) { var text = e.getText(); e.setText(text.replace(mc.thePlayer.getName(), "axolotlus")); } }, onTick: function () {} }
-
-
@czechhek said in [SCRIPT BASE] Core 3.28 - Simple, yet powerful ScriptAPI base:
onClientShutdown
-
-
@fartcheese
Java.type("java.lang.Runtime").getRuntime().addShutdownHook( new Thread(function() { var editor = new TextEditor(new File("wtf.txt")); editor.text = "The process has been terminated." }) );
Works but I don't think that using Runtime isn't sus in scripting base scenario.
However I could make it call onClientShutdown event if you wanted.
Edit: For some reason it doesn't do anything probably because it is on other thread, however normal onClientShutdown detects process termination from Task Manager, so I will leave it like it is. Additionally, when I was doing stuff around this I noticed that you cannot call the new "artificial events" using built-in
callEvent
util, so I made them register into ScriptModule's event register as well. -
-
Core 4 brings new commands API
Reworked the whole Core Commands API. You can now specify arguments that are required as function parameters. Multiple arguments count can be accounted for by using array of functions with different parameter count. Look at some examples to learn how it works.
- https://github.com/CzechHek/Core/blob/master/Scripts/ValueBinder.js
- https://github.com/CzechHek/Core/blob/master/Scripts/Manager.js
- https://github.com/CzechHek/Core/blob/master/Examples/complex command.js
- https://github.com/CzechHek/Core/blob/master/Examples/simple command.js
Core Updater now prints latest commit information in update dialogs (changelog).
Added multiple functions: isObject, getFunctionParameters, downloadDirectory, Array.toLowerCase, Array.flat
ClickGui hooking separated into Core.updateClickGui. You can use it to refresh ClickGui while keeping events such as onClickGuiLoaded working.
Fixed a possible bug that could prevent core.log from being removed and therefore break Core Updater.All changes: https://github.com/CzechHek/Core/commit/293059540f632bc3300ccdd47128d3f0d21daba6
-
-
Core 4.1 - utils and polish
Added utils:
- getTargetsInRange(range, entityType) - used in KillAuraPatch 3
- getStepHeight()
You can now setValues of built-in LB modules. (stupid)
Improved code.
All changes: https://github.com/CzechHek/Core/commit/6d63b715ccd079cf6ffeb2562900e553613701b8