feat: add playerWillDestroy,attack,pullInEntity

feat: add playerWillDestroy,attack,pullInEntity
This commit is contained in:
Kobe Bryant
2024-06-04 14:24:30 +08:00
committed by GitHub
Unverified
2 changed files with 40 additions and 1 deletions
+21 -1
View File
@@ -123,7 +123,11 @@ const GMLIB_API = {
itemCanDestroyInCreative: ll.import("GMLIB_API", "itemCanDestroyInCreative"),
itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"),
blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool"),
blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable")
blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable"),
blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"),
playerAttack: ll.import("GMLIB_API", "playerAttack"),
playerPullInEntity: ll.import("GMLIB_API", "playerPullInEntity"),
getBlockTranslateKeyFromName: ll.import("GMLIB_API", "getBlockTranslateKeyFromName")
}
const mStaticFloatingTextMap = new Map();
@@ -431,6 +435,10 @@ class Minecraft {
static readNbtFromFile(path, isBinary = true) {
return GMLIB_API.readNbtFromFile(path, isBinary);
}
static getBlockTranslateKeyFromName(name) {
return GMLIB_API.getBlockTranslateKeyFromName(name);
}
}
class Recipes {
@@ -990,6 +998,18 @@ LLSE_Block.prototype.isAlwaysDestroyable = function () {
return GMLIB_API.blockIsAlwaysDestroyable(this);
}
LLSE_Block.prototype.playerWillDestroy = function (player) {
return GMLIB_API.blockPlayerWillDestroy(this, player, this.pos);
}
LLSE_Player.prototype.attack = function (entity) {
return GMLIB_API.playerAttack(this, entity);
}
LLSE_Player.prototype.pullInEntity = function (entity) {
return GMLIB_API.playerPullInEntity(this, entity);
}
module.exports = {
StaticFloatingText,
DynamicFloatingText,