Initial commit

This commit is contained in:
2025-02-02 10:53:17 +01:00
commit e096b14780
367 changed files with 22838 additions and 0 deletions

35
kubejs/startup_scripts/grist.js Executable file
View File

@ -0,0 +1,35 @@
StartupEvents.registry('block', e => {
console.log('Creating grist blocks');
Grist.forEachBlock(grist => {
console.log(`Create ${grist}`);
e.create(grist.id())
.displayName(grist.displayName())
.tagBlock('mineable/pickaxe')
.textureAll(grist.blockTexture())
.color(0, grist.color());
});
});
StartupEvents.registry('item', e => {
console.log('Creating grist items');
Grist.forEach(grist => {
console.log(`Create ${grist}`);
e.create(grist.id())
.displayName(grist.displayName())
.rarity('rare')
.fireResistant(true)
.textureJson({layer0: grist.itemTexture()})
.color(0, grist.color());
});
});
StartupEvents.registry('fluid', e => {
console.log('Creating grist fluids');
Grist.forEachFluid(grist => {
console.log(`Create ${grist}`);
e.create(grist.id())
.bucketColor(grist.color())
.thickTexture(grist.color())
.displayName(grist.displayName());
});
});

228
kubejs/startup_scripts/init.js Executable file
View File

@ -0,0 +1,228 @@
// priority: 0
function HSVtoRGB(h, s, v) {
var r, g, b, i, f, p, q, t;
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
const toHex = n => {
return Math.round(255 * n).toString(16).padStart(2, '0');
}
// The JS engine seems to think that templates aren't actually strings??
return `#${toHex(r)}${toHex(g)}${toHex(b)}`.toString();
}
function Tier(name, colorValue) {
this.name = name;
this.colorValue = colorValue;
};
Tier.prototype.displayName = function() {
return this.name.charAt(0).toUpperCase() + this.name.slice(1);
};
Tier.prototype.toString = function() {
return this.name;
};
function Element(name, hue) {
this.name = name;
this.hue = hue;
};
Element.prototype.displayName = function() {
return this.name.charAt(0).toUpperCase() + this.name.slice(1);
};
Element.prototype.toString = function() {
return this.name;
};
function Grist(element, tier) {
this.element = element;
this.tier = tier;
this.state = 'item';
this.isExact = false;
};
Grist.Tier = Tier;
Grist.Element = Element;
// Hues are 0-255
// -1 means white, as special case
Grist.Types = {
build: new Element('build', 153),
agricultural: new Element('agricultural', 36),
intelligent: new Element('intelligent', 77),
energetic: new Element('energetic', 0),
primordeal: new Element('primordeal', 203),
universal: new Element('universal', -1)
};
Grist.Elements = [
Grist.Types.build,
Grist.Types.agricultural,
Grist.Types.intelligent,
Grist.Types.energetic
];
Grist.Primitives = [
Grist.Types.primordeal,
Grist.Types.universal
];
// 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)
};
Grist.Tiers.forEach = function(f) {
[Grist.Tiers.basic, Grist.Tiers.improved, Grist.Tiers.radiant].forEach(f);
}
Grist.forEach = function(f) {
Grist.Tiers.forEach(tier => {
Grist.Elements.forEach(element => {
f(new Grist(element, tier));
});
Grist.Primitives.forEach(element => {
f(new Grist(element, tier));
});
});
};
Grist.forEachBlock = function(f) {
Grist.Tiers.forEach(tier => {
Grist.Elements.forEach(element => {
f(new Grist(element, tier).block());
});
Grist.Primitives.forEach(element => {
f(new Grist(element, tier).block());
});
});
};
Grist.forEachFluid = function(f) {
Grist.Tiers.forEach(tier => {
Grist.Elements.forEach(element => {
f(new Grist(element, tier).fluid());
});
Grist.Primitives.forEach(element => {
f(new Grist(element, tier).fluid());
});
});
};
Grist.of = function(element, tier) {
return new Grist(Grist.Types[element], Grist.Tiers[tier]);
};
Grist.prototype.toString = function() {
return `Grist(${this.id()}, color: ${this.color()})`;
};
Grist.prototype.block = function() {
this.state = 'block';
return this;
};
Grist.prototype.fluid = function() {
this.state = 'fluid';
return this;
};
Grist.prototype.exact = function() {
this.isExact = true;
return this;
};
Grist.prototype.color = function() {
//return '#0d6aff';
if (this.element.hue == -1) {
return HSVtoRGB(0, 0, this.tier.colorValue);
} else {
return HSVtoRGB(this.element.hue/255.0, 1.0, this.tier.colorValue);
}
};
Grist.prototype.displayName = function() {
switch(this.state) {
case 'item': return `${this.tier.displayName()} ${this.element.displayName()} Grist`;
case 'fluid': return `Liquid ${this.tier.displayName()} ${this.element.displayName()} Grist`;
case 'block': return `Block of ${this.tier.displayName()} ${this.element.displayName()} Grist`;
}
};
Grist.prototype.key = function() {
switch(this.state) {
case 'item': return `grist_${this.element.name}_${this.tier.name}`;
case 'fluid': return `grist_${this.element.name}_${this.tier.name}_fluid`;
case 'block': return `grist_${this.element.name}_${this.tier.name}_block`;
}
};
Grist.prototype.tag = function() {
switch(this.state) {
case 'item': return `kubejs:grist/${this.element.name}/${this.tier.name}`;
case 'fluid': return `kubejs:grist/${this.element.name}/${this.tier.name}/fluid`;
case 'block': return `kubejs:grist/${this.element.name}/${this.tier.name}/block`;
}
};
Grist.prototype.elementalTag = function() {
switch(this.state) {
case 'item': return `kubejs:grist/${this.element.name}`;
case 'fluid': return `kubejs:grist/${this.element.name}/fluid`;
case 'block': return `kubejs:grist/${this.element.name}/block`;
}
};
Grist.prototype.tags = function() {
return [
'kubejs:grist',
this.tag(),
this.elementalTag()
];
};
Grist.prototype.id = function() {
return `kubejs:${this.key()}`;
};
Grist.prototype.toJson = function() {
if (this.isExact) {
switch(this.state) {
case 'item': return {item: this.id()};
case 'fluid': return {fluid: this.id()};
case 'block': return {item: this.id()};
}
} else {
switch(this.state) {
case 'item': return {tag: this.tag()};
case 'fluid': return {fluid: this.id()};
case 'block': return {tag: this.tag()};
}
}
};
Grist.prototype.itemTexture = function() {
return `malloc:item/grist_${this.tier.name}`;
};
Grist.prototype.blockTexture = function() {
return 'malloc:block/grist';
};
global.Grist = Grist;

