MyM-ModpackTeam / hypovolemia

HQM - Magic Modpack with a technical hint
http://forum.feed-the-beast.com/threads/161490/
18 stars 8 forks source link

Redstone recipe #357

Closed stijn04356789 closed 7 years ago

stijn04356789 commented 8 years ago

With the new update players are no longer able to make red stone in multiplayer however they can in SP

krakel commented 8 years ago

The recipe for redstone and other was removed to a directory disabled. https://github.com/MyM-ModpackTeam/hypovolemia/commit/d42a8685f49dc84d1995aed4de4c63059ab75b7d

scripts\AAA_vars_and_oreDicts\AA_vars.zs (1 hit)
    Line 182: global redstone = <minecraft:redstone_block>;
scripts\disabled\bloodmagic.zs (1 hit)
    Line 82: mods.bloodmagic.Altar.addRecipe(<AWWayofTime:weakBloodOrb>,<minecraft:redstone_block>, 1,10000,5,5);
scripts\disabled\vanilla.zs (1 hit)
    Line 9: recipes.addShapeless(<minecraft:redstone_block>, [<minecraft:lava_bucket>, <ore:sand>]);
tyler489 commented 8 years ago

thats the old scripts

krakel commented 8 years ago

Now I understand the problem. They would order all recipes and expact ModTweaker load all scrips at alphabetical order. But the mod did not do this, I think. A long time ago I intended a change on the old MineTweaker (simple Arrays.sort(files); ). ModTweaker got the same problem.

  scripts\AAA_vars_and_oreDicts\AA_vars.zs (2 hits)
    Line 182: global redstone = <minecraft:redstone_block>;
    Line 660: global redstoneDust = <minecraft:redstone>;
  scripts\BloodMagic\Alchemy.zs (2 hits)
    Line 70: addRecipe(brewRaising*3, [woolBat,oilVitiol,mutandis,<minecraft:bone>,<minecraft:redstone>], 3,5000);
    Line 90: addRecipe(soupRedstone*1, [tongueDog,luckDrop,mandrakeRoot,woolBat,<minecraft:redstone>], 3,5000);
  scripts\BloodMagic\Altar.zs (1 hit)
    Line 39: addRecipe(orbWeak,redstone, 1,10000,5,5);
  scripts\Botania\altar.zs (1 hit)
    Line 5: addRecipe(orechid, [leadIngot, diagem, emeraldgem, aluIngot, nickelIngot, minicioEssence, amberGem, silverIngot, tinIngot, quicksilver, copperIngot, chargedCertus, shardBalanced, goldIngot, ironIngot, redstone], 50000);
  scripts\disabled\witchery.zs (2 hits)
    Line 31: mods.bloodmagic.Alchemy.addRecipe(<witchery:ingredient:65>*3, [<witchery:ingredient:24>,<witchery:ingredient:30>,<witchery:ingredient:14>,<minecraft:bone>,<minecraft:redstone>], 3,5000);
    Line 51: mods.bloodmagic.Alchemy.addRecipe(<witchery:ingredient:40>*1, [<witchery:ingredient:25>,<witchery:ingredient:39>,<witchery:ingredient:22>,<witchery:ingredient:24>,<minecraft:redstone>], 3,5000);
  scripts\Vanilla\CraftingShaped.zs (8 hits)
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
    Line 11: recipes.addShaped(bloodDynamo, [[redstone, redstone, redstone], [redstone, altar, redstone], [redstone, redstone, redstone]]);
  scripts\Vanilla\CraftingShapeless.zs (1 hit)
    Line 8: recipes.addShapeless(redstone, [lavabuck, sandOredict]);

The recipe exists (last line), but the AAA_vars_and_oreDicts was not loaded befor Vanilla.

tyler489 commented 8 years ago

A we are using crafttweeker B every thing else in vanilla shapeless loaded

krakel commented 8 years ago

Oh wunderfull, CraftTweaker is a fork of MineTweaker3. For MineTweaker3 I was asking for the directory sorting: https://github.com/stanhebben/MineTweaker3/issues/270 . Wenn I inspect on CraftTweaker the file minetweaker/runtime/providers/ScriptProviderDirectory.java i found the same missing handling for sorting the directory.

