Beta Protected constructorAdds a callback that will be called when a piston expands or retracts.
pistonEvent.ts
       let canceled = false;
       const pistonLoc: mc.Vector3 = {
         x: Math.floor(targetLocation.x) + 1,
         y: Math.floor(targetLocation.y) + 2,
         z: Math.floor(targetLocation.z) + 1,
       };
       const pistonCallback = mc.world.events.beforePistonActivate.subscribe((pistonEvent: mc.BeforePistonActivateEvent) => {
         if (pistonEvent.piston.location.equals(pistonLoc)) {
           log("Cancelling piston event");
           pistonEvent.cancel = true;
           canceled = true;
         }
       });
Adds a callback that will be called when a piston expands or retracts.
pistonEvent.ts
       let canceled = false;
       const pistonLoc: mc.Vector3 = {
         x: Math.floor(targetLocation.x) + 1,
         y: Math.floor(targetLocation.y) + 2,
         z: Math.floor(targetLocation.z) + 1,
       };
       const pistonCallback = mc.world.events.beforePistonActivate.subscribe((pistonEvent: mc.BeforePistonActivateEvent) => {
         if (pistonEvent.piston.location.equals(pistonLoc)) {
           log("Cancelling piston event");
           pistonEvent.cancel = true;
           canceled = true;
         }
       });
Removes a callback from being called when a piston expands or retracts.
This function can throw errors.
Manages callbacks that are connected to piston activations.