本文主要是介绍Minecraft 1.20.x Forge模组开发 05.矿石生成,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
我们本次尝试在主世界生成模组中自定义的矿石
效果演示 效果演示 效果演示
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
这篇关于Minecraft 1.20.x Forge模组开发 05.矿石生成的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!