我们本次尝试在主世界生成模组中自定义的矿石
效果演示 效果演示 效果演示
1.由于1.20的版本出现了深板岩层的矿石,我们要在BlockInit类中声明一个矿石的两种岩层形态:
BlockInit.java
package com.joy187.re8joymod.init;
import java.util.function.Function;
import javax.annotation.Nonnull;
import com.google.common.base.Supplier;
import com.joy187.re8joymod.Main;
//import com.joy187.re8joymod.blocks.*;
import net.minecraft.client.resources.model.Material;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.valueproviders.UniformInt;
public class BlockInit {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS,Main.MOD_ID);
public static final DeferredRegister<Item> ITEMS = ItemInit.ITEMS;
//普通矿石
public static final RegistryObject<Block> FANTOM_ORE = registerBlock("fantom_ore",
() -> new DropExperienceBlock(BlockBehaviour.Properties.copy(Blocks.STONE)
.strength(5f).requiresCorrectToolForDrops(), UniformInt