This commit is contained in:
parent
90d93dd6d6
commit
8f7a04e12c
@ -256,11 +256,11 @@ export class BlockRegistry implements SimpleRegistry<CustomBlock> {
|
||||
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<CustomBlock> {
|
||||
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<CustomBlock> {
|
||||
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 => {
|
||||
|
@ -60,7 +60,7 @@ export class World {
|
||||
* @internal
|
||||
*/
|
||||
private getCustomBlockEntities(): CustomBlockEntity[] {
|
||||
return BlockRegistry.INSTANCE.getBlockEntities();
|
||||
return BlockRegistry.INSTANCE.getCustomBlockEntities();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user