-
Notifications
You must be signed in to change notification settings - Fork 58
CraftTweaker Stone Types
import mods.gtadditions.recipe.Utils;
mods.gtadditions.recipe.Utils.registerStoneType("net.minecraft.init.Blocks", "DIAMOND_BLOCK", 14, "pickaxe", "diamond_block");
The method registerStoneType(String className, String fieldName, int id, String tool, String name)
takes 5 inputs, the name of the class where the block is declared, the name of the field, the ID of the stone type in the stone type registry, the tool and the internal name of the stone type.
This is a fairly advanced method and if you need any help ask hjae#7876 in the Gregicality discord. If you were to register a stone type and at some point remove it this WILL CORRUPT your world. Finding the class where the block is declared isn't that complicated in most cases. I will give two examples.
In the code example I am using the Diamond Block as the base and it is declared in the Minecraft sourcefile Blocks.java. If we look at the source of it we see that it is packaged under net.minecraft.init
This means that the final name of the class will be net.minecraft.init.Blocks
. If we scroll down in this file and look for where the Diamond Block is declared we find
We can see that DIAMOND_BLOCK
is our field name.
The available IDs for stone types are 14-127. 0-13 are taken by GTCE and the internal stone type registry has a limit on 128 types.
The tool string can be "pickaxe", "shovel" etc. I'm not entirely sure the exact range of the tools that you're able to put there but "pickaxe" and "shovel" should cover pretty much every need. If you have any questions about this again contact hjae#7876 in the Gregicality discord.
The internal name isn't that important and really it's most important use is that the texture you want to use has to named whatever you put in. In my example my texture was called diamond_block.png
. This file has to be located in resources\gtadditions\blocks
.
For example if I wanted to add the block Umberstone added by the Erebus mod as a stone type I would locate the Erebus source, then locate the class where the blocks are registered, in most cases it should be called something along the lines of ModBlocks. Next, we look at the source and find the class name
From this we see that erebus.ModBlocks
is our class name. Next we locate where the Umberstone block is defined.
From this we can see that our field name is UMBERSTONE
.
Next we have to find the texture to be able to allow GTCE code to use it to make ores. Hopefully I'll be able to find a consistent way of finding the texture but for now this will have to do. Block textures should always be located in resources\assets\modname\textures\blocks\
. In this case we find the file at