From 8f7a04e12ca3272181f150c19888421fc3897d9d Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Mon, 27 Apr 2020 14:22:07 -0400 Subject: [PATCH] Improve Method Names --- .../resources/scriptcraft/minecraft/block.ts | 20 +++++++++---------- .../resources/scriptcraft/minecraft/world.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/resources/scriptcraft/minecraft/block.ts b/src/main/resources/scriptcraft/minecraft/block.ts index bd15020..67f31ce 100644 --- a/src/main/resources/scriptcraft/minecraft/block.ts +++ b/src/main/resources/scriptcraft/minecraft/block.ts @@ -256,11 +256,11 @@ export class BlockRegistry implements SimpleRegistry { return null; } - getBlockEntity(id: Identifier, i: number): CustomBlockEntity { + getCustomBlockEntity(id: Identifier, i: number): CustomBlockEntity { return this.#blockEntities.get(id.toString())[i]; } - getBlockEntities(): CustomBlockEntity[] { + getCustomBlockEntities(): CustomBlockEntity[] { let out: CustomBlockEntity[] = []; for (const key of this.#blockEntities.keys()) { const list = this.#blockEntities.get(key); @@ -269,7 +269,7 @@ export class BlockRegistry implements SimpleRegistry { return out; } - createBlockEntity(id: Identifier, i: number) { + createCustomBlockEntity(id: Identifier, i: number) { const block = this.get(id) as CustomBlockWithEntity; if (!this.#blockEntities.get(id.toString())) { this.#blockEntities.set(id.toString(), []); @@ -277,33 +277,33 @@ export class BlockRegistry implements SimpleRegistry { this.#blockEntities.get(id.toString()).push(block.createBlockEntity()); } - freeBlockEntity(id: Identifier, i: number) { + freeCustomBlockEntity(id: Identifier, i: number) { delete this.#blockEntities.get(id.toString())[i]; } } addBridge('CustomBlockEntity.create', (id: string, i: number) => { - BlockRegistry.INSTANCE.createBlockEntity(new Identifier(id), i); + BlockRegistry.INSTANCE.createCustomBlockEntity(new Identifier(id), i); }); addBridge('CustomBlockEntity.fromTag', (id: string, i: number, tag: JavaObject) => { - BlockRegistry.INSTANCE.getBlockEntity(new Identifier(id), i).fromTag(new CompoundTag(tag)); + BlockRegistry.INSTANCE.getCustomBlockEntity(new Identifier(id), i).fromTag(new CompoundTag(tag)); }); addBridge('CustomBlockEntity.toTag', (id: string, i: number, tag: JavaObject): JavaObject => { - return BlockRegistry.INSTANCE.getBlockEntity(new Identifier(id), i).toTag(new CompoundTag(tag)).javaObject; + return BlockRegistry.INSTANCE.getCustomBlockEntity(new Identifier(id), i).toTag(new CompoundTag(tag)).javaObject; }); addBridge('CustomBlockEntity.tick', (id: string, i: number) => { - BlockRegistry.INSTANCE.getBlockEntity(new Identifier(id), i).tick(); + BlockRegistry.INSTANCE.getCustomBlockEntity(new Identifier(id), i).tick(); }); addBridge('CustomBlockEntity.setLocation', (id: string, i: number, world: JavaObject, x: number, y: number, z: number) => { - BlockRegistry.INSTANCE.getBlockEntity(new Identifier(id), i).setLocation(new World(world), new Pos(x, y, z)); + BlockRegistry.INSTANCE.getCustomBlockEntity(new Identifier(id), i).setLocation(new World(world), new Pos(x, y, z)); }); addBridge('CustomBlockEntity.free', (id: string, i: number) => { - BlockRegistry.INSTANCE.freeBlockEntity(new Identifier(id), i); + BlockRegistry.INSTANCE.freeCustomBlockEntity(new Identifier(id), i); }); addBridge('CustomBlock.onUse', (id: string, world: JavaObject, state: JavaObject, x: number, y: number, z: number, side: keyof typeof Direction, player: JavaObject, hand: keyof typeof Hand): string => { diff --git a/src/main/resources/scriptcraft/minecraft/world.ts b/src/main/resources/scriptcraft/minecraft/world.ts index 0f4df91..4f9c1f5 100644 --- a/src/main/resources/scriptcraft/minecraft/world.ts +++ b/src/main/resources/scriptcraft/minecraft/world.ts @@ -60,7 +60,7 @@ export class World { * @internal */ private getCustomBlockEntities(): CustomBlockEntity[] { - return BlockRegistry.INSTANCE.getBlockEntities(); + return BlockRegistry.INSTANCE.getCustomBlockEntities(); } /**