Daniel Rollins
-
Posts
28 -
Joined
-
Last visited
Posts posted by Daniel Rollins
-
-
Thank you for your reply. If I have to create more classes then I guess I have to but I was wondering if there was anything I could do with this (found in Block Class):
static {
net.minecraftforge.common.ForgeHooks.setBlockToolSetter((block, tool, level) -> {
block.harvestTool = tool;
block.harvestLevel = level;
});I'm not super great with Java yet so I'm not sure how I would use this or if it would be easier to just create the extra classes.
Thanks
-
Hi, is there a way to set the block harvest level and tool without having to override the getHarvestTool and getHarvestLevel functions? Basically, how can I set the internal harvestTool and harvestLevel variables? Preferably I would like to be able to set them without putting them in the custom block classes. In my mod I tried to have less actual block classes by basically doing this:
BlockList.new_block1 = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(20.0F, 27.0F).lightValue(0).sound(SoundType.METAL)).setRegistryName(location("new_block1")) # Using vanilla block class
BlockList.new_block2 = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5.0F, 3.0F).lightValue(0).sound(SoundType.METAL)).setRegistryName(location("new_block2")) # Using vanilla block class
or
BlockList.custom_block1 = new CustomBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(5.0F, 1.0F).lightValue(15).sound(SoundType.GLASS)).setRegistryName(location("custom_block1")) # Using custom block class
BlockList.custom_block2= new CustomBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(30.0F, 15.0F).lightValue(0).sound(SoundType.GLASS)).setRegistryName(location("custom_block2")) # Using same custom block class
Is there a way to set the harvest info similar to how I set the hardness and resistance so I don't have to create custom classes just for different harvest settings?
Thanks
[1.13.2] Set block harvest level and tool without overriding functions
in Modder Support
Posted
Sorry, didn't see that. I'll just go with more classes and using the getHarvestLevel & getHarvestTool methods. Thank you