Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
Update RVAs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjlintkh committed Feb 18, 2022
1 parent f8922e8 commit 56bbd8c
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 238 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bdsx/bdsx-lxl",
"version": "1.1.1",
"version": "1.1.2",
"description": "LiteXLoader ported into BDSX",
"main": "index.js",
"keywords": [],
Expand Down
6 changes: 3 additions & 3 deletions src/api/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CompoundTag } from "bdsx/bds/nbt";
import { serverInstance } from "bdsx/bds/server";
import { StaticPointer } from "bdsx/core";
import { NativeType } from "bdsx/nativetype";
import { daccess, LIAPI, MCAPI } from "../dep/native";
import { daccess, LlAPI, MCAPI } from "../dep/native";
import { PrivateFields, Tag2Value } from "./api_help";
import { FloatPos, IntPos, IntPos$newPos } from "./base";
import { BlockEntity$newBlockEntity } from "./block_entity";
Expand All @@ -24,7 +24,7 @@ export class LXL_Block {
pos: IntPos;

get tileData() {
return LIAPI.Block.getTileData(this[PrivateFields]);
return LlAPI.Block.getTileData(this[PrivateFields]);
}

setNbt(nbt: NbtCompound) {
Expand Down Expand Up @@ -153,7 +153,7 @@ export function setBlock(a0: any, a1: any, a2?: any, a3?: any, a4?: any, a5?: an
CompoundTag[NativeType.setter](newBlock, block[PrivateFields], 96);
}
const region = serverInstance.minecraft.getLevel().getDimension(dimId)!.getBlockSource();
return region.setBlock(pos, LIAPI.BlockLegacy.toBlock(newBlock.blockLegacy, tileData));
return region.setBlock(pos, LlAPI.BlockLegacy.toBlock(newBlock.blockLegacy, tileData));
}

export function spawnParticle(pos: IntPos | FloatPos, type: MinecraftParticleEffect): boolean;
Expand Down
12 changes: 6 additions & 6 deletions src/api/container.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Container as _Container } from "bdsx/bds/inventory";
import { LIAPI, MCAPI } from "../dep/native";
import { LlAPI, MCAPI } from "../dep/native";
import { logger, PrivateFields } from "./api_help";
import { Item$newItem, LXL_Item } from "./item";

Expand All @@ -11,27 +11,27 @@ export class LXL_Container {
}

get size() {
return LIAPI.Container.getSize(this[PrivateFields]);
return LlAPI.Container.getSize(this[PrivateFields]);
}

get type() {
return LIAPI.Container.getTypeName(this[PrivateFields]);
return LlAPI.Container.getTypeName(this[PrivateFields]);
}

addItem(item: LXL_Item) {
if (!item[PrivateFields]) {
logger.error("Wrong type of argument in addItem!");
return null;
}
return LIAPI.Container.addItemSafe(this[PrivateFields], item[PrivateFields]);
return LlAPI.Container.addItemSafe(this[PrivateFields], item[PrivateFields]);
}

addItemToFirstEmptySlot(item: LXL_Item) {
if (!item[PrivateFields]) {
logger.error("Wrong type of argument in addItemToFirstEmptySlot!");
return null;
}
return LIAPI.Container.addItemToFirstEmptySlotSafe(this[PrivateFields], item[PrivateFields]);
return LlAPI.Container.addItemToFirstEmptySlotSafe(this[PrivateFields], item[PrivateFields]);
}

hasRoomFor(item: LXL_Item) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export class LXL_Container {
if (!itemOld) {
return false;
}
return LIAPI.ItemStack.setItem(itemOld, item[PrivateFields]);
return LlAPI.ItemStack.setItem(itemOld, item[PrivateFields]);
}

