Skip to content

Commit

Permalink
Merge pull request #5435 from ZZZank/fluid-registry-rework
Browse files Browse the repository at this point in the history
Fluid registry rework
  • Loading branch information
NielsPilgaard authored Dec 30, 2023
2 parents 763db36 + 66e7a75 commit d5d22f6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 50 deletions.
10 changes: 10 additions & 0 deletions kubejs/assets/kubejs/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,11 @@
"fluid.kubejs.molten_niotic": "Molten Niotic Crystal",
"fluid.kubejs.molten_nitro": "Molten Nitro Crystal",
"fluid.kubejs.molten_spirited": "Molten Spirited Crystal",
"fluid.kubejs.pink_ender_slime": "Molten Pink Enderslime",
"fluid.kubejs.molten_hardened_glass": "Molten Hardened Glass",
"fluid.kubejs.molten_signalum_glass": "Molten Signalum Glass",
"fluid.kubejs.molten_lumium_glass": "Molten Lumium Glass",
"fluid.kubejs.molten_enderium_glass": "Molten Enderium Glass",

"item.kubejs.molten_compressed_iron_bucket": "Molten Compressed Iron Bucket",
"item.kubejs.molten_infused_iron_bucket": "Molten Infused Iron Bucket",
Expand All @@ -856,6 +861,11 @@
"item.kubejs.molten_niotic_bucket": "Molten Niotic Crystal Bucket",
"item.kubejs.molten_nitro_bucket": "Molten Nitro Crystal Bucket",
"item.kubejs.molten_spirited_bucket": "Molten Spirited Crystal Bucket",
"item.kubejs.pink_ender_slime_bucket": "Molten Pink Enderslime Bucket",
"item.kubejs.molten_hardened_glass_bucket": "Molten Hardened Glass Bucket",
"item.kubejs.molten_signalum_glass_bucket": "Molten Signalum Glass Bucket",
"item.kubejs.molten_lumium_glass_bucket": "Molten Lumium Glass Bucket",
"item.kubejs.molten_enderium_glass_bucket": "Molten Enderium Glass Bucket",

