TheosCreation / CreateCompression

MIT License
1 stars 1 forks source link

Bug: 1x compressed blocks have inconsistent in- & outputs #9

Open RaeTheGit opened 5 months ago

RaeTheGit commented 5 months ago

MC Version: 1.20.1 NeoForge version: 47.1.105 Mod version: 1.20.1-1.8.1 (most recent release for 1.20.1 on Modrinth)

As said in the title, when extracting a 1x compressed raw ore block (gold, copper, iron), which is crafted with 9 raw ore blocks, it extracts to 9 ore items instead of the blocks.

For others running into this issue, my workaround is this KubeJS server script until the bug is fixed:

ServerEvents.recipes(event => {
    // fix 1x compressed ore blocks
    let fix1xExtraction = (oreMaterial) => {
        var thisInputItem = 'createcompression:compressed_raw_' + oreMaterial + '_1x';
        var thisOrigOutput = 'minecraft:raw_' + oreMaterial;
        var thisNewOutput = 'minecraft:raw_' + oreMaterial + '_block';
        event.replaceOutput(
            { input: thisInputItem, output: thisOrigOutput },
            thisOrigOutput,
            thisNewOutput
        );
    };

    [
        'gold',
        'copper',
        'iron'
    ].forEach((oreMaterial) => fix1xExtraction(oreMaterial));
});
RaeTheGit commented 5 months ago

Same goes for 1x compressed grass blocks which decompresses to grass, not grass blocks. Also compressing any cobbled stones to compressed cobblestone may not be best practice. IMO that should be limited to actual minecraft:cobblestone only.

The-furf-of-July commented 4 months ago

Can confirm both of the above

The-furf-of-July commented 4 months ago

1.8.2 of this mod is not uploaded to Modrinth, only CurseForge

RaeTheGit commented 4 months ago

For convenience of fellow Modrinth users, here's the tested, full KubeJS server script I use to fix the recipes until a fixed version lands on Modrinth.

Fixes input for

Fixes output for 1x compressed

ServerEvents.recipes(event => {

    // fix various compression recipes

    let fix1xVariousVanilla = (itemType) => {
        var thisOutput = 'createcompression:compressed_' + itemType + '_1x';
        var thisOrigInput = '#forge:' + itemType;
        var thisNewInput = 'minecraft:' + itemType;
        event.replaceInput(
            { input: thisOrigInput, output: thisOutput},
            thisOrigInput,
            thisNewInput
        );
    };

    [
        'obsidian',
        'glass',
        'cobblestone'
    ].forEach((itemType) => fix1xVariousVanilla(itemType));

    let fix1xLogs = (logType) => {
        var thisOutput = 'createcompression:compressed_' + logType + '_log_1x';
        var thisOrigInput = '#minecraft:' + logType + '_logs';
        var thisNewInput = 'minecraft:' + logType + '_log';
        event.replaceInput(
            { input: thisOrigInput, output: thisOutput},
            thisOrigInput,
            thisNewInput
        );
    };

    [
        'acacia',
        'birch',
        'dark_oak',
        'jungle',
        'oak',
        'spruce'
    ].forEach((logType) => fix1xLogs(logType));

    let fix1xStems = (stemType) => {
        var thisOutput = 'createcompression:compressed_' + stemType + '_stem_1x';
        var thisOrigInput = '#minecraft:' + stemType + '_stems';
        var thisNewInput = 'minecraft:' + stemType + '_stem';
        event.replaceInput(
            { input: thisOrigInput, output: thisOutput},
            thisOrigInput,
            thisNewInput
        );
    };

    [
        'crimson',
        'warped'
    ].forEach((stemType) => fix1xStems(stemType));

    // fix various decompression recipes

    let fix1xOreExtraction = (oreMaterial) => {
        var thisInputItem = 'createcompression:compressed_raw_' + oreMaterial + '_1x';
        var thisOrigOutput = 'minecraft:raw_' + oreMaterial;
        var thisNewOutput = 'minecraft:raw_' + oreMaterial + '_block';
        event.replaceOutput(
            { input: thisInputItem, output: thisOrigOutput },
            thisOrigOutput,
            thisNewOutput
        )
    };

    [
        'gold',
        'copper',
        'iron'
    ].forEach((oreMaterial) => fix1xOreExtraction(oreMaterial));

    event.replaceOutput(
        { input: 'createcompression:compressed_grass_1x', output: 'minecraft:grass'},
        'minecraft:grass',
        'minecraft:grass_block'
    );

});