ChatTriggers

A framework for Minecraft Forge that allows for client modifications to be scripted in JavaScript

MIT License

Stars
169
Committers
25

Bot releases are hidden (Show)

ChatTriggers - 1.1.1

Published by mattco98 over 4 years ago

  • Added FieldBuilder and RemoveBuilder to the ASM helper
    • Accessible via ASM.removeBuilder and ASM.fieldBuilder
ChatTriggers - 1.1.0

Published by mattco98 over 4 years ago

CT Changes

Added coremod (ASM) support. Checkout the ASM Injection wiki page for more information.

ChatTriggers - 1.0.0

Published by mattco98 over 4 years ago

CT Changes

  • Fixed /ct settings
  • Added entityDamage, entityDeath, attackEntity, and hitBlock triggers
  • print now handles undefined values
  • Item#getItemNBT now returns an NBTTagCompound object
  • Added syntax highlighting to the console, as well as a multiline input text area
ChatTriggers - 1.0.0 RC5

Published by mattco98 over 4 years ago

CT Changes

  • Trimmed console stack traces to only include relevant information
  • Image.draw now respects Renderer transforms
  • Added Player.draw and PlayerMP.draw as an alias Renderer.drawPlayer
  • PlayerMP methods now return null instead of crashing
  • Added postGuiRender trigger
    • Like renderOverlay, but runs after the currently open GUI screen is drawn. Use this trigger if you need to draw over a GUI, such as the chat GUI
  • Added Client.disconnect()
  • Added extensive console polyfill to providedLibs. See MDN's console documentation for method details
  • Fixed /ct settings not displaying due to a bad image URL
  • Switched from Mixins to ASM
    • This means that certain mod incompatibilities should no longer be a problem. For example, Frames+ now works with ct (note that the spawnParticle trigger is disabled if you have Frames+ present)
    • ct is now compatible with LiteLoader
  • Reduced the jar size by over half

Rhino changes:

  • Added partial application
  • Added operator overloading (see below)
  • Added inline exporting support
  • Added logical assignment operators
  • Importing from a directory now looks for an index.js file instead of throwing an error
  • Constructing a Java class without new is an error
  • Fixed const variables sometimes not retaining their value
  • Classes are now block-scoped
  • Allowed const variables in for loops, as well as disallowed assignment in for-in loops in strict mode

Operator overloading

This is a modification of a stage 0 ECMAScript proposal that we thought was useful enough to implement. A brief example is included below; feel free to ask us for help if you need more information.

class Foo {
  constructor(num) {
    this.num = num;
  }

  [Symbol.operator('+')](other) {
    return new Foo(this.num + other.num);
  }

  [Symbol.unaryOperator('-')]() {
    return new Foo(-this.num);
  }
}

const foo1 = new Foo(5);
const foo2 = new Foo(10);
const foo3 = foo1 + foo2;
print(foo3.num);     // prints 15
print((-foo3).num);  // prints -15
ChatTriggers - 1.0.0 RC4

Published by mattco98 almost 5 years ago

  • Updated cape textures
  • Added Item#getRawNBT()
  • Update to the latest version of our Rhino fork.
ChatTriggers - 1.0.0 RC3

Published by kerbybit almost 5 years ago

  • Rearranged overloaded Inventory.click and fixed it
  • Added Client.isControlDown
  • Added Client.isShiftDown
  • Added Client.isAltDown
  • Fixed Entity.getLastZ
  • Updated to the latest fork of rhino. Keep updated with rhino changes on our fork
ChatTriggers - 1.0.0 RC2

Published by kerbybit almost 5 years ago

Added options for console font and font size
Made Displays thread safe
Overloaded Inventory.click(slot, button = "LEFT", shift = false)
Added Entity.getLastX(), Entity.getLastY(), and Entity.getLastZ()
Added Entity.getRenderX(), Entity.getRenderY(), and Entity.getRenderZ()

ChatTriggers - 1.0.0 RC1

Published by kerbybit almost 5 years ago

