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

@@ -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() {