getAllItems() {
Expand Down
8 changes: 4 additions & 4 deletions src/api/device.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { ServerPlayer as _ServerPlayer } from "bdsx/bds/player";
import { LIAPI } from "../dep/native";
import { LlAPI } from "../dep/native";
import { PrivateFields } from "./api_help";

export class LXL_Device {
[PrivateFields]: _ServerPlayer;

get ip() {
return LIAPI.NetworkIdentifier.getIP(this[PrivateFields].getNetworkIdentifier());
return LlAPI.NetworkIdentifier.getIP(this[PrivateFields].getNetworkIdentifier());
}

get avgPing() {
return LIAPI.Player.getAvgPing(this[PrivateFields]);
return LlAPI.Player.getAvgPing(this[PrivateFields]);
}

get avgPacketLoss() {
return 0;
}

get os() {
return LIAPI.Player.getDeviceName(this[PrivateFields]);
return LlAPI.Player.getDeviceName(this[PrivateFields]);
}

get clientId() {
Expand Down
18 changes: 9 additions & 9 deletions src/api/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ServerPlayer } from "bdsx/bds/player";
import { serverInstance } from "bdsx/bds/server";
import { bin } from "bdsx/bin";
import { StaticPointer, VoidPointer } from "bdsx/core";
import { LIAPI, MCAPI } from "../dep/native";
import { LlAPI, MCAPI } from "../dep/native";
import { PrivateFields } from "./api_help";
import { DirectionAngle$newAngle, FloatPos, FloatPos$newPos, IntPos, IntPos$newPos } from "./base";
import { Block$newBlock } from "./block";
Expand Down Expand Up @@ -35,7 +35,7 @@ export class LXL_Entity {
return null;
}

return LIAPI.Actor.getTypeName(entity);
return LlAPI.Actor.getTypeName(entity);
}

get id() {
Expand All @@ -53,7 +53,7 @@ export class LXL_Entity {
return null;
}

return FloatPos$newPos(LIAPI.Actor.getPosition(entity), entity.getDimensionId());
return FloatPos$newPos(LlAPI.Actor.getPosition(entity), entity.getDimensionId());
}

get blockPos() {
Expand All @@ -62,7 +62,7 @@ export class LXL_Entity {
return null;
}

return IntPos$newPos(LIAPI.Actor.getBlockPos(entity), entity.getDimensionId());
return IntPos$newPos(LlAPI.Actor.getBlockPos(entity), entity.getDimensionId());
}

get maxHealth() {
Expand All @@ -89,7 +89,7 @@ export class LXL_Entity {
return null;
}

return !LIAPI.Actor.isOnGround(entity) && !MCAPI.Actor.isInWater(entity);
return !LlAPI.Actor.isOnGround(entity) && !MCAPI.Actor.isInWater(entity);
}

get inWater() {
Expand Down Expand Up @@ -226,7 +226,7 @@ export class LXL_Entity {
return null;
}

return LIAPI.Mob.refreshInventory(entity);
return LlAPI.Mob.refreshInventory(entity);
}

hasContainer() {
Expand Down Expand Up @@ -257,7 +257,7 @@ export class LXL_Entity {
return null;
}

return LIAPI.Actor.hurtEntity(entity, damage);
return LlAPI.Actor.hurtEntity(entity, damage);
}

setOnFire(time: number) {
Expand All @@ -266,7 +266,7 @@ export class LXL_Entity {
return null;
}

return LIAPI.Actor.setOnFire(entity, time, true);
return LlAPI.Actor.setOnFire(entity, time, true);
}

getNbt() {
Expand Down Expand Up @@ -325,7 +325,7 @@ export class LXL_Entity {
return null;
}

return LIAPI.Actor.getAllTags(entity);
return LlAPI.Actor.getAllTags(entity);
}

/** @deprecated */
Expand Down
20 changes: 10 additions & 10 deletions src/api/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { bedrockServer } from "bdsx/launcher";
import { bool_t, CxxString, float32_t, int32_t, uint16_t, uint32_t, uint8_t, void_t } from "bdsx/nativetype";
import { Wrapper } from "bdsx/pointer";
import { _tickCallback } from "bdsx/util";
import { daccess, LIAPI, MCAPI, symhook } from "../dep/native";
import { daccess, LlAPI, MCAPI, symhook } from "../dep/native";
import { logger } from "./api_help";
import { FloatPos, FloatPos$newPos, IntPos, IntPos$newPos } from "./base";
import { Block$newBlock, LXL_Block } from "./block";
Expand Down Expand Up @@ -336,7 +336,7 @@ events.playerDropItem.on(event => {
const original = symhook("?useTimeDepleted@FoodItemComponentLegacy@@UEAAPEBVItem@@AEAVItemStack@@AEAVPlayer@@AEAVLevel@@@Z",
int32_t, null, StaticPointer, ItemStack, Player, Level)
((thiz, instance, player, level): MCAPI.ItemUseMethod => {
if (LIAPI.ItemStack.getTypeName(instance) !== "minecraft:suspicious_stew") {
if (LlAPI.ItemStack.getTypeName(instance) !== "minecraft:suspicious_stew") {
const cancelled = LXL_Events.onEat.fire(Player$newPlayer(<ServerPlayer>player), Item$newItem(instance));
_tickCallback();
if (cancelled) {
Expand Down Expand Up @@ -749,7 +749,7 @@ events.playerDropItem.on(event => {
((thiz, region, origin, markForSaving) => {
const command = MCAPI.BaseCommandBlock.getCommand(thiz);
const isMinecart = MCAPI.CommandOrigin.getOriginType(origin) === MCAPI.CommandOriginType.MinecartCommandBlock;
const pos = isMinecart ? origin.getEntity()!.getPosition() : LIAPI.BlockPos.toVec3(origin.getBlockPosition());
const pos = isMinecart ? origin.getEntity()!.getPosition() : LlAPI.BlockPos.toVec3(origin.getBlockPosition());
const cancelled = LXL_Events.onCmdBlockExecute.fire(command, FloatPos$newPos(pos, origin.getDimension().getDimensionId()), isMinecart);
_tickCallback();
if (cancelled) {
Expand Down Expand Up @@ -917,7 +917,7 @@ let onFireSpread_OnPlace = false;
bool_t, null, StaticPointer, BlockSource, Container, Vec3)
((thiz, region, toContainer, pos) => {
const isMinecart = daccess(thiz, bool_t, 5);
const cancelled = LXL_Events.onHopperSearchItem.fire(FloatPos$newPos(isMinecart ? pos : LIAPI.Vec3.toBlockPos(pos), MCAPI.BlockSource.getDimensionId(region)), isMinecart);
const cancelled = LXL_Events.onHopperSearchItem.fire(FloatPos$newPos(isMinecart ? pos : LlAPI.Vec3.toBlockPos(pos), MCAPI.BlockSource.getDimensionId(region)), isMinecart);
_tickCallback();
if (cancelled) {
return false;
Expand Down Expand Up @@ -1119,15 +1119,15 @@ events.entityDie.on(event => {
const maxResistance = thiz.mMaxResistance;
const genFire = thiz.mFire;
const canBreaking = thiz.mBreaking;
if (actor?.isNotNull()) {
if (actor) {
const cancelled = LXL_Events.onEntityExplode.fire(Entity$newEntity(actor), FloatPos$newPos(pos, actor.getDimensionId()), maxResistance, radius, canBreaking, genFire);
_tickCallback();
if (cancelled) {
return;
}
} else {
let cancelled = false;
const bp = LIAPI.Vec3.toBlockPos(pos);
const bp = LlAPI.Vec3.toBlockPos(pos);
const block = bs.getBlock(bp);
if (block.getName() === "minecraft:respawn_anchor") {
cancelled ||= LXL_Events.onRespawnAnchorExplode.fire(IntPos$newPos(bp, MCAPI.BlockSource.getDimensionId(bs)));
Expand All @@ -1152,7 +1152,7 @@ events.entityDie.on(event => {
void_t, null, ProjectileComponent, Actor, StaticPointer)
((thiz, owner, res) => {
const to = MCAPI.HitResult.getEntity(res);
if (to?.isNotNull()) {
if (to) {
const cancelled = LXL_Events.onProjectileHitEntity.fire(Entity$newEntity(to), Entity$newEntity(owner));
_tickCallback();
}
Expand All @@ -1165,7 +1165,7 @@ events.entityDie.on(event => {
const original = symhook("?_destroyBlocks@WitherBoss@@AEAAXAEAVLevel@@AEBVAABB@@AEAVBlockSource@@H@Z",
void_t, null, Actor, Level, MCAPI.AABB, BlockSource, int32_t)
((thiz, level, areaofeffect, region, a5) => {
const cancelled = LXL_Events.onWitherBossDestroy.fire(Entity$newEntity(thiz), IntPos$newPos(LIAPI.Vec3.toBlockPos(areaofeffect.min), thiz.getDimensionId()), IntPos$newPos(LIAPI.Vec3.toBlockPos(areaofeffect.max), thiz.getDimensionId()));
const cancelled = LXL_Events.onWitherBossDestroy.fire(Entity$newEntity(thiz), IntPos$newPos(LlAPI.Vec3.toBlockPos(areaofeffect.min), thiz.getDimensionId()), IntPos$newPos(LlAPI.Vec3.toBlockPos(areaofeffect.max), thiz.getDimensionId()));
_tickCallback();
if (cancelled) {
return;
Expand Down Expand Up @@ -1240,7 +1240,7 @@ events.entityDie.on(event => {
const original = symhook("?releaseUsing@TridentItem@@UEBAXAEAVItemStack@@PEAVPlayer@@H@Z",
void_t, null, StaticPointer, ItemStack, Player, int32_t)
((thiz, itemStack, player, durationLeft) => {
const cancelled = LXL_Events.onSpawnProjectile.fire(Entity$newEntity(player), LIAPI.ItemStack.getTypeName(itemStack));
const cancelled = LXL_Events.onSpawnProjectile.fire(Entity$newEntity(player), LlAPI.ItemStack.getTypeName(itemStack));
_tickCallback();
if (cancelled) {
return;
Expand All @@ -1258,7 +1258,7 @@ events.entityDie.on(event => {
MCAPI.NpcSceneDialogueData.NpcSceneDialogueData(data, thiz, owner, sceneName);
const container = MCAPI.NpcSceneDialogueData.getActionsContainer(data);
const actionAt = MCAPI.NpcActionsContainer.getActionAt(container, actionIndex);
if (actionAt?.isNotNull() && actionAt.mType === MCAPI.NpcActionType.CommandAction) {
if (actionAt && actionAt.mType === MCAPI.NpcActionType.CommandAction) {
const str = actionAt.as(MCAPI.NpcCommandAction).mCommands.get(0)?.mCommandLine;
if (str) {
const cancelled = LXL_Events.onNpcCmd.fire(Entity$newEntity(owner), Player$newPlayer(<ServerPlayer>player), str);
Expand Down
10 changes: 5 additions & 5 deletions src/api/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DimensionId } from "bdsx/bds/actor";
import { Vec3 } from "bdsx/bds/blockpos";
import { ItemStack } from "bdsx/bds/inventory";
import { serverInstance } from "bdsx/bds/server";
import { LIAPI, MCAPI } from "../dep/native";
import { LlAPI, MCAPI } from "../dep/native";
import { PrivateFields } from "./api_help";
import { FloatPos, IntPos } from "./base";
import { Entity$newEntity, LXL_Entity } from "./entity";
Expand Down Expand Up @@ -30,7 +30,7 @@ export class LXL_Item {
if (!itemNew) {
return null;
}
return LIAPI.ItemStack.setItem(this[PrivateFields], itemNew);
return LlAPI.ItemStack.setItem(this[PrivateFields], itemNew);
}

clone() {
Expand Down Expand Up @@ -80,10 +80,10 @@ export function Item$newItem(p: ItemStack) {
const newp = new LXL_Item();
newp[PrivateFields] = p;
Object.defineProperty(newp, "name", { value: p.getCustomName() });
Object.defineProperty(newp, "type", { value: LIAPI.ItemStack.getTypeName(p) });
Object.defineProperty(newp, "type", { value: LlAPI.ItemStack.getTypeName(p) });
Object.defineProperty(newp, "id", { value: p.getId() });
Object.defineProperty(newp, "count", { value: LIAPI.ItemStack.getCount(p) });
Object.defineProperty(newp, "aux", { value: LIAPI.ItemStack.getAux(p) });
Object.defineProperty(newp, "count", { value: LlAPI.ItemStack.getCount(p) });
Object.defineProperty(newp, "aux", { value: LlAPI.ItemStack.getAux(p) });
return newp;
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LIAPI } from "../dep/native";
import { LlAPI } from "../dep/native";
import { Logger } from "../utils/logger";
import { PrivateFields, StringifyValue, TimeNow } from "./api_help";
import { LXL_Player } from "./player";
Expand All @@ -22,7 +22,7 @@ export const logger = {
if (this.player && this.playerLevel >= (Logger.Level as any)[mode]) {
const player = this.player[PrivateFields];
if (player) {
LIAPI.Player.sendText(player, `${(Logger.ColorCode as any)[mode]}[${mode}]${this.title ? "[" + this.title + "]" : ""} ${message}`, 0);
LlAPI.Player.sendText(player, `${(Logger.ColorCode as any)[mode]}[${mode}]${this.title ? "[" + this.title + "]" : ""} ${message}`, 0);
}
}
return true;
Expand Down
Loading

0 comments on commit 56bbd8c

Please sign in to comment.