[Feature Request]: Chipped Automation (with kubejs workaround)
jamuspsi opened this issue · 7 comments
Is your feature request related to a problem?
This is a bit of a duplicate request, but I'm hoping a better title will get better google coverage for the kubejs workaround.
It's terrible to craft chipped blocks in bulk, especially now that there's so many more block options. Scrolling each time and selecting for each stack is just plain tedious for survival players.
Solution(s)
Ideally, an FE-powered [set of] machines that remember block types (or use a template item to "copy") would be great.
Describe alternatives you've considered
I have, for now, put together a kubejs script that can be added to modpacks which dynamically creates unique recipes for each block. Modpack authors are free to use or modify these as they see fit.
This is compatible with forge 1.18, Chipped 2.0.1. It may very well work with other versions, though.
This will break if there's more than 255 of any individual chipped block (there aren't, by a ways, yet). It also depends on chipped's item tagging, which just coincidentally lines up right for this. Chipped's recipes don't show up in forEachRecipe, so I wasn't able to reverse it that way.
Each operation uses 1 "Chipped Flange". Some blocks will be cheaper to chisel in this way than others, apparently randomly, according to their number. Flanges are currently 1 torch and 1 iron nugget, shapeless, for a stack of 64. Recipes accept any chipped version of the block by default, but there's a spot in the script to change that if you want for some reason.
The image should go in kubejs/assets/kubejs/textures/item/chipped_flange.png
The scripts should go in kubejs/server_scripts and kubejs/startup_scripts appropriately.
chipped_craftable.startup.js
onEvent('item.registry', event => {
// Register new items here
event.create('chipped_flange').displayName('Chipped Flange');
});
chipped_craftable.server.js
// chipped crafting dyunamic recipes
// author: JamusPsi 2023-05-16
onEvent('recipes', event => {
// This can be anything, depending on how hard/easy you want it to be. Each operation costs one
// flange, but operations will chisel a variable number of blocks according to the recipe
// the flange could be made reusable/damagable/etc, but I chose not to do that for my own
// ease with Refined Storage.
event.shapeless(Item.of('kubejs:chipped_flange', 64), ['minecraft:torch', 'minecraft:iron_nugget']);
//pseudo: find all items that look like X_# in chipped mod, where X is in my list
// create a temp entry for each of them, with the source item, dest item, and index
// generate a bitwise crafting recipe for it, with quantity equal to count of set(1) bits
var chipped_tags = {};
var itemlist = Item.getList();
itemlist.forEach(i=>{
var item = i.getId();
i.getTags().forEach(tag=>{
if(/^chipped:/.test(tag)) {
if(!chipped_tags[tag]) {
chipped_tags[tag] = {
'tag': tag,
'items': [],
'nonchipped': [],
'chipped': [],
};
}
chipped_tags[tag].items.push(item);
if(/^chipped:/.test(item)) {
chipped_tags[tag].chipped.push(item);
} else {
chipped_tags[tag].nonchipped.push(item);
}
}
});
});
for(var tag in chipped_tags) {
var blob = chipped_tags[tag];
if(!blob.chipped.length || !blob.nonchipped.length) {
continue;
}
// console.log("We think that " + blob.nonchipped + " would chisel into " + blob.chipped);
for(var i = 0; i < blob.chipped.length; i += 1) {
var target = blob.chipped[i];
var no = target.match(/_(\d+)$/)[1];
no = new Number(no);
// now convert this into a set of bits (in opposite LSB order)
var bits = [0, 0, 0, 0, 0, 0, 0, 0];
bits[0] = no & 1 ? 1 :0;
bits[1] = no & 2 ? 1 :0;
bits[2] = no & 4 ? 1 :0;
bits[3] = no & 8 ? 1 :0;
bits[4] = no & 16 ? 1 :0;
bits[5] = no & 32 ? 1 :0;
bits[6] = no & 64 ? 1 :0;
bits[7] = no & 128 ? 1 :0;
// how many we produce
var produces = bits[0] + bits[1] + bits[2] + bits[3] + bits[4] + bits[5] + bits[6] + bits[7];
// here's my new recipe
event.shaped(Item.of(target, produces), [
'F' + (bits[0] ? 'B' : ' ') + (bits[1] ? 'B' : ' '),
(bits[2] ? 'B' : ' ') + (bits[3] ? 'B' : ' ') + (bits[4] ? 'B' : ' '),
(bits[5] ? 'B' : ' ') + (bits[6] ? 'B' : ' ') + (bits[7] ? 'B' : ' '),
], {
'F': 'kubejs:chipped_flange',
'B': ('#' + blob.tag), // you can rechip already chipped blocks of the same kind
// 'B': (blob.nonchipped[0]) // Use this instead to make only base blocks chippable
});
}
}
});
Mod Version
2.0.1
Mod Loader Version
1.18.2 - ?
Mod Loader
Forge
Additional context
No response
I hope this gets recognition it deserves, I've been wishing for automation with chipped
This is a major problem for me as well! Crafting tens of thousands of layed obsidian bricks is a pain.
+1 for this! Even something as simple as the workbenches holding more than one stack would be huge.
Even if chipped didn't add a machine to do this itself, compatibility with AE2's stonecutting patterns would be a huge improvement.
I would really appreciate this feature, as a builder it's really a pain in the *ss to do big projects with chipped blocks because it's so annoying to craft in bulk
Someone created a resource pack to address this using Create mod (and has a link to older iterations of it as well), for anyone who want's a patch solution.
https://www.curseforge.com/minecraft/texture-packs/create-chipped-cutting