Skip to content

Commit

Permalink
notice to inform you that you are wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXMushroom63 committed Dec 15, 2024
1 parent 3bea644 commit e260cc3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions blocks/World.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const world_explosion = {
.appendField('Fire:');
this.appendValueInput('SMOKE')
.setCheck('Boolean')
.appendField('Particles:');
.appendField('Break Blocks:');
this.setInputsInline(false)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
Expand Down Expand Up @@ -46,7 +46,7 @@ const world_command = {
this.setInputsInline(false)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip('');
this.setTooltip('NOTICE: @selectors do NOT work');
this.setHelpUrl('');
this.setColour(195);
},
Expand Down
36 changes: 23 additions & 13 deletions functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,30 @@ FUNCTIONS["execute_command"] = {
code: function () {
function EFB2__defineExecCmdGlobal() {
globalThis.efb2__executeCommand = function efb2__executeCommand($world, $blockpos, commandStr) {
var fakeEntity = (new new ModAPI.reflect.getClassByName("Entity").class);
fakeEntity.$setPosition($blockpos.$x, $blockpos.$y, $blockpos.$z);
var vector = ModAPI.reflect.getClassByName("Vec3").constructors[0]($blockpos.$x, $blockpos.$y, $blockpos.$z);
var cmd = Object.assign((new new ModAPI.reflect.getClassByName("CommandBlockLogic").class), {
$func_145751_f: ()=>{return 1},
$updateCommand: ()=>{},
$func_145757_a: ()=>{},
$getPosition: ()=>{return $blockpos},
$getPositionVector: ()=>{return vector},
$getEntityWorld: ()=>{return $world},
$getCommandSenderEntity: ()=>{return fakeEntity}
});
if ($world.$isRemote) {
return;
}
function x() {
ModAPI.reflect.getSuper(ModAPI.reflect.getClassByName("CommandBlockLogic"))(this);
}
ModAPI.reflect.prototypeStack(ModAPI.reflect.getClassByName("CommandBlockLogic"), x);
var vector = ModAPI.reflect.getClassByName("Vec3").constructors[0]($blockpos.$x + 0.5, $blockpos.$y + 0.5, $blockpos.$z + 0.5);
x.prototype.$getEntityWorld = ()=>{return $world};
x.prototype.$getCommandSenderEntity = ()=>{return null};
x.prototype.$updateCommand = ()=>{};
x.prototype.$func_145757_a = ()=>{};
x.prototype.$getPosition = ()=>{return $blockpos};
x.prototype.$getPositionVector = ()=>{return vector};
x.prototype.$func_145751_f = ()=>{return 0};
var cmd = new x();
cmd.$setCommand(ModAPI.util.str(commandStr));
cmd.$trigger($world);

try {
debugger;
cmd.$trigger($world);
} catch (error) {
console.error(error);
}
}
}
ModAPI.dedicatedServer.appendCode(EFB2__defineExecCmdGlobal);
Expand Down
6 changes: 5 additions & 1 deletion serialise.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ function serialise() {
}
function deserialise(data) {
var data = JSON.parse(data);
Blockly.serialization.workspaces.load(data.blockly || {}, workspace);
try {
Blockly.serialization.workspaces.load(data.blockly || {}, workspace);
} catch (error) {

}
globalThis.state = data;
reloadUI();
}
Expand Down

0 comments on commit e260cc3

Please sign in to comment.