1.0.0 Release Candidate 1

JS engine change and partial ES6 support

ChatTriggers is switching JS engines to Rhino but we wanted it to be special so @FalseHonesty and @mattco98 have been working hard on adding more and more ES6 support as time goes on. Modules released by @kerbybit will showcase a lot of the new supported features but you can always keep track of updates from the github fork

The biggest change will be how the engine handles files. Each module gets its own 'sandbox' so you no longer have to worry about conflicting variable or function names but you do have to export and import functions and variables to use them across files. A simple example is shown below.


metadata.json

{
     "name": "ExampleModule",
     "entry": "index.js"
}

index.js

const { myFunction, myVariable } = require("ExampleModule/extra")

register("command", () => {
     myFunction("testing special function")
     print(myVariable)
}).setName("example")

extra.js

function myFunction(out) {
     ChatLib.chat(out)
}
myVariable = "test"

module.exports = { myFunction, myVariable }

Other misc (but not small) changes

  • Cleaned up the userdocs and moved some things around
  • Added TriggerRegister.regsiterRenderArmor
  • Removed XMLHttpRequest
  • Fixed threaded loading
  • Added support to change keybind category
  • Added client side command running
  • Changed TabList.getNames to be more usable
  • Changed Inventory.getName to be more usable
  • Added Message.getFormattedText and Message.getFormattedText
  • Added Tessellator.getRenderPos
  • Changed console font to monospace "FiraCode" font
  • Changed Client.gui to Client.currentGui
  • Fixed Client.currentGui.close
  • Moved World.showTitle to Client.showTitle
  • Added capes back
  • Added Gui.drawCreativeTabHoveringString and Gui.drawHoveringString
  • Added Inventory.getItems
  • Changed Inventory.contains and Inventory.indexOf to be more usable
ChatTriggers - 0.18.4

Published by mattco98 about 5 years ago

Additions

  • Added spawnParticle trigger, which passes through the ct Particle instance, the position as a Vector3d, and the event, which can be cancelled.

Changes

  • Added config option to disable load threading, which should hopefully make trigger loading more reliable.
ChatTriggers - 0.18.3

Published by mattco98 about 5 years ago

Chat triggers

  • Added ability for .setCriteria() to accept JS RegExp objects.
  • Added .setStart(), .setContains(), .setEnd(), and .setExact() methods to set the parameter directly.
  • Added .setCaseInsensitive() to ignore case when matching chat messages. Note that this is unnecessary when using RegExp objects, as you can use the built-in case insensitive flag: /regex here/i.

Error reporting

  • Errors that occur in scripts (both top-level and inside triggers) now list the file name and actual line number where the error occurred.
  • This will not happen in threads, however all thread functions are now automatically wrapped in a try-catch statement that will print errors to console.

Misc

  • Added Renderer.setDrawMode(int) and Renderer.getDrawMode().
  • Removed the following deprecated Renderer methods: Renderer.image, Renderer.text, Renderer.rectangle, Renderer.shape.
  • Removed renderBlock trigger due to unreliability.
  • Fixed playerJoin trigger not passing in the correct argument.
  • Fixed the following triggers passing their events as the first parameter instead of the last: messageSent, soundPlay, noteblockPlay, noteblockChange, drawBlockHighlight
ChatTriggers - 0.18.2

Published by mattco98 about 5 years ago

Fixes:

  • Fixed Player.facing() only working for five out of the eight directions
  • Fixed Text and ParticleEffect constructors requiring all parameters to be specified
  • Fixed the game crashing on launch without an internet connection

Additions:

  • Added renderEntity trigger
  • Improved /ct dump, which now takes two args: the type of chat to dump (either chat or actionbar, chat by default), and the amount of lines to dump (defaults to 100)
ChatTriggers - 0.18.1

Published by mattco98 over 5 years ago

Fixed the build for 1.12.2

ChatTriggers - 0.18.0

Published by kerbybit over 5 years ago

Breaking Changes:

  • The Settings object has moved to Client.settings
  • MathLib.clampFloat is deprecated, use MathLib.clampDouble