"item.kubejs.blaze_larva": "Blaze Larva",
"item.kubejs.clay_larva": "Clay Larva",
Expand Down
10 changes: 10 additions & 0 deletions kubejs/assets/kubejs/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,11 @@
"fluid.kubejs.molten_niotic": "熔融钻石水晶",
"fluid.kubejs.molten_nitro": "熔融下界水晶",
"fluid.kubejs.molten_spirited": "熔融富生水晶",
"fluid.kubejs.pink_ender_slime": "熔融粉红末影史莱姆",
"fluid.kubejs.molten_hardened_glass": "熔融硬化玻璃",
"fluid.kubejs.molten_signalum_glass": "熔融信素玻璃",
"fluid.kubejs.molten_lumium_glass": "熔融流明玻璃",
"fluid.kubejs.molten_enderium_glass": "熔融末影玻璃",
"item.kubejs.molten_compressed_iron_bucket": "熔融压缩铁桶",
"item.kubejs.molten_infused_iron_bucket": "熔融灌注铁桶",
"item.kubejs.molten_manasteel_bucket": "熔融魔力钢桶",
Expand All @@ -763,6 +768,11 @@
"item.kubejs.molten_niotic_bucket": "熔融钻石水晶桶",
"item.kubejs.molten_nitro_bucket": "熔融下界水晶桶",
"item.kubejs.molten_spirited_bucket": "熔融富生水晶桶",
"item.kubejs.pink_ender_slime_bucket": "熔融粉红末影史莱姆",
"item.kubejs.molten_hardened_glass_bucket": "熔融硬化玻璃",
"item.kubejs.molten_signalum_glass_bucket": "熔融信素玻璃",
"item.kubejs.molten_lumium_glass_bucket": "熔融流明玻璃",
"item.kubejs.molten_enderium_glass_bucket": "熔融末影玻璃",
"item.kubejs.blaze_larva": "烈焰蜜蜂幼体",
"item.kubejs.clay_larva": "黏土蜜蜂幼体",
"item.kubejs.ghast_larva": "恶魂蜜蜂幼体",
Expand Down
99 changes: 49 additions & 50 deletions kubejs/startup_scripts/fluid_registry.js
Original file line number Diff line number Diff line change
@@ -1,147 +1,146 @@
onEvent('fluid.registry', (event) => {
/**
* @type {{type:string,id:string,color:number,display?:string,still?:string,flowing?:string}[]}
* @param type Can be `thin`, `thick`, or `custom`
* @param display Deprecated, DO NOT USE. Please switch to lang file.
* Tips: For a targeted fluid, its language key is `"fluid.kubejs.{id}"`,
* and the language key for its bucket item is `"item.kubejs.{id}_bucket"`
* @param still Valid only when `type` is `custom`
* @param flowing Valid only when `type` is `custom`
*/
const generalFluids = [
{
type: 'thick',
id: 'molten_cobalt_bee',
texture: '0x209EBD',
display: 'Molten Cobalt Bee'
color: 0x209ebd
},
{
type: 'thick',
id: 'molten_aluminum_bee',
texture: '0xdce6f7',
display: 'Molten Aluminum Bee'
color: 0xdce6f7
},
{
type: 'thin',
id: 'liquid_slimy_bee',
texture: '0x73c262',
display: 'Liquid Slimy Bee'
color: 0x73c262
},
{
type: 'thin',
id: 'liquid_skyslime_bee',
texture: '0x72CFCB',
display: 'Liquid Skyslime Bee'
color: 0x72cfcb
},
{
type: 'thin',
id: 'liquid_ichor_bee',
texture: '0xFDAB69',
display: 'Liquid Ichor Bee'
color: 0xfdab69
},
{
type: 'thin',
id: 'liquid_enderslime_bee',
texture: '0xC75EFF',
display: 'Liquid Enderslime Bee'
color: 0xc75eff
},
{
type: 'thick',
id: 'molten_compressed_iron',
texture: '0x868686',
display: 'Molten Compressed Iron'
color: 0x868686
},
{
type: 'thick',
id: 'molten_infused_iron',
texture: '0x2eb337',
display: 'Molten Infused Iron'
color: 0x2eb337
},
{
type: 'thick',
id: 'molten_blazing',
texture: '0xd79811',
display: 'Molten Blazing Crystal'
color: 0xd79811
},
{
type: 'thick',
id: 'molten_energized_steel',
texture: '0xb89365',
display: 'Molten Energized Steel'
color: 0xb89365
},
{
type: 'thick',
id: 'molten_sky',
texture: '0x88d7fc',
display: 'Molten Sky Metal'
color: 0x88d7fc
},
{
type: 'thick',
id: 'molten_terminite',
texture: '0x74f3e3',
display: 'Molten Terminite'
color: 0x74f3e3
},
{
type: 'thick',
id: 'molten_aeternium',
texture: '0x2e847c',
display: 'Molten Aeternium'
color: 0x2e847c
},
{
type: 'thick',
id: 'molten_gaia_spirit',
texture: '0x94a0bf',
display: 'Molten Gaia Spirit'
color: 0x94a0bf
},
{
type: 'thick',
id: 'molten_niotic',
texture: '0x54e5ea',
display: 'Molten Niotic Crystal'
color: 0x54e5ea
},
{
type: 'thick',
id: 'molten_nitro',
texture: '0xa42022',
display: 'Molten Nitro Crystal'
color: 0xa42022
},
{
type: 'thick',
id: 'molten_spirited',
texture: '0x86c52d',
display: 'Molten Spirited Crystal'
color: 0x86c52d
},
{
type: 'thick',
id: 'pink_ender_slime',
texture: '0xa504d1',
display: 'Molten Pink Enderslime'
color: 0xa504d1
},
{
type: 'thick',
id: 'molten_hardened_glass',
texture: '0x535054',
display: 'Molten Hardened Glass'
color: 0x535054
},
{
type: 'thick',
id: 'molten_signalum_glass',
texture: '0x968274',
display: 'Molten Signalum Glass'
color: 0x968274
},
{
type: 'thick',
id: 'molten_lumium_glass',
texture: '0x959674',
display: 'Molten Lumium Glass'
color: 0x959674
},
{
type: 'thick',
id: 'molten_enderium_glass',
texture: '0x356e5b',
display: 'Molten Enderium Glass'
color: 0x356e5b
}
];

generalFluids.forEach((fluid) => {
let /** @type {Internal.FluidBuilder} */ builder;
if (fluid.type == 'thick') {
event.create(fluid.id).textureThick(fluid.texture).bucketColor(fluid.texture).displayName(fluid.display);
builder = event.create(fluid.id).textureThick(fluid.color).bucketColor(fluid.color);
} else if (fluid.type == 'thin') {
event.create(fluid.id).textureThin(fluid.texture).bucketColor(fluid.texture).displayName(fluid.display);
} /*
else if (fluid.type == 'custom') {
event.create(fluid.id).displayName(fluid.display).textureStill(fluid.still).textureFlowing(fluid.flowing).bucketColor(fluid.color)
}*/
builder = event.create(fluid.id).textureThin(fluid.color).bucketColor(fluid.color);
} else if (fluid.type == 'custom') {
builder = event
.create(fluid.id)
.textureStill(fluid.still)
.textureFlowing(fluid.flowing)
.bucketColor(fluid.color);
} else {
console.error('Invalid fluid registry type: ' + fluid.type);
}
if (fluid.display) {
console.warn(
'Deprecated param used: `display`, please switch to language file(kubejs/lang/en_us.json).'
);
builder.displayName(fluid.display);
}
});
});

0 comments on commit d5d22f6

Please sign in to comment.