View File

@ -0,0 +1,81 @@
StartupEvents.registry('fluid', e => {
// improved energetic progression
e.create('destabilized_grist')
.displayName('Destabilized Grist')
.bucketColor('#cb0dff')
.thickTexture('#cb0dff');
// radiant build progression
e.create('grist_alloy_fluid')
.displayName('Liquid Grist Alloy')
.bucketColor('#cb0dff')
.thickTexture('#cb0dff');
});
StartupEvents.registry('item', e => {
e.create('grist_essence').displayName('Grist Essence').rarity('rare');
// Intelligent progress
// Basic
e.create('insightful_tincture').displayName('Insightful Tincture').rarity('rare').textureJson({layer0:'minecraft:item/redstone_dust'}).color(0, Grist.of('build', 'basic').color());
e.create('insightful_blend').displayName('Insightful Blend').rarity('rare').textureJson({layer0:'minecraft:item/lapis_lazuli'}).color(0, Grist.of('build', 'basic').color());
e.create('sacred_flesh').displayName('Sacred Flesh').rarity('rare').textureJson({layer0:'minecraft:item/rotten_flesh'}).color(0, Grist.of('build', 'basic').color());
// Improved
e.create('intelligent_focus').displayName('Intelligent Focus').rarity('rare');
e.create('sapient_focus').displayName('Sapient Focus').rarity('rare');
e.create('imbued_source_gem').displayName('Imbued Source Gem').rarity('rare');
e.create('intelligent_catalyst').displayName('Intelligent Catalyst').rarity('rare');
// 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');
// Energetic progression
// Basic
e.create('grist_paste').displayName('Gristy Paste').rarity('rare').textureJson({layer0:'minecraft:item/redstone'}).color(0, Grist.of('energetic', 'basic').color());
// Improved
e.create('unstable_grist_capacitor').displayName('Unstable Grist Capacitor').rarity('rare').textureJson({layer0:'thermal:item/rf_coil'}).color(0, Grist.of('energetic', 'improved').color());
e.create('infused_grist_capacitor').displayName('Infused Grist Capacitor').rarity('rare').textureJson({layer0:'thermal:item/rf_coil'}).color(0, Grist.of('energetic', 'improved').color());
e.create('activated_grist_capacitor').displayName('Activated Grist Capacitor').rarity('rare').textureJson({layer0:'thermal:item/rf_coil'}).color(0, Grist.of('energetic', 'improved').color());
e.create('inert_grist_nugget').displayName('Inert Grist Nugget').rarity('rare').textureJson({layer0:'minecraft:item/iron_nugget'}).color(0, Grist.of('energetic', 'improved').color());
// Radiant
// Agricultural progression
// Basic
e.create('grist_chutney').displayName('Grist Chutney').rarity('rare').textureJson({layer0: 'croptopia:item/butter'}).color(0, Grist.of('agricultural', 'basic').color());
// Improved
e.create('spiced_grist_blend').displayName('Spiced Grist Blend').rarity('rare').textureJson({layer0: 'caupona:item/sugar_spice_jar'}).color(0, Grist.of('agricultural', 'improved').color());
e.create('grist_morsels').displayName('Grist Morsels').rarity('rare').textureJson({layer0: 'caupona:item/sugar_spice_jar'}).color(0, Grist.of('agricultural', 'improved').color());
e.create('grist_treats').displayName('Gristy Treats').rarity('rare').textureJson({layer0: 'caupona:item/sugar_spice_jar'}).color(0, Grist.of('agricultural', 'improved').color());
// Radiant
// Build progression
// Basic
e.create('coarse_grist_aggregate').displayName('Coarse Grist Aggregate').rarity('rare').textureJson({layer0: 'minecraft:item/iron_nugget'}).color(0, Grist.of('build', 'basic').color());
e.create('reduced_grist_aggregate').displayName('Reduced Grist Aggregate').rarity('rare').textureJson({layer0: 'minecraft:item/iron_nugget'}).color(0, Grist.of('build', 'basic').color());
e.create('refined_grist_aggregate').displayName('Refined Grist Aggregate').rarity('rare').textureJson({layer0: 'minecraft:item/iron_nugget'}).color(0, Grist.of('build', 'basic').color());
e.create('heavy_duty_gear_die').displayName('Heavy Duty Gear Die').textureJson({layer0: 'thermal:item/press_gear_die'}).color(0, Grist.of('build', 'improved').color());
// Improved
e.create('reinforced_grist_ingot').displayName('Reinforced Grist').rarity('rare').textureJson({layer0: 'minecraft:item/iron_ingot'}).color(0, Grist.of('build', 'improved').color());
e.create('reinforced_grist_nugget').displayName('Reinforced Grist Nugget').rarity('rare').textureJson({layer0: 'minecraft:item/iron_nugget'}).color(0, Grist.of('build', 'improved').color());
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');
});