echo reportedly ran git add .
in src/main/resources
instead of src/
This commit is contained in:
parent
1abc960bff
commit
17e10c0775
2 changed files with 15 additions and 0 deletions
|
@ -14,6 +14,7 @@ import net.minecraft.nbt.NbtOps;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.SimpleMenuProvider;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.PumpkinBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -56,6 +57,9 @@ public class ComputerBlockEntity extends BlockEntity {
|
|||
public AjarFileSystem getFileSystem() {
|
||||
return fileSystem;
|
||||
}
|
||||
public JsVm getVm() {
|
||||
return jsVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(@NotNull CompoundTag pTag, HolderLookup.@NotNull Provider pRegistries) {
|
||||
|
|
|
@ -25,6 +25,7 @@ public class JsVm {
|
|||
this.entity = entity;
|
||||
this.sandbox.inject("screen", new ScreenHelper(entity));
|
||||
this.sandbox.inject("fs", new FileSystemHelper(entity));
|
||||
this.sandbox.inject("js", new Js(entity));
|
||||
this.sandbox.allow(ProcessHelper.class);
|
||||
}
|
||||
|
||||
|
@ -138,6 +139,16 @@ public class JsVm {
|
|||
}
|
||||
}
|
||||
|
||||
public class Js {
|
||||
private final ComputerBlockEntity entity;
|
||||
|
||||
public Js(ComputerBlockEntity entity) {this.entity = entity;}
|
||||
public void run(String path){
|
||||
var fs = new FileSystemHelper(entity);
|
||||
entity.getVm().executeScript(fs.readFile(path), new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public void executeScript(String source, String[] args) {
|
||||
try {
|
||||
// TODO: provide an import facility of some sort
|
||||
|
|
Loading…
Reference in a new issue