mods: add rarityjs, and start creating some grist based rarity tiers

This commit is contained in:
2025-06-21 11:49:03 +02:00
parent 64a6513064
commit 7c4fcbe515
9 changed files with 196 additions and 70 deletions

View File

@ -15,7 +15,6 @@ StartupEvents.registry('item', e => {
console.log(`Create ${grist}`);
e.create(grist.id())
.displayName(grist.displayName())
.rarity('rare')
.fireResistant(true)
.textureJson({layer0: grist.itemTexture()});
});

View File

@ -22,9 +22,10 @@ function HSVtoRGB(h, s, v) {
return `#${toHex(r)}${toHex(g)}${toHex(b)}`.toString();
}
function Tier(name, colorValue) {
function Tier(name, colorValue, rarity) {
this.name = name;
this.colorValue = colorValue;
this.rarity = rarity;
};
Tier.prototype.displayName = function() {
@ -83,9 +84,9 @@ Grist.Primitives = [
// Color values are 0-1 floats
Grist.Tiers = {
basic: new Tier('basic', 0.5),
improved: new Tier('improved', 0.75),
radiant: new Tier('radiant', 1.0)
basic: new Tier('basic', 0.5, 'uncommon'),
improved: new Tier('improved', 0.75, 'rare'),
radiant: new Tier('radiant', 1.0, 'epic')
};
Grist.Tiers.forEach = function(f) {
@ -148,6 +149,14 @@ Grist.prototype.exact = function() {
return this;
};
Grist.prototype.rarity = function() {
if (this.element == 'universal') {
return 'kubejs:legendary'
} else {
return this.tier.rarity;
}
}
Grist.prototype.color = function() {
//return '#0d6aff';
if (this.element.hue == -1) {
@ -190,11 +199,20 @@ Grist.prototype.elementalTag = function() {
};
Grist.prototype.tags = function() {
return [
'kubejs:grist',
this.tag(),
this.elementalTag()
];
if (this.state == 'item') {
return [
'kubejs:grist',
this.tag(),
this.elementalTag()
];
} else if (this.state == 'block') {
return [
'kubejs:grist_block',
this.tag(),
this.elementalTag(),
`forge:storage_blocks/grist_${this.element.name}_${this.tier.name}`
];
}
};
Grist.prototype.id = function() {

View File

@ -1,20 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2015",
"lib": [
"ES5",
"ES2015"
],
"rootDir": "./src",
"typeRoots": [
"../../.probe/startup/probe-types"
],
"baseUrl": "../../.probe/startup/probe-types",
"skipLibCheck": true
},
"include": [
"./src/**/*",
null
]
}

View File

@ -13,7 +13,7 @@ StartupEvents.registry('fluid', e => {
});
StartupEvents.registry('item', e => {
e.create('grist_essence').displayName('Grist Essence').rarity('rare');
e.create('grist_essence').displayName('Grist Essence').rarity('uncommon');
// Intelligent progress
// Basic
@ -28,10 +28,10 @@ StartupEvents.registry('item', e => {
e.create('intelligent_catalyst').displayName('Intelligent Catalyst').rarity('rare').textureJson({layer0: 'malloc:item/intelligent_catalyst'});
// Radiant
e.create('intelligent_processor').displayName('Intelligent Processor').rarity('rare').texture('malloc:item/intelligent_processor');
e.create('raw_intelligent_processor').displayName('Raw Intelligent Processor').rarity('rare').texture('malloc:item/raw_intelligent_processor');
e.create('deep_intelligent_processor').displayName('Deep Intelligent Processor').rarity('rare').texture('malloc:item/deep_intelligent_processor');
e.create('raw_deep_intelligent_processor').displayName('Deep Raw Intelligent Processor').rarity('rare').texture('malloc:item/raw_deep_intelligent_processor');
e.create('intelligent_processor').displayName('Intelligent Processor').rarity('epic').texture('malloc:item/intelligent_processor');
e.create('raw_intelligent_processor').displayName('Raw Intelligent Processor').rarity('epic').texture('malloc:item/raw_intelligent_processor');
e.create('deep_intelligent_processor').displayName('Deep Intelligent Processor').rarity('epic').texture('malloc:item/deep_intelligent_processor');
e.create('raw_deep_intelligent_processor').displayName('Deep Raw Intelligent Processor').rarity('epic').texture('malloc:item/raw_deep_intelligent_processor');
// Energetic progression
// Basic
@ -69,13 +69,13 @@ StartupEvents.registry('item', e => {
e.create('reinforced_grist_blend').displayName('Reinforced Grist Blend').rarity('rare').textureJson({layer0: 'minecraft:item/redstone'}).color(0, Grist.of('build', 'improved').color());
// Radiant
e.create('grist_crucible');
e.create('grist_crucible_filled');
e.create('grist_crucible_hot');
e.create('tempered_grist_alloy_ingot');
e.create('tempered_grist_alloy_nugget');
e.create('perfect_grist_alloy_ingot');
e.create('perfect_grist_alloy_nugget');
e.create('flawed_grist_alloy_ingot');
e.create('flawed_grist_alloy_nugget');
e.create('grist_crucible').rarity('epic');
e.create('grist_crucible_filled').rarity('epic');
e.create('grist_crucible_hot').rarity('epic');
e.create('tempered_grist_alloy_ingot').rarity('epic');
e.create('tempered_grist_alloy_nugget').rarity('epic');
e.create('perfect_grist_alloy_ingot').rarity('epic');
e.create('perfect_grist_alloy_nugget').rarity('epic');
e.create('flawed_grist_alloy_ingot').rarity('epic');
e.create('flawed_grist_alloy_nugget').rarity('epic');
});

View File

@ -0,0 +1,75 @@
// priority: 10000
RarityJSEvents.register(event => {
console.warn("Setting up rarities");
event.addRarity("kubejs:legendary", "yellow");
event.addRarity("kubejs:mythic", "red");
event.addRarity("kubejs:unique", "red");
event.addRarity("kubejs:intelligent_grist", "dark_green");
event.addRarity("kubejs:build_grist", "dark_blue");
event.addRarity("kubejs:energetic_grist", "dark_red");
event.addRarity("kubejs:agricultural_grist", "dark_yellow");
// TODO: Put modular items into the unique tier
// TODO: Put gobber compat stuff into legendary
// TODO: Put powder power stuff into mythic/legendary
Grist.forEach(grist => {
console.warn(`${grist.id()} => ${grist.rarity()}`);
event.setRarity(grist.id(), grist.rarity());
});
Grist.forEachBlock(grist => {
console.warn(`${grist.id()} => ${grist.rarity()}`);
event.setRarity(grist.id(), grist.rarity());
});
event.setRarityByMod('kubejs', 'rare');
event.setRarityByMod('miapi', 'kubejs:unique');
event.setRarity("miapi:modular_work_bench", "rare");
event.setRarityByMod('gobber2', 'uncommon');
// Lots of mid-game mods should be uncommon by default
event.setRarityByMod('wormhole_artifact', 'epic');
event.setRarityByMod('artifacts', 'epic');
event.setRarityByMod('sophisticatedbackpacks', 'kubejs:intelligent_grist');
event.setRarityByMod('ae2', 'kubejs:intelligent_grist');
event.setRarityByMod('torchmaster', 'kubejs:intelligent_grist');
event.setRarityByMod('experienceobelisk', 'kubejs:intelligent_grist');
event.setRarityByMod('functionalstorage', 'kubejs:intelligent_grist');
event.setRarityByMod('waystones', 'kubejs:intelligent_grist');
event.setRarityByMod('modularrouters', 'kubejs:intelligent_grist');
event.setRarityByMod('summoningrituals', 'epic');
event.setRarityByMod('tempad', 'epic');
event.setRarity('create:precision_mechanism', 'kubejs:intelligent_grist');
event.setRarity('create:experience_nugget', 'uncommon');
event.setRarityByMod('botanypots', 'kubejs:agricultural_grist');
event.setRarityByMod('industrialforegoing', 'kubejs:agricultural_grist');
event.setRarityByMod('hostilenetworks', 'kubejs:agricultural_grist');
event.setRarityByMod('easy_villagers', 'kubejs:agricultural_grist');
event.setRarity('thermal:redstone_servo', 'kubejs:agricultural_grist');
event.setRarity('thermal:device_fischer', 'kubejs:agricultural_grist');
event.setRarity('farmersdelight:cooking_pot', 'kubejs:agricultural_grist');
event.setRarityByMod('darkutils', 'kubejs:agricultural_grist');
event.setRarityByMod('systeams', 'kubejs:energetic_grist');
event.setRarityByMod('powah', 'kubejs:energetic_grist');
event.setRarityByMod('create_new_age', 'kubejs:energetic_grist');
event.setRarity('thermal:energy_duct', 'kubejs:energetic_grist');
event.setRarity('thermal:energy_cell', 'kubejs:energetic_grist');
event.setRarity('thermal:rf_coil', 'kubejs:energetic_grist');
event.setRarity('thermal:energy_cell_frame', 'kubejs:energetic_grist');
event.setRarity('create:windmill_bearing', 'kubejs:energetic_grist');
event.setRarity('immersive_aircraft:boiler', 'kubejs:energetic_grist');
event.setRarity('iron_furnaces:augment_factory', 'kubejs:energetic_grist');
event.setRarityByMod('thermal', 'kubejs:build_grist');
event.setRarityByMod('ironfurnaces', 'kubejs:build_grist');
event.setRarityByMod('buildinggadgets2', 'epic');
event.setRarity('create:crushing_wheel', 'kubejs:build_grist');
});