Jump to content

1.17.1 - ToolAction


DePhoegon

Recommended Posts

I just recently switched from the beta 1.17.1 to the current release one.

I am not getting how to use ToolAction (as it has replaced tooltype) to assign what tool type is needed to break the custom blocks.  

 

Where do i put that, and how do you assign the mining level needed?  I'm not seeing it and I can't seem to find it via digging through the ida in the project.

Link to comment
Share on other sites

public class ModBlocks {
	public static final DeferredRegister<Block> BLOCKS;
    public static final RegistryObjet<Block> KYPTOITE_ORE;
    
    public ModBlocks{}
    
    static {
		BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "gworld");
		KYPTOITE_ORE = BLOCKS.register("kyptoite_ore", () -> {
			return new KyptoiteOre(Properties.of(Material.STONE).destroyTime(5).explosionResistance(1000)
			.sound(SoundType.STONE).requieresCorrectToolForDrops());
		});
	}
}

Normally there would be the options of "harvestTool" and "harvestLevel", since I plan to add a great variety of ores, I mean, peaks for better minerals than diamond and I want to add for example "harvestLevel" at level 5, before they were, I was developing the mod on 37.0.26, but that version had a bug with the "loot_tables", so I opted to update my project and now I'm stuck for that. 

(The project is in forge 37.0.33)

Link to comment
Share on other sites

harvestTool is now set in json which i had explained in this thread

harvestLevel is also set via json but it's a bit more complicated,
you need to create a custom block tag and add your block to this tag if you create an ItemTier
wich can mine the block you should return the tag in the ItemTier (take look at the ForgeTier and at the TierSortingRegistry class),
for tags look into the vanilla Tags classes

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.