更新内容

1. 补充完善了相关共工具方法
2. 添加部分javadoc
This commit is contained in:
叁玖领域 2026-01-03 15:37:35 +08:00
parent 97a232944b
commit 6efdb5fb13
17 changed files with 210 additions and 13 deletions

View File

@ -3,7 +3,13 @@ package top.r3944realms.lib39.base.datagen.provider;
import top.r3944realms.lib39.content.register.Lib39Blocks; import top.r3944realms.lib39.content.register.Lib39Blocks;
import top.r3944realms.lib39.datagen.provider.subprovider.BlockLootTables; import top.r3944realms.lib39.datagen.provider.subprovider.BlockLootTables;
/**
* The type Lib 39 block loot table.
*/
public class Lib39BlockLootTable extends BlockLootTables { public class Lib39BlockLootTable extends BlockLootTables {
/**
* Instantiates a new Lib 39 block loot table.
*/
public Lib39BlockLootTable() { public Lib39BlockLootTable() {
super(Lib39Blocks.BLOCKS); super(Lib39Blocks.BLOCKS);
dropSelf(Lib39Blocks.DOLL); dropSelf(Lib39Blocks.DOLL);

View File

@ -12,7 +12,15 @@ import top.r3944realms.lib39.content.register.Lib39Items;
import java.util.function.Consumer; import java.util.function.Consumer;
/**
* The type Lib 39 recipe provider.
*/
public class Lib39RecipeProvider extends RecipeProvider { public class Lib39RecipeProvider extends RecipeProvider {
/**
* Instantiates a new Lib 39 recipe provider.
*
* @param output the output
*/
public Lib39RecipeProvider(PackOutput output) { public Lib39RecipeProvider(PackOutput output) {
super(output); super(output);
} }

View File

@ -7,11 +7,27 @@ import net.minecraftforge.common.data.SoundDefinitionsProvider;
import top.r3944realms.lib39.Lib39; import top.r3944realms.lib39.Lib39;
import top.r3944realms.lib39.content.register.Lib39SoundEvents; import top.r3944realms.lib39.content.register.Lib39SoundEvents;
/**
* The type Lib 39 sound definitions provider.
*/
public class Lib39SoundDefinitionsProvider extends SoundDefinitionsProvider { public class Lib39SoundDefinitionsProvider extends SoundDefinitionsProvider {
/**
* Instantiates a new Lib 39 sound definitions provider.
*
* @param output the output
* @param helper the helper
*/
public Lib39SoundDefinitionsProvider(PackOutput output, ExistingFileHelper helper) { public Lib39SoundDefinitionsProvider(PackOutput output, ExistingFileHelper helper) {
super(output, Lib39.MOD_ID, helper); super(output, Lib39.MOD_ID, helper);
} }
/**
* Gets sound definition.
*
* @param subTitle the sub title
* @param sounds the sounds
* @return the sound definition
*/
public SoundDefinition getSoundDefinition(String subTitle, SoundDefinition.Sound... sounds) { public SoundDefinition getSoundDefinition(String subTitle, SoundDefinition.Sound... sounds) {
return SoundDefinition.definition().subtitle(subTitle).with(sounds); return SoundDefinition.definition().subtitle(subTitle).with(sounds);
} }

View File

@ -11,8 +11,17 @@ import net.minecraft.client.renderer.RenderType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import top.r3944realms.lib39.Lib39; import top.r3944realms.lib39.Lib39;
/**
* The type Doll model.
*/
public class DollModel extends Model { public class DollModel extends Model {
/**
* The constant LAYER_LOCATION.
*/
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(Lib39.rl("doll_model"), "main"); public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(Lib39.rl("doll_model"), "main");
/**
* The Slim.
*/
public boolean slim = false; public boolean slim = false;
private final ModelPart head; private final ModelPart head;
private final ModelPart body; private final ModelPart body;
@ -23,6 +32,11 @@ public class DollModel extends Model {
private final ModelPart leftArmSlim; private final ModelPart leftArmSlim;
private final ModelPart leftLeg; private final ModelPart leftLeg;
/**
* Instantiates a new Doll model.
*
* @param root the root
*/
public DollModel(ModelPart root) { public DollModel(ModelPart root) {
super(RenderType::entityTranslucent); super(RenderType::entityTranslucent);
this.head = root.getChild("head"); this.head = root.getChild("head");
@ -35,6 +49,11 @@ public class DollModel extends Model {
this.leftLeg = root.getChild("left_leg"); this.leftLeg = root.getChild("left_leg");
} }
/**
* Create body layer layer definition.
*
* @return the layer definition
*/
public static LayerDefinition createBodyLayer() { public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition(); MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot(); PartDefinition partdefinition = meshdefinition.getRoot();

View File

@ -19,9 +19,17 @@ import top.r3944realms.lib39.content.block.DollBlock;
import top.r3944realms.lib39.content.block.blockentity.DollBlockEntity; import top.r3944realms.lib39.content.block.blockentity.DollBlockEntity;
import top.r3944realms.lib39.util.lang.Pair; import top.r3944realms.lib39.util.lang.Pair;
/**
* The type Doll block entity renderer.
*/
public class DollBlockEntityRenderer implements BlockEntityRenderer<DollBlockEntity> { public class DollBlockEntityRenderer implements BlockEntityRenderer<DollBlockEntity> {
private final DollModel dollModel; private final DollModel dollModel;
/**
* Instantiates a new Doll block entity renderer.
*
* @param context the context
*/
public DollBlockEntityRenderer(BlockEntityRendererProvider.@NotNull Context context) { public DollBlockEntityRenderer(BlockEntityRendererProvider.@NotNull Context context) {
this.dollModel = new DollModel(context.bakeLayer(DollModel.LAYER_LOCATION)); this.dollModel = new DollModel(context.bakeLayer(DollModel.LAYER_LOCATION));
} }

View File

@ -19,6 +19,9 @@ import top.r3944realms.lib39.content.item.DollItem;
import top.r3944realms.lib39.util.GameProfileHelper; import top.r3944realms.lib39.util.GameProfileHelper;
import top.r3944realms.lib39.util.lang.Pair; import top.r3944realms.lib39.util.lang.Pair;
/**
* The type Doll item renderer.
*/
public class DollItemRenderer extends BlockEntityWithoutLevelRenderer { public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
private static DollItemRenderer instance; private static DollItemRenderer instance;
private final DollModel dollModel; private final DollModel dollModel;
@ -31,6 +34,12 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
Minecraft.getInstance().getEntityModels().bakeLayer(DollModel.LAYER_LOCATION) Minecraft.getInstance().getEntityModels().bakeLayer(DollModel.LAYER_LOCATION)
); );
} }
/**
* Gets instance.
*
* @return the instance
*/
public static DollItemRenderer getInstance() { public static DollItemRenderer getInstance() {
if (instance == null) { if (instance == null) {
instance = new DollItemRenderer(); instance = new DollItemRenderer();
@ -67,6 +76,12 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
poseStack.popPose(); poseStack.popPose();
} }
/**
* Load skin pair.
*
* @param profile the profile
* @return the pair
*/
public static @NotNull Pair<ResourceLocation,Boolean> loadSkin(GameProfile profile) { public static @NotNull Pair<ResourceLocation,Boolean> loadSkin(GameProfile profile) {
SkinManager skinManager = Minecraft.getInstance().getSkinManager(); SkinManager skinManager = Minecraft.getInstance().getSkinManager();
ResourceLocation playerSkin; ResourceLocation playerSkin;

View File

@ -78,6 +78,12 @@ public class DollBlockEntity extends BlockEntity {
this.updateOwnerProfile(); this.updateOwnerProfile();
} }
/**
* Sets owner.
*
* @param ownerName the owner name
*/
public void setOwner(@Nullable String ownerName) { public void setOwner(@Nullable String ownerName) {
setOwner(new GameProfile(Util.NIL_UUID, ownerName)); setOwner(new GameProfile(Util.NIL_UUID, ownerName));
} }

View File

@ -8,17 +8,40 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
import top.r3944realms.lib39.Lib39; import top.r3944realms.lib39.Lib39;
/**
* The type Lib 39 sound events.
*/
public class Lib39SoundEvents { public class Lib39SoundEvents {
/**
* The constant SOUND_EVENTS.
*/
public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Lib39.MOD_ID); public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Lib39.MOD_ID);
/**
* The constant RL_DUCK_TOY.
*/
public static final ResourceLocation RL_DUCK_TOY = Lib39.rl("duck_toy"); public static final ResourceLocation RL_DUCK_TOY = Lib39.rl("duck_toy");
/**
* The constant DUCK_TOY.
*/
public static final RegistryObject<SoundEvent> DUCK_TOY = SOUND_EVENTS.register("duck_toy", public static final RegistryObject<SoundEvent> DUCK_TOY = SOUND_EVENTS.register("duck_toy",
() -> SoundEvent.createFixedRangeEvent(RL_DUCK_TOY, 32.0f)); () -> SoundEvent.createFixedRangeEvent(RL_DUCK_TOY, 32.0f));
/**
* Register.
*
* @param bus the bus
*/
public static void register(IEventBus bus) { public static void register(IEventBus bus) {
SOUND_EVENTS.register(bus); SOUND_EVENTS.register(bus);
} }
/**
* Gets sub title translate key.
*
* @param name the name
* @return the sub title translate key
*/
public static String getSubTitleTranslateKey(String name) { public static String getSubTitleTranslateKey(String name) {
return "sound." + Lib39.MOD_ID + ".subtitle." + name; return "sound." + Lib39.MOD_ID + ".subtitle." + name;
} }

View File

@ -82,11 +82,11 @@ public class CompatManager {
public void addListenerForCompat(ResourceLocation compatId, @Nullable Dist dists, Mod.EventBusSubscriber.Bus bus) { public void addListenerForCompat(ResourceLocation compatId, @Nullable Dist dists, Mod.EventBusSubscriber.Bus bus) {
listenerConfigs.add(new ListenerConfig(compatId, dists, bus)); listenerConfigs.add(new ListenerConfig(compatId, dists, bus));
} }
/** /**
* 为特定兼容模块配置事件监听器 * 为特定兼容模块配置事件监听器
* *
* @param compatId the compat id * @param compatId the compat id
*/ */
public void addListenerForCompat(ResourceLocation compatId) { public void addListenerForCompat(ResourceLocation compatId) {
addListenerForCompat(compatId, null, Mod.EventBusSubscriber.Bus.FORGE); addListenerForCompat(compatId, null, Mod.EventBusSubscriber.Bus.FORGE);

View File

@ -46,6 +46,11 @@ public class ClientEventHandler {
event.registerBlockEntityRenderer(Lib39BlockEntities.DOLL_BLOCK_ENTITY.get(),DollBlockEntityRenderer::new); event.registerBlockEntityRenderer(Lib39BlockEntities.DOLL_BLOCK_ENTITY.get(),DollBlockEntityRenderer::new);
} }
/**
* Register layer definitions.
*
* @param event the event
*/
@SubscribeEvent @SubscribeEvent
public static void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { public static void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(DollModel.LAYER_LOCATION, DollModel::createBodyLayer); event.registerLayerDefinition(DollModel.LAYER_LOCATION, DollModel::createBodyLayer);

View File

@ -135,6 +135,12 @@ public class CommonEventHandler {
syncData2Manager.forEach(((resourceLocation, iSyncManager) -> iSyncManager.foreach(ISyncData::checkIfDirtyThenUpdate))); syncData2Manager.forEach(((resourceLocation, iSyncManager) -> iSyncManager.foreach(ISyncData::checkIfDirtyThenUpdate)));
} }
} }
/**
* On anvil rename.
*
* @param event the event
*/
@SubscribeEvent @SubscribeEvent
public static void onAnvilRename(AnvilUpdateEvent event) { public static void onAnvilRename(AnvilUpdateEvent event) {
if (event.getLeft().getItem() instanceof DollItem) { if (event.getLeft().getItem() instanceof DollItem) {
@ -245,6 +251,7 @@ public class CommonEventHandler {
}); });
} }
/** /**
* Add item to tabs. * Add item to tabs.
* *

View File

@ -37,8 +37,11 @@ public class BlockLootTables extends BlockLootSubProvider {
private final List<BlockEntry> blockEntries = new ArrayList<>(); private final List<BlockEntry> blockEntries = new ArrayList<>();
private final DeferredRegister<Block> knowBlocks; private final DeferredRegister<Block> knowBlocks;
/** /**
* Instantiates a new Block loot tables. * Instantiates a new Block loot tables.
*
* @param deferredRegister the deferred register
*/ */
public BlockLootTables(DeferredRegister<Block> deferredRegister) { public BlockLootTables(DeferredRegister<Block> deferredRegister) {
super(Set.of(), FeatureFlags.REGISTRY.allFlags()); super(Set.of(), FeatureFlags.REGISTRY.allFlags());
@ -332,6 +335,7 @@ public class BlockLootTables extends BlockLootSubProvider {
/** /**
* 创建新的战利品表生成器 * 创建新的战利品表生成器
* *
* @param deferredRegister the deferred register
* @return the block loot tables * @return the block loot tables
*/ */
@Contract("_ -> new") @Contract("_ -> new")

View File

@ -427,6 +427,7 @@ public class LangKeyValue implements ILangKeyValue {
.isDefault(isDefault) .isDefault(isDefault)
.build(); .build();
} }
/** /**
* Copy of lang key value. * Copy of lang key value.
* *

View File

@ -2,6 +2,8 @@ package top.r3944realms.lib39.datagen.value;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
@ -57,6 +59,10 @@ public enum ModPartEnum {
* 图形界面 * 图形界面
*/ */
GUI, GUI,
/**
* 容器
*/
CONTAINER,
/** /**
* 画作描述 * 画作描述
*/ */
@ -127,11 +133,12 @@ public enum ModPartEnum {
* @param name the name * @param name the name
* @return the full key * @return the full key
*/ */
public String getFullKey(String modId, String name) { @Contract(pure = true)
public @NotNull String getFullKey(String modId, String name) {
return switch (this) { return switch (this) {
case ITEM -> "item." + modId + "." + name; case ITEM -> "item." + modId + "." + name;
case BLOCK -> "block." + modId + "." + name; case BLOCK -> "block." + modId + "." + name;
case ENCHANTMENT -> "enchantment."; case ENCHANTMENT -> "enchantment." + modId + "." + name;
case ADVANCEMENT_TITLE -> "advancement." + modId + "." + name + ".title"; case ADVANCEMENT_TITLE -> "advancement." + modId + "." + name + ".title";
case ADVANCEMENT_DESCRIPTION -> "advancement." + modId + "." + name + ".description"; case ADVANCEMENT_DESCRIPTION -> "advancement." + modId + "." + name + ".description";
case CREATIVE_TAB -> "creativetab." + modId + "." + name; case CREATIVE_TAB -> "creativetab." + modId + "." + name;
@ -139,17 +146,18 @@ public enum ModPartEnum {
case CONFIG -> "config." + modId + "." + name; case CONFIG -> "config." + modId + "." + name;
case ENTITY -> "entity." + modId + "." + name; case ENTITY -> "entity." + modId + "." + name;
case GUI -> "gui." + modId + "." + name; case GUI -> "gui." + modId + "." + name;
case CONTAINER -> "container." + modId + "." + name;
case PAINTING_AUTHOR -> "painting." + modId + "." + name + ".author"; case PAINTING_AUTHOR -> "painting." + modId + "." + name + ".author";
case PAINTING_TITLE -> "painting." + modId + "." + name + ".title"; case PAINTING_TITLE -> "painting." + modId + "." + name + ".title";
case TITLE -> "title." + modId + "." + name; case TITLE -> "title." + modId + "." + name;
case NAME -> "name." + modId + "." + name; case NAME -> "name." + modId + "." + name;
case GAME_RULE -> "gamerule."; case GAME_RULE -> "gamerule."+ modId + "." + name;
case DESCRIPTION -> "description."; case DESCRIPTION -> "description." + modId + "." + name;
case INFO -> "info." + modId + "." + name; case INFO -> "info." + modId + "." + name;
case MESSAGE -> "message." + modId + "." + name; case MESSAGE -> "message." + modId + "." + name;
case COMMAND -> "command." + modId + "." + name; case COMMAND -> "command." + modId + "." + name;
case SOUND -> "sound." + modId + "." + name; case SOUND -> "sound." + modId + "." + name;
default -> modId + name; default -> modId + "." + name;
}; };
} }

View File

@ -13,6 +13,9 @@ import top.r3944realms.lib39.util.GameProfileHelper;
import tschipp.carryon.client.render.CarriedObjectRender; import tschipp.carryon.client.render.CarriedObjectRender;
import tschipp.carryon.common.carry.CarryOnDataManager; import tschipp.carryon.common.carry.CarryOnDataManager;
/**
* The type Mixin carried object render.
*/
@Pseudo @Pseudo
@Mixin(value = CarriedObjectRender.class, remap = false) @Mixin(value = CarriedObjectRender.class, remap = false)
public class MixinCarriedObjectRender { public class MixinCarriedObjectRender {

View File

@ -30,7 +30,13 @@ import java.util.concurrent.atomic.AtomicReference;
* The type GameProfile helper. * The type GameProfile helper.
*/ */
public class GameProfileHelper { public class GameProfileHelper {
/**
* The constant TAG_BE.
*/
public static final String TAG_BE = "BlockEntityTag"; public static final String TAG_BE = "BlockEntityTag";
/**
* The constant TAG_OWN_PROFILE.
*/
public static final String TAG_OWN_PROFILE = "OwnerProfile"; public static final String TAG_OWN_PROFILE = "OwnerProfile";
@ -61,7 +67,13 @@ public class GameProfileHelper {
.getInsecureSkinLocation(gameProfile); .getInsecureSkinLocation(gameProfile);
} }
// 判断玩家是否使用纤细手臂 /**
* Has slim arms boolean.
*
* @param player the player
* @return the boolean
*/
// 判断玩家是否使用纤细手臂
public static boolean hasSlimArms(@NotNull Player player) { public static boolean hasSlimArms(@NotNull Player player) {
if (player.level().isClientSide) { if (player.level().isClientSide) {
return hasSlimArmsClient(player); return hasSlimArmsClient(player);
@ -105,7 +117,13 @@ public class GameProfileHelper {
return false; return false;
} }
// 获取皮肤模型名称 /**
* Gets skin model name.
*
* @param player the player
* @return the skin model name
*/
// 获取皮肤模型名称
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static @NotNull String getSkinModelName(@NotNull Player player) { public static @NotNull String getSkinModelName(@NotNull Player player) {
if (player.level().isClientSide && player instanceof AbstractClientPlayer) { if (player.level().isClientSide && player instanceof AbstractClientPlayer) {
@ -115,10 +133,12 @@ public class GameProfileHelper {
} }
return "default"; return "default";
} }
/** /**
* 判断玩家是否为纤细手臂Alex模型 * 判断玩家是否为纤细手臂Alex模型
*
* @param profile 玩家的GameProfile * @param profile 玩家的GameProfile
* @return true=纤细手臂false=正常手臂 * @return true =纤细手臂false=正常手臂
*/ */
public static boolean isSlimArms(GameProfile profile) { public static boolean isSlimArms(GameProfile profile) {
if (profile == null) { if (profile == null) {
@ -189,6 +209,7 @@ public class GameProfileHelper {
/** /**
* 获取皮肤模型名称 * 获取皮肤模型名称
*
* @param profile GameProfile * @param profile GameProfile
* @return "slim" "default" * @return "slim" "default"
*/ */
@ -224,8 +245,12 @@ public class GameProfileHelper {
return "default"; return "default";
} }
/** /**
* 从ItemStack的NBT中读取GameProfile * 从ItemStack的NBT中读取GameProfile
*
* @param stack the stack
* @return the profile from item stack
*/ */
@Nullable @Nullable
public static GameProfile getProfileFromItemStack(ItemStack stack) { public static GameProfile getProfileFromItemStack(ItemStack stack) {
@ -251,8 +276,12 @@ public class GameProfileHelper {
}); });
return profileRef.get(); return profileRef.get();
} }
/** /**
* 将GameProfile保存到ItemStack的NBT * 将GameProfile保存到ItemStack的NBT
*
* @param stack the stack
* @param profile the profile
*/ */
public static void saveProfileToItemStack(@NotNull ItemStack stack, @Nullable GameProfile profile) { public static void saveProfileToItemStack(@NotNull ItemStack stack, @Nullable GameProfile profile) {
if (stack.isEmpty()) { if (stack.isEmpty()) {
@ -280,6 +309,9 @@ public class GameProfileHelper {
/** /**
* 检查ItemStack是否有保存的皮肤数据 * 检查ItemStack是否有保存的皮肤数据
*
* @param stack the stack
* @return the boolean
*/ */
public static boolean hasProfileData(@NotNull ItemStack stack) { public static boolean hasProfileData(@NotNull ItemStack stack) {
if (stack.isEmpty()) { if (stack.isEmpty()) {

View File

@ -1,8 +1,11 @@
package top.r3944realms.lib39.util.block; package top.r3944realms.lib39.util.block;
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
@ -19,6 +22,9 @@ import java.util.function.Supplier;
public class BlockRegistryBuilder { public class BlockRegistryBuilder {
private String registryName; private String registryName;
private RegistryObject<Block> blockObject; private RegistryObject<Block> blockObject;
private DeferredRegister<Item> items;
private boolean needBuildItem;
private Item.Properties properties;
/** /**
* 创建新的构建器实例 * 创建新的构建器实例
@ -56,11 +62,38 @@ public class BlockRegistryBuilder {
/** /**
* 注册对应的方块物品 * 注册对应的方块物品
* *
* @param blockObject the block object * @param itemRegister the item deferred register
* @param blockDeferredRegister the block deferred register * @return the block registry builder
*/ */
public void registerBlockItem(RegistryObject<Block> blockObject, @NotNull DeferredRegister<Block> blockDeferredRegister) { public BlockRegistryBuilder registerItem(DeferredRegister<Item> itemRegister) {
blockDeferredRegister.register(this.registryName, blockObject); this.items = itemRegister;
needBuildItem = true;
return this;
}
/**
* 注册对应的方块带有对应属性物品
*
* @param itemRegister the item deferred register
* @param properties the item properties
* @return the block registry builder
*/
public BlockRegistryBuilder registerItemWithProperties(DeferredRegister<Item> itemRegister, Item.Properties properties) {
this.items = itemRegister;
this.properties = properties;
needBuildItem = true;
return this;
}
/**
* 对应的方块物品属性
*
* @param properties the item properties
* @return the block registry builder
*/
public BlockRegistryBuilder ItemProperties(Item.Properties properties) {
this.properties = properties;
return this;
} }
/** /**
@ -103,6 +136,9 @@ public class BlockRegistryBuilder {
* @return the registry object * @return the registry object
*/ */
public RegistryObject<Block> build() { public RegistryObject<Block> build() {
if (needBuildItem) {
items.register(this.registryName, () -> new BlockItem(this.blockObject.get(), properties == null ? new Item.Properties() : properties));
}
return this.blockObject; return this.blockObject;
} }