Description
Every Compat can fill in the gaps that often exist in large modpacks, though this is at the cost of a lot of RAM as it puts a heavy load on the registry and your system. This mod takes a different approach to completeness. Instead of one block ID per entry, this mod uses NBT data to store as few blocks in registry as possible and stores the textures within said NBT data or use alpha mapping to recreate the look out of existing textures.
This massivly reduces load on the server and client, only needing the memory to generate the textures. For a reference as to how much more RAM friendly this is, take a look at Productive Trees and the dyed planks support that this mod adds. A item or block in registry takes about 2KB of RAM. Productive Trees adds ~160 wood types to the game. With the 16 vanilla colors, you'd end up with 23040 blocks in the registry from Productive Tress if every compat did dyes. That would take up about 46 MB of RAM, vs the 18KB this would take. This mod only registers 16 blocks to the game, the rest is handled by NBT data and texture generation. But that same texture generation causes other issues as well, it can overfill the atlas or even your system's memory beyond what you've set. To get around this, we store block color for the dyed planks, cobbles, sands, gravels, and the chipped stone blocks in the block's NBT. For logs, create casings, and bookcases, we use uv mapping from existing textures. Crafting tables currently don't do any of this.
At current, this supports:
Vanilla: (crafting tables, bookshelves, cobblestones, gravels, sands)
Create: (casings (metal X wood combos), recipes for millstone and crushing wheels)
Chipped: (non CTM stone blocks, log variants + 2 custom ones with nether woods, compat with dyed wood for the doors)
custom: (dyed wood sets (planks, fences, doors, trapdoors, buttons, and pressure plates), loot table overrides for cobblestones, world gen for gravels, smelting recipes for cobbles)
Macaw's series: (roofs and roof tiles at current)
Mekansim: (recipes for the crusher)
You can define custom woods, metals, stones, and dyes with kubeJS like so (startup script):
NbtCompatEvents.defineWoods(event => {
event.add('modid:wood', 'modid:wood_planks')
event.add('modid:wood', 'modid:wood_planks', 'Pretty Name')
event.remove('minecraft:bamboo')
})
NbtCompatEvents.defineMetals(event => {
event.add('createmoremachines:netherite_alloy', {
ingot: 'createmoremachines:netherite_alloy',
block: 'createmoremachines:netherite_alloy_block', // preferred for trim textures
nugget: 'createmoremachines:netherite_alloy_nugget',
name: 'Netherite Alloy'
})
// shorthand
event.add('modid:steel', 'modid:steel_ingot', 'modid:steel_block')
event.remove('minecraft:gold')
})
NbtCompatEvents.defineStones(event => {
event.add('mymod:slate', 'mymod:slate_rough', 'Slate')
event.add('mymod:slate', {
stone: 'mymod:slate_rough',
cobble: 'mymod:slate_cobbled', // skip NBT cobble when set
gravel: 'mymod:slate_gravel',
sand: 'mymod:slate_sand',
name: 'Slate'
})
event.remove('minecraft:netherrack')
})
NbtCompatEvents.defineDyes(event => {
event.add('kubejs:neon', 'kubejs:neon_dye', 0xff00aa, 'Neon')
})
You can also edit the recipe generation like in this example. Artisian worktables is optional (server script):
NbtCompatEvents.defineRecipes(event => {
const hasArtisan = Platform.isLoaded('artisanworktables')
if (hasArtisan) {
event.craftingTable()
.shaped(
['AB', 'CA'],
{
A: 'wood:planks',
B: 'artisanworktables:wood_handsaw',
C: 'minecraft:flint'
}
)
} else {
event.craftingTable()
.shaped(['AA', 'AA'], { A: 'wood:planks' })
}
const bookshelf = event.bookshelf()
.shaped(
['PPP', 'BBB', 'PPP'],
{
P: 'wood:planks',
B: 'minecraft:book'
}
)
if (hasArtisan) {
bookshelf.artisan('carpenter').removeCrafting()
}
const dyedPlanks = event.dyedPlanks()
.shaped(
['PPP', 'PDP', 'PPP'],
{
P: 'wood:planks',
D: 'dye'
}
)
if (hasArtisan) {
dyedPlanks
.artisan('carpenter')
.tool('#artisanworktables:tools/handsaw', 1)
.removeCrafting()
}
const dyeFurniture = (builder) => {
if (hasArtisan) {
builder.artisan('carpenter').removeCrafting()
}
}
dyeFurniture(event.dyedStairs()
.shaped(['# ', '## ', '###'], { '#': 'dyed:planks' }))
dyeFurniture(event.dyedSlab()
.shaped(['###'], { '#': 'dyed:planks' }))
dyeFurniture(event.dyedFence()
.shaped(['W#W', 'W#W'], { W: 'dyed:planks', '#': 'minecraft:stick' }))
dyeFurniture(event.dyedFenceGate()
.shaped(['#W#', '#W#'], { W: 'dyed:planks', '#': 'minecraft:stick' }))
dyeFurniture(event.dyedDoor()
.shaped(['##', '##', '##'], { '#': 'dyed:planks' }))
dyeFurniture(event.dyedTrapdoor()
.shaped(['###', '###'], { '#': 'dyed:planks' }))
dyeFurniture(event.dyedPressurePlate()
.shaped(['##'], { '#': 'dyed:planks' }))
dyeFurniture(event.dyedButton()
.shaped(['#'], { '#': 'dyed:planks' }))
})
// Hard-coded minecraft:crafting_table / bookshelf → convention tags (include nbtcompat via mod datapack).
ServerEvents.recipes(event => {
event.replaceInput({}, 'minecraft:crafting_table', '#c:player_workstations/crafting_tables')
event.replaceInput({}, 'minecraft:bookshelf', '#c:bookshelves')
})

