Compatibility
Minecraft: Java Edition
Platforms
75% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Creators
Details
Plugin Synopsis
This is a lightweight plugin run on server-side, which allows you to refuse certain crafting operations from client-side.
How to Use This Plugin
Loading world with this plugin loading, this plugin will not actively modify anything. You need to create and edit a file named craftden1al.json
(case sensitive on Linux) in the root directory of the world (i.e. in the same directory as level.dat
).
Example of craftden1al.json
: (“//” comments for ease of understanding, actual JSON files do not allow comments)
{
"deny_mode": false, // defaults 'true'; 'true' for deny mode and 'false' for allow mode; accepts: 'true' | 'false'
"patterns": [
[
{
"type": "rege_s_simple_datapack:all", // a string represents a condiion type, registered in rege.rege.minecraftmod.craftden1al.util.ConditionRegistry
"data": [] // any element, depends on the type's requirement
}, // an object represents a conditional match, or 'null' represents an unconditional match; accepts: an object | 'null'
[
"minecraft:string", // a string(available on MC 1.7+) represents the resource location of the item, or a number represents the raw ID of the item, or an object(see below) represents a more detailed item, or 'null' represents an empty slot
"minecraft:string", // the same as the previous line
"minecraft:string", // the same as the previous line
"minecraft:string" // the same as the previous line
], // an array represents a shaped or shapeless recipe's ingredients, or 'null' represents that the ingredients are unimportant
{
"id": "minecraft:wool", // a string(available on MC 1.7+) represents the resource location of the item, or a number represents the raw ID of the item
"dv": 0, // a number represents the DV(Damage Value) of the item
"count": 1 // a number represents the count of the result item; won't be useful in ingredients' definitions
}, // a string(available on MC 1.7+) represents the resource location of the result item, or a number represents the raw ID of the result item, or an object represents a more detailed result item, or 'null' represents that the result item is unimportant
2, // an integer represents the width of the shaped recipe, or null represents that the width of the shaped recipe is unimportant; if both this and next element is absent, it represents that whether the recipe to match is shaped or not is unimportant
2 // an integer represents the height of the shaped recipe, or null represents that the height of the shaped recipe is unimportant; if this element is absent and the previous element is present, it represents that the recipe to match is shapeless
]
] // defaults '[]'; an array represents all recipe patterns to match
}
So, after editing the file and restarting the server / re-entering the world, the client player will find they are only able to craft 1 White Wool with 4 Strings, and when trying to craft other recipes, even though the result item is displayed on the right side of the crafting screen, when trying to take out the item, it will “bounce back”, thus refusing to craft certain recipes.
Notice
Please refer to the Minecraft Wiki's history for recipe lists, and the width and height of the shaped crafting patterns are strictly “source-code-based”.
For example, the width and height of Diamond Axe's are 2 and 3, not 3 and 3; and must be ["minecraft:diamond", "minecraft:diamond", "minecraft:diamond", "minecraft:stick", null, "minecraft:stick"]
, not its horizontal-mirrored form (i.e. ["minecraft:diamond", "minecraft:diamond", "minecraft:stick", "minecraft:diamond", "minecraft:stick", null]
).
If you are not able to view the source code, the best way is to write both to the pattern.
FAQ
Q: Is it useful to run this mod on the client-side?
A: Client-side loading of this mod is useful for entering singleplayer worlds. It takes no effect for entering multiplayer games. Whether it takes effect depends on whether this mod is loaded on the server side.
Q:Seems that the pattern defined in craftden1al.json
did not being loaded?
A:Please check whether the content of craftden1al.json
conforms to the syntax of JSON (pay special attention to the presence or absence of commas, whether the symbols are halfwidth, and no comments allowed). If there is a syntax error, the game log will show Incorrect JSON syntax of craftden1al.json, giving up loading: reason
. As well as confirming that the key names are spelled correctly (e.g. patterns
is written as pattern
causing no patterns to load), and that the recipe list is incorrect.
Q: In Creative Mode, I can press a number key to move an item from the result item slot out without bouncing it back?
A: This is a feature of Creative Mode, this won't happen in Survival/Adventure Mode.
Q: Will craftden1al.json
be overwritten because it contains invalid item IDs, etc.?
A: No. This plugin will only read the file, not write to it.