Global Scope(Global Scope)

预计阅读时间: 2 分钟

可从任何位置访问的类和实用工具

原始类型原型扩展(Primitive prototype additions)

  • string#namespace: string - 命名空间字符串的命名空间部分,例如 minecraft:oak_planks 的命名空间是 minecraft。如果没有 :,默认为 minecraft
  • string#path: string - 命名空间字符串的路径部分,例如 minecraft:oak_planks 的路径是 oak_planks

常量和对象(Constants and Objects)

名称类型描述
globalMap<String, Object>全局对象,您可以使用它在启动脚本中设置对象和回调,并从服务器或客户端脚本中引用它们
consoleConsole控制台对象,用于日志记录
SECONDnumber1000
MINUTEnumber60000 (60 * SECOND)
HOURnumber3600000 (60 * MINUTE)

类(Classes)

1.20.1 / 1.19.2 / 1.18.2

  • WIP(工作进行中)
  • Platform
  • ResourceLocation
  • Utils
  • Java
  • Text
  • UUID
  • JsonIO
  • Block
  • Item
  • Ingredient
  • IngredientHelper
  • NBT
  • NBTIO
  • Direction
  • Facing
  • AABB
  • Fluid
  • Color
  • BlockStatePredicate
  • WIP(工作进行中)

包装类(Wrapped Classes)

名称
JavaMathjava.lang.Math
Blocksnet.minecraft.world.level.block.Blocks
Itemsnet.minecraft.world.item.Items
Statsnet.minecraft.stats.Stats
BlockPosnet.minecraft.core.BlockPos
DamageSourcenet.minecraft.world.damagesource.DamageSource
BlockPropertiesnet.minecraft.world.level.block.state.properties.BlockStateProperties
Vec3, Vec3dnet.minecraft.world.phys.Vec3
Vec3inet.minecraft.core.Vec3i