I have been trying to find a way online to find any way to modify existing blocks in minecraft fabric and there properties, and yet all I could find was how to create new blocks. Any that I do find a for versions below 1.20.
I aactually could not find a way to override existing block properties at all.overriding did not work either
What you essentially want to do is re-register a
Blockinstance that Minecraft already registered. But there is a reason why nobody ever documented how to do that: you shouldn't.Re-registering a block in Minecraft can cause to weird issues, especially when your mod will be used in large mod packs. This has to do with compatibility with other mods, and even Minecraft itself. Preferably, you want to avoid that. There are a dozen other solutions to alter the behaviour of a specific block without causing too much issues. They include but aren't limited to:
minecraft:stoneanageproperty (for whatever reason that may be useful), treatminecraft:stoneasage=0and create a custom block (e.g.modid:aged_stone) with anageproperty from1to whatever max age to extend the age range.Another, more generic approach is building a Mixin into the
Blockclass or an appropriate subclass, and do something like the following to target a specific block (stone in this case):However, if you really really really wanna replace a block instance entirely, here's a suggestion: Use a Mixin to inject in
Registry.registerthat replaces a specific block instance with a custom one:But once again, try to avoid this solution. Here be dragons.
Note, I have not tested any of the code fragments because I don't have a modding environment at hand at the time of writing. It may need tweaking in order to work. Also, I used Mojang's official mappings, things may be named differently if you use Yarn mappings. For example,
ResourceLocationis namedIdentifierin Yarn.I hope this helps. Happy coding!