minecraft block java code example

Example: minecraft block java

public class ModBlocks {
	//defferedRegistry
	public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, modclass.MOD_ID);
	//and now the registerobject of a block
	public static final RegistryObject<Block> NAME_BLOCK = BLOCKS.register("name_block", () -> new Block(Block.Properties.create(Material.MATERIAL).sound(SoundType.SOUND).hardnessAndResistance(hardness, resistance)));
	//replace NAME_BLOCK by the name of your block (always in caps) same with the register but with no caps
  	//replace MATERIAL by the material name, replace SOUND with the sound name , replace hardness with the Float of hardness value, replace resistance with Float of resistance value
  	//you can allways add more things for proprieties
}

Tags:

Java Example