Changes:

  • Fixed Sound bug that caused the game to crash
  • ChatLib.chat now automatically casts the object to a string if it is not an instance of one of the various chat objects
  • Added PotionEffect.getLocalizedName
  • The console now autoscrolls
  • The trigger argument of the register function is now case-insensitive (e.g.: register('CHAT', ...) is the same as register('chat', ...))
  • Added easeColor function, which just uses easeOut for each color
  • Added TabList methods for getting the header and footer text

New Triggers:

  • PlayerInteract: Fires when the player left/right clicks an item or entity.
  • BlockBreak
  • GuiRender: Fires on the GUI render event. Used for drawing objects over the GUI rather than behind them, as RenderOverlay did.
  • GuiKey: Fires when a key is pressed while a GUI is open
  • GuiClick: Fires when a mouse button is pressed while a GUI is open
  • GuiMouseRelease: Fires when a mouse button is released while a GUI is open
  • GuiMouseDrag: Fires when the mouse is dragged while a GUI is open
  • PacketSent: Fires when a packet is sent from the Client to the Server
  • ChatComponentClicked: Fires when a clickable chat component is clicked
  • ChatComponentHovered: Fires when a hoverable chat component is hovered
ChatTriggers - 0.17 pre5

Published by kerbybit almost 6 years ago

  • Random bug fixes
  • Added Renderer.retainTransforms(bool)
  • Added setTimeout method to provided libs
  • Fixed triggers not being unregistered when running /ct load
  • Added Number.prototype.easeOut to provided libs for easier easeOut use
  • Fixed Tessellator thanks to @mattco98
  • Improved try/catch and error reporting
ChatTriggers - 0.17 pre4

Published by kerbybit about 6 years ago

This is a pre-release of 0.17
Things might be broken or changed from 0.16.x
Change log will be available for full 0.17 release

ChatTriggers - 0.16.6

Published by kerbybit about 6 years ago

  • Fixed ChatLib.removeFormatting(string)
  • Added PlayerMP.getActivePotionEffects()
  • Added supporting back-end to make cross version support super easy
ChatTriggers - 0.16.5

Published by kerbybit about 6 years ago

  • Added some website magic shenanigans
  • Fixed some editChat issues
  • Fixed some userdocs thanks to @ThePoptartCrpr
ChatTriggers - 0.16.4

Published by kerbybit about 6 years ago

  • Added Display.getWidth()
  • Added Display.getHeight()
  • Added FileLib.getUrlContent(url, userAgent)
ChatTriggers - 0.16.3

Published by kerbybit about 6 years ago

  • Added ActionBar trigger that acts exactly the same as a Chat trigger docs
  • Fixed Display constructor
  • Improved error reporting
  • Added a Sign wrapper object to be returned with Player.lookingAt() docs
  • Changed XMLHttpRequest.setCallbackMethod to a trigger to accept anonymous functions as the argument
  • Fixed cancelling sounds
ChatTriggers - 0.16.2

Published by kerbybit over 6 years ago

Potion Effect

Potions effects now have their own wrapper that is much more in depth than what getting the player's active potion effects used to be. This means that Player.getActivePotionEffects now returns a list of PotionEffects instead of a list of Strings

var myDisplay = new Display();

register("tick", function() {
     myDisplay.clearLines();
     Player.getActivePotionEffects().forEach(function(effect) {
          myDisplay.addLine(
               effect.getName() + " " + 
               effect.getAmplifier() + " " + 
               effect.getDuration()
          );
     }
});

PotionEffect docs

Miscellaneous

  • Added ChatLib.actionBar(String/Message/TextComponent)
  • Added Message.actionBar() and TextComponent.actionBar()
  • Added KeyBind.getKeyCode and KeyBind.setState(boolean)
  • Fixed the config getting initializing too late and causing a rare crash
  • Added Message.toString() and TextComponent.toString() for easier debugging
  • Fixed sound triggers
Badges
Extracted from project README
forthebadge