- 注册
- 2023/08/18
- 消息
- 4
- 金粒
- 1,552金粒
我刚开始接触Forge开发,金粒不多希望各位大佬解答:
我注册了一个Block并给它附上了纹理,然后我注册了一个BlockItem,Block的纹理正常显示,但它在背包里依然是无纹理的状态
源代码如下:
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
public static final RegistryObject<Block> build_walla = BLOCKS.register(
"build_walla", () -> new Block(
BlockBehaviour.Properties.of()
.sound(SoundType.STONE)
.strength(-1.0f)
.setId(ResourceKey.create(
ForgeRegistries.BLOCKS.getRegistryKey(),
ResourceLocation.parse(
String.format("%s:%s", SCPRP.MODID, "build_walla")
)
)
)
)
);
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,MODID);
public static final RegistryObject<Item> build_wallaitem = ITEMS.register(
"build_walla",
() -> new BlockItem(
build_walla.get(),
new Item.Properties()
.setId(ResourceKey.create(
ForgeRegistries.ITEMS.getRegistryKey(),
ResourceLocation.parse(
String.format(
"%s:%s", SCPRP.MODID, "build_walla"
)
)
)
)
)
);
这是我存放纹理/模型的目录:

烦请各位大佬解答!
我注册了一个Block并给它附上了纹理,然后我注册了一个BlockItem,Block的纹理正常显示,但它在背包里依然是无纹理的状态
源代码如下:
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
public static final RegistryObject<Block> build_walla = BLOCKS.register(
"build_walla", () -> new Block(
BlockBehaviour.Properties.of()
.sound(SoundType.STONE)
.strength(-1.0f)
.setId(ResourceKey.create(
ForgeRegistries.BLOCKS.getRegistryKey(),
ResourceLocation.parse(
String.format("%s:%s", SCPRP.MODID, "build_walla")
)
)
)
)
);
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,MODID);
public static final RegistryObject<Item> build_wallaitem = ITEMS.register(
"build_walla",
() -> new BlockItem(
build_walla.get(),
new Item.Properties()
.setId(ResourceKey.create(
ForgeRegistries.ITEMS.getRegistryKey(),
ResourceLocation.parse(
String.format(
"%s:%s", SCPRP.MODID, "build_walla"
)
)
)
)
)
);
这是我存放纹理/模型的目录:

烦请各位大佬解答!