流体注册(旧版)(Fluid Registry (Legacy))

预计阅读时间: 4 分钟

向游戏添加新流体

自定义流体在启动脚本中创建。该事件不可取消。

这在 NeoForge/Forge 的所有版本上都支持,在 Fabric 的 1.18.2+ 上支持。

1.19.2 - 1.20.1

StartupEvents.registry('fluid', event => {
  // 基本的"浓稠"(看起来像岩浆)流体,带有红色色调
  event.create('thick_fluid')
    .thickTexture(0xFF0000)
    .bucketColor(0xFF0000)
    .displayName('Thick Fluid')

  // 基本的"稀薄"(看起来像水)流体,带有青色色调,没有桶且不可放置
  event.create('thin_fluid')
    .thinTexture(0xFF0000)
    .bucketColor(0x00FFFF)
    .displayName('Thin Fluid')
    .noBucket()
    .noBlock()

  // 带有自定义纹理的流体
  event.create('strawberry_cream')
    .displayName('Strawberry Cream')
    .stillTexture('kubejs:block/strawberry_still')
    .flowingTexture('kubejs:block/strawberry_flow')
    .bucketColor(0xFF33FF)

  // 带有修改桶物品的流体
  const tacoSauce = event
    .create('taco_sauce')
    .thickTexture(0xff0000)
    .bucketColor(0xff0000)

  tacoSauce.bucketItem.group('food')
})

1.16.5 - 1.18.2

onEvent('fluid.registry', event => {
  // 基本的"浓稠"(看起来像岩浆)流体,带有红色色调
  event.create('thick_fluid')
    .thickTexture(0xFF0000)
    .bucketColor(0xFF0000)
    .displayName('Thick Fluid')

  // 基本的"稀薄"(看起来像水)流体,带有青色色调,没有桶且不可放置
  event.create('thin_fluid')
    .thinTexture(0xFF0000)
    .bucketColor(0x00FFFF)
    .displayName('Thin Fluid')
    .noBucket() // 仅 1.18.2
    .noBlock() // 仅 1.18.2

  // 带有自定义纹理的流体
  event.create('strawberry_cream')
    .displayName('Strawberry Cream')
    .stillTexture('kubejs:block/strawberry_still')
    .flowingTexture('kubejs:block/strawberry_flow')
    .bucketColor(0xFF33FF)

  // 带有修改桶物品的流体
  const tacoSauce = event
    .create('taco_sauce')
    .thickTexture(0xff0000)
    .bucketColor(0xff0000)

  tacoSauce.bucketItem.group('food')
})

流体构建器支持的其他方法:(您可以在 create() 之后链式调用这些方法)

  • displayName(name) - 设置显示名称
  • rarity(value) - 设置稀有度
    • rarity 可以是:
      • 'common'(普通)
      • 'uncommon'(罕见)
      • 'rare'(稀有)
      • 'epic'(史诗)
  • color(color) - 设置颜色
  • bucketColor(color) - 设置桶颜色
  • thinTexture(color) - 设置稀薄流体纹理
  • thickTexture(color) - 设置浓稠流体纹理
  • builtinTextures() - 使用内置纹理
  • stillTexture(path) - 设置静止纹理
    • path 是纹理路径,例如 minecraft:block/sand
    • 此纹理建议为 16x16,如果使用 mcmeta 文件动画,则为 3 帧的 16x48 或 5 帧的 16x80 或 15 帧的 16x240
    • 帧数为 3、5、15、6、10 或 30 会让您的工作更轻松,因为流动动画需要是 15 的倍数才能看起来很好
  • flowingTexture(path) - 设置流动纹理
    • path 是纹理路径,例如 minecraft:block/sand
    • 此纹理建议为 32x480 并使用 mcmeta 文件动画
    • 每个帧建议为 32x32(建议是相同的 16x16 纹理平铺)
    • 然后这些帧中的每一个都从前一个垂直移动一个像素,使其看起来像是在移动
    • 如果您要制作自己的流动流体纹理,强烈建议不要手动制作(这是数小时的痛苦),而是编写一些程序,或使用 blender 节点设置来制作
  • noBucket() - 不创建桶
  • noBlock() - 不创建方块
  • gaseous() - 使流体成为气体(在 Architectury 眼中,这与 Mekanism 的气体不同!)
  • bucketItem - 桶物品

以下也可以使用,但除非模组添加用途,否则没有效果:

  • luminosity(value) 默认值:0 - 发光度
  • density(value) 默认值:1000 - 密度
  • temperature(value) 默认值:300 - 温度
  • viscosity(value) 默认值:1000 - 粘度

脚本文件夹startup_scripts/