Topic category: Help with Minecraft modding (Java Edition)
I'm trying to alter a block's hardness with custom code, and I can't get it to work. Here is my code:
package net.mcreator.test.procedures;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.common.MinecraftForge;import net.mcreator.test.Test2ModElements;
import java.util.Map;
import java.util.Collections;@Test2ModElements.ModElement.Tag
public class TestProcedure extends Test2ModElements.ModElement {
public TestProcedure(Test2ModElements instance) {
super(instance, 2);
MinecraftForge.EVENT_BUS.register(this);
}public static void executeProcedure(Map<String, Object> dependencies) {
Blocks.dirt.setHardness(1000.0F);
Blocks.obsidian.setHardness(1.0F);
}@Override
public void init(FMLCommonSetupEvent event) {
this.executeProcedure(Collections.emptyMap());
}@EventHandler
public void init(FMLInitializationEvent event)
{
Blocks.dirt.setHardness(1000.0F);
Blocks.obsidian.setHardness(1.0F);
}}
I tried putting the .setHardnes() in all of the functions, nothing worked.