public Iterator<IScriptIterator> getScripts() {
        List<IScriptIterator> scripts = new ArrayList<IScriptIterator>();
        if (directory.exists()) {
// <--- missing Array sorting
            for (File file : directory.listFiles()) {
                if (file.isDirectory()) {
                    scripts.add(new ScriptIteratorDirectory(file));
                } else if (file.getName().endsWith(".zs")) {
                    scripts.add(new ScriptIteratorSingle(file));
                } else if (file.getName().endsWith(".zip")) {
                    try {
                        scripts.add(new ScriptIteratorZip(file));
                    } catch (IOException ex) {
                        MineTweakerAPI.logError("Could not load " + file.getName() + ": " + ex.getMessage());
                    }
                }
            }
        }
        return scripts.iterator();
    }
johnfg2610 commented 8 years ago

were not actuly using normal craft tweaker were using a fork of craft tweaker

kindlich commented 8 years ago

Okay, before barking about how the directories aren't working porperly (which they obviously are!) let's take another look at our CT version, will we?

Like John just commented, we're using a custom Version of CT (Hence the name 'custom' that was added a few days ago), that supports folders and global variables while keeping all of the other MT features! It was originally designed by techlone, who has discontinued it without making a PR to jareDll, so we combined them both on a local repo and assembled it. That way we can both test it and ensure it's working so the PR can go without too many isssues!

And about the 'disabled' folder: Techlone specifically declared folders named 'disabled' to be ignored, and if you read my commit notice on that commit, you'd understood that those were the old script files that were there before I rewrote everything, I just kept them in case something major was to mess up....

Those files are technically not there!

In case you want to take a closer look at our version, on my repo is one that is almost the same as the one we're using (our Version just has "customized" in the mcmod.info files): https://github.com/kindlich/CraftTweaker

krakel commented 8 years ago

I want only help! Ok, I inspect the source at kindlich Github. He used a modified version of MineTweaker, especially the minetweaker/runtime/providers/ path. But there are the same sorting problem. Windows sort the file on a directory and the java function directory.listFiles() produce a alphabetical sorted list of all files. But I think Linux don't do it. So all SP on Windows works well and some MP with a Linux Server not. Always sort the file list is the best choice.

My recommendation for the minetweaker/runtime/providers/ScriptIteratorDirectory.java

    private static void iterate(File directory, List<File> contentsList) {
        File[] files = directory.listFiles();
        if (files == null) return;
        java.util.Arrays.sort(files); // <-- sorting based on Comparable natural ordering
        for (File file : files) {
            if (file.isDirectory() && !file.getName().equals("disabled")) {
                iterate(file, contentsList);
            } else if (file.isFile() && file.getName().endsWith(".zs")) {
                contentsList.add(file);
            }
        }
    }
kindlich commented 8 years ago

Ok, first of all: Are we still talking about the Redstone Recipe missing?!? Because if we are, we have a temporary workaround: Connect to the Server, then Disconnect and the next time you connect all recipes are shown correctly until you restart your client.

kindlich commented 8 years ago

However, since we do have some Problems with linux Servers atm I'm setting up a VM with ubuntu to test some stuff, then I'll tell ya the loading order.

krakel commented 8 years ago

We discuss about the redstone. Thanks for the workaround.

A last word on the order of files on directory.listFiles(). From the https://docs.oracle.com/javase/8/docs/api/java/io/File.html

section listFiles

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

kindlich commented 8 years ago

@krakel Even though your comment about the sorting had nothing to do with this problem here, it helped with some other problems the linux mym-server had!

Gonna add that to mym soon, thx :+1:

krakel commented 8 years ago

@kindlich Yes, on my test I saw only the redstone recipes was broken. Sorry for the not matched discussion. In german: manchmal gehen die Pferde mit einem durch! I love this pack and have no problem to restart the game, but the errors should be reduced over the time. And sorry for my horrible english. :)

kindlich commented 8 years ago

Made a new issue for the Synching problem:

359

johnfg2610 commented 7 years ago

should be fixed i belive