Skip to content

Commit

Permalink
Updated region buffer / structure system
Browse files Browse the repository at this point in the history
  • Loading branch information
SIsilicon committed Nov 21, 2024
1 parent 0f870da commit 47bab32
Show file tree
Hide file tree
Showing 40 changed files with 891 additions and 995 deletions.
3 changes: 0 additions & 3 deletions src/library/Minecraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ export * from "./utils/index.js";

import { Player as PlayerBuilder } from "./classes/playerBuilder.js";
import { Command } from "./classes/commandBuilder.js";
import { Structure } from "./classes/structureBuilder.js";
import { ServerBuilder } from "./classes/serverBuilder.js";
import { UIForms } from "./classes/uiFormBuilder.js";
import { Block } from "./classes/blockBuilder.js";

export { CustomArgType, CommandPosition } from "./classes/commandBuilder.js";
export { commandSyntaxError, registerInformation as CommandInfo } from "./@types/classes/CommandBuilder";
export { StructureSaveOptions, StructureLoadOptions } from "./classes/structureBuilder.js";
export { Databases } from "./classes/databaseBuilder.js";
export { configuration } from "./configurations.js";

Expand All @@ -49,7 +47,6 @@ class ServerBuild extends ServerBuilder {
public player = PlayerBuilder;
public command = Command;
public uiForms = UIForms;
public structure = Structure;

constructor() {
super();
Expand Down
291 changes: 0 additions & 291 deletions src/library/classes/structureBuilder.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/library/utils/scheduling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ system.runInterval(() => {
});

function sleep(ticks: number) {
return new Promise((resolve) => setTickTimeout(resolve, ticks));
return new Promise<void>((resolve) => setTickTimeout(resolve, ticks));
}

function shutdownTimers() {
Expand Down
12 changes: 10 additions & 2 deletions src/library/utils/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ export class Vector {
return new Vector(loc.x, loc.y, loc.z);
}

static add(a: anyVec, b: anyVec) {
static add(a: anyVec, b: anyVec | number) {
return Vector.from(a).add(b);
}

static sub(a: anyVec, b: anyVec) {
static sub(a: anyVec, b: anyVec | number) {
return Vector.from(a).sub(b);
}

static mul(a: anyVec, b: anyVec | number) {
return Vector.from(a).mul(b);
}

static div(a: anyVec, b: anyVec | number) {
return Vector.from(a).div(b);
}

static min(a: anyVec, b: anyVec) {
return Vector.from(a).min(b);
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/brushes/structure_brush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ export class StructureBrush extends Brush {
console.warn(options.rotation, options.flip);
}

yield history.addUndoStructure(record, start, end);
yield* history.addUndoStructure(record, start, end);
yield* struct.load(center, session.getPlayer().dimension, options);
yield history.addRedoStructure(record, start, end);
yield* history.addRedoStructure(record, start, end);
history.commit(record);
} catch {
history.cancel(record);
Expand Down
2 changes: 1 addition & 1 deletion src/server/commands/brush/size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ registerCommand(registerInformation, function (session, builder, args) {
assertClipboard(session);

size = Vector.from(session.clipboard.getSize());
blockCount = session.clipboard.getBlockCount();
blockCount = session.clipboard.getVolume();

message.append("translate", "commands.wedit:size.offset").with(`${session.clipboardTransform.offset}\n`);
} else {
Expand Down
Loading

0 comments on commit 47bab32

Please sign in to comment.