CleanroomMC / CraftingTweaks

Forked Crafting Tweaks with less bugs and much more compatibility
https://blay09.net/mods/craftingtweaks
MIT License
1 stars 1 forks source link

Crafting Tweaks

A continuation of CraftingTweaks intended to fix bugs and add much more mod compatibility

IMC API

Most crafting grids can be registered using the IMC API.

In order to register your container for Crafting Tweaks, send an IMC message as follows:

NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setString("ContainerClass", YourCraftingContainer.class.getName());

// tagCompound.setInteger("ValidContainerPredicate", YourContainerPredicate.class.getName()); // requires RegisterProviderV3 or higher
// tagCompound.setInteger("GetGridStartFunction", YourGridStartFunction.class.getName()); // requires RegisterProviderV3 or higher

// tagCompound.setInteger("GridSlotNumber", 1);
// tagCompound.setInteger("GridSize", 9);
// tagCompound.setBoolean("HideButtons", false);
// tagCompound.setBoolean("PhantomItems", true);

// tagCompound.setInteger("ButtonOffsetX", -16); // ignored if AlignToGrid is set
// tagCompound.setInteger("ButtonOffsetY", 16); // ignored if AlignToGrid is set
// ***** OR *****
// tagCompound.setString("AlignToGrid", "left");

// NBTTagCompound tweakRotate = new NBTTagCompound();
// tweakRotate.setBoolean("Enabled", true);
// tweakRotate.setBoolean("ShowButton", true);
// tweakRotate.setInteger("ButtonX", 0); // ignored if AlignToGrid is set
// tweakRotate.setInteger("ButtonY", 18); // ignored if AlignToGrid is set
// tagCompound.setTag("TweakRotate", tweakRotate);
// [...] (same structure for "TweakBalance" and "TweakClear")

FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", tagCompound);
// or FMLInterModComms.sendMessage("craftingtweaks", "RegisterProviderV3", tagCompound); if using V3 features

The commented out lines are optional (the example above shows the default value).

The fields are described below:

Note: If you're specifying custom button positions, they should be 18 pixels apart from each other. If you simply want the buttons next to the crafting grid, use AlignToGrid. If you just want to move all buttons at once, use ButtonOffsetX/Y. The buttons are set out vertically by default.