Closed Yeetmister closed 2 years ago
The item section here: https://github.com/Globox1997/LevelZ#4-item tells that "item" without a "material" can only have certain values but your goal is to lock a material behind a level which means: ´ "item" : "minecraft:sword", "material" : "blue_netherite" ´ "material" has to get the correct name string, idk if blue netherite is correct, just a guessing
Does that mean, that basicly every sword added is registered as "minecraft:sword"? Wondering because I wanted to add "flintytools" ?
Yes exactly. LevelZ doesn't check for single items (except for a few), it reads just the material
And would it be possible to add this feature for modded items? Because the problem with material is that it is not precise (for example, a Drill that uses diamond will be at the same level as a diamond pickaxe which is a bit annoying).
With update 1.1.0 datapack creators will be able to lock other mods items/blocks/entities, explained in the readme. It will come out for mc 1.18 :)
You just made a man very happy with this addition, thank you!
hello i'm trying to make a data pack to lock the rosegold set of tool and armor of additional addition and following the Readme { "replace": false, "skill": "mining", "level": 12, "block": "minecraft:custom_item", "object": "additionaladditions:rose_gold_pickaxe" } is what I did for one of theme, but it doesn't seem's to work sorry if it seem's like a stupid question but am I doing something wrong? (I moddified vanilla asset to test and it work) edit: I'm using ver. 1.1.1
doesn't look bad but tools/swords have to get looked via the material like:
{
"replace": false,
"skill": "mining",
"level": 12,
"item": "minecraft:tool",
"material": "??rose_gold??"
}
the material string has to be correct, don't know what it is for the mod
But I don't understand, why not make it work for the other tools as well (axe, pickaxe, etc...). Whether it's the Rose Gold tools (material in the code of the mod: rosegold) or the TechReborn tools, it simply does not work.
{ "replace": true, "skill": "mining", "level": 24, "item": "minecraft:tool", "material": "industrial" }
"tool" equals here pickaxes and shovels, swords, hoes and axes are separated as the readme says. the industrial drill has the diamond tool material so it is bound to it, you can see it here at the constructor https://github.com/TechReborn/TechReborn/blob/1.18/src/main/java/techreborn/items/tool/industrial/IndustrialDrillItem.java
I was able to make the armor set to work with
{ "replace": false, "skill": "defense", "level": 12, "item": "minecraft:armor", "material": "rose_gold" }
but for the tool/axe/hoe/sword the using the material line doesn't seem's to work, maybe someting with how the mod AA is built so I was planning on using the custom item restriction method for them but it doesn't work
"tool" equals here pickaxes and shovels, swords, hoes and axes are separated as the readme says. the industrial drill has the diamond tool material so it is bound to it, you can see it here at the constructor https://github.com/TechReborn/TechReborn/blob/1.18/src/main/java/techreborn/items/tool/industrial/IndustrialDrillItem.java
This is very annoying, especially since in the example of the Drill. Even if it was not linked to the Diamond material, it would not be very logical to see "Industral Tool" in the UI of the mod knowing that the Drill does pickaxe + shovel at the same time.
By the way, the rendering is a bit weird for the items that work with your new system (which is still interesting, thanks for adding it)
I was able to make the armor set to work with
{ "replace": false, "skill": "defense", "level": 12, "item": "minecraft:armor", "material": "rose_gold" }
but for the tool/axe/hoe/sword the using the material line doesn't seem's to work, maybe someting with how the mod AA is built so I was planning on using the custom item restriction method for them but it doesn't work
Custom item restriction doesn't work for tools and from which mod is the rose gold material?
"tool" equals here pickaxes and shovels, swords, hoes and axes are separated as the readme says. the industrial drill has the diamond tool material so it is bound to it, you can see it here at the constructor https://github.com/TechReborn/TechReborn/blob/1.18/src/main/java/techreborn/items/tool/industrial/IndustrialDrillItem.java
This is very annoying, especially since in the example of the Drill. Even if it was not linked to the Diamond material, it would not be very logical to see "Industral Tool" in the UI of the mod knowing that the Drill does pickaxe + shovel at the same time.
By the way, the rendering is a bit weird for the items that work with your new system (which is still interesting, thanks for adding it)
I don't get the first point, does a drill work as a shovel and pickaxe? The screenshot looks like the name string doesn't get read correctly How is the rendering weird? What exactly happens?
When I said "rendering" it was meant: it's read strangely (everything is correct in the file). For the first point, yes
the rose gold is from additional addition https://github.com/Dqu1J/additionaladditions
And I second what Khytwel said about the ''rendering'' when you add a custom block in the UI it give modid:blockid [ex:harvest scythes:wooden machete] it should just show blockid for this exemple wodden machete
So the rose gold item restriction won't work cause levelz can't read the correct material name :/ Vanilla mc has an enum instead of separating all materials into classes. here https://github.com/Dqu1J/additionaladditions/blob/main/src/main/java/dqu/additionaladditions/material/RoseGoldToolMaterial.java
It is interesting that the scythe mod doesn't add its scythes to the fabric hoe tag cause those are instances of hoes. If it would be in the hoe tag, custom restriction wouldn't work and they would be bound to the hoe restriction (depends on material)
So there are three ways to fix the rosegold tool material issue:
So there are three ways to fix the rosegold tool material issue:
- The dev has to change the material to an enum
- The dev can override the toString method inside his material class like here https://github.com/GitPois1x/DragonLoot/blob/master/src/main/java/net/dragonloot/item/DragonToolMaterial.java
- The specific fabric tags have to get overwritten by a datapack and custom restrictions have to get applied
What about restricting the item in general without needing the material tag? - For me personally it overcomplicates things or is this a general restriction that you bypass using the materials?
Like if one would restrict the item it would be cool if we could just follow the same rules everywhere:
"replace" "skill" "level" "block/item" (inserting just the mod:id here?)
I guess I just oversimplify it right now :s
For example I would like to restrict "quivers" behind archery. Or swords from "betternether" which do not have the swords tag.
I've tried the datapack situation but actually could not get it to work - essentially what makes this a little difficult is that mods like paxi and openloader can not override that standard fabric tags making it definitly a little harder for modpacks (also they are not yet available for 1.18)
It is interesting that the scythe mod doesn't add its scythes to the fabric hoe tag cause those are instances of hoes. If it would be in the hoe tag, custom restriction wouldn't work and they would be bound to the hoe restriction (depends on material)
Indeed, I had not noticed. I removed the tags from the drill to test and it works. The only current problem I have is that the drill is not marked in the GUI, but this can be solved by creating a fake tool file with the drill name as material.
Edit: Small problem, the custom item for the mining category, the necessary level information is put in the farming category (in the screenshot example, the drill and jackhammer should not be present). Same for the custom sword.
Edit++: When we do not have the necessary level for a custom item, we can still use it and no malusse is applied.
The answer why levelz takes the material for such items is, I made it as performant as possible. Of course some mods need tweaks for that cause they don't stick to the vanilla code style but that is the compromise. Those new custom restrictions are not as performant especially for tools (cause they get checked multiple times in a second when used) cause at the end all non custom restrictions have their own list to get checked if the player has the required level, all custom restrictions are filled in one list and when they get used, the server and or client has to go trough the whole list and look if it exist and if the player meets the required levels.
And your answer is quite justified, especially when it works directly with some mods. On my side, I will contact the mods developers to support the material properly. On the other hand, some tools are not necessarily adapted with the material system.
Yes some tools are not adapted but that is the performance compromise. So I could add the custom check for tools but I'm not sure if this is a good idea.
https://github.com/Technici4n/TechReborn/blob/custom-tool-materials/src/main/java/techreborn/init/TRToolMaterials.java Here is their change to support LevelZ. On the other hand, even if the tool is blocked it still does damage (so the malus is not applied). According to their developer they can't do much because they use their own system.
The material is "techreborn:advanced_drill", would there be a way for the tool to be read correctly?
@Globox1997 - thanks for taking the time explaining the issues. You are really responsive and Its great you still answer these questions. - I was thinking about somewhat to abstract solutions to the problem..
I've had requests to make my mods compatible with this, so I have set up my tool materials as done in the TechReborn mod above. What would I have to do next to lock the tools and armors? EDIT: Just read the part about adding them in, but does it go in my save folder; then data? or datapacks, then another folder called data?
I recommend to check out Data pack and also an existing datapack. in the "datapacks" folder you have to put your zip file and inside the zip file, the top folder is the "data" folder
@jexline so tha path is when you open your zip file: data/levelz/item/examplefile.json
Since v1.2 (not sure but the latest is definitely right) you can even use "item": "minecraft:custom_item"
for restricting items but I always recommend to use the material for restriction, sometimes this won't work for example if a mod doesn't use an enum for materials.
I have gotten a datapack to work with vanilla items, but cannot get it to work with modded items, I am entering everything from what it seems correctly.
datapacks\itemleveledit\data\levelz\item\bluenetheritesword.json
{ "replace": true, "skill": "strength", "level": 20, "item": "dyeablenetherite:blue_netherite_sword" }
I have tried other weapons & items including those from an entirely different mod to no avail.