Block texture is loaded successfully, but the #39;BlockItem#39; texture isn#39;t, Minecraft Forge 1.15.2(BLOCK纹理加载成功,但BlockItem纹理不在Main World Forge 1.15.2中)
问题描述
我尝试了许多教程并查找了文档,但仍未成功。 我将向您展示我的代码文件目录和问题的图像。
Testmod/Testmod.java:
package com.SkySibe.testmod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// The value here should match an entry in the META-INF/mods.toml file
@Mod("testmod")
public class TestMod
{
// Directly reference a log4j logger.
private static final Logger LOGGER = LogManager.getLogger();
public static final String MOD_ID = "testmod";
public static TestMod instance;
public TestMod() {
// Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
// Register the doClientStuff method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
instance = this;
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}
private void setup(final FMLCommonSetupEvent event)
{
}
private void doClientStuff(final FMLClientSetupEvent event) {
}
}
testmod/init/BlockInit.java:
package com.SkySibe.testmod.init;
import com.SkySibe.testmod.TestMod;
import net.minecraft.block.Block;
import net.minecraft.block.OreBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.ObjectHolder;
@ObjectHolder(TestMod.MOD_ID)
@Mod.EventBusSubscriber(modid = TestMod.MOD_ID, bus = Bus.MOD)
public class BlockInit {
public static final Block ruby_ore = null;
@SubscribeEvent
public static void registerBlocks(final RegistryEvent.Register<Block> event) {
event.getRegistry().register(new OreBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).sound(SoundType.STONE).harvestTool(ToolType.PICKAXE)).setRegistryName("ruby_ore"));
}
@SubscribeEvent
public static void registerBlockItems(final RegistryEvent.Register<Item> event) {
event.getRegistry().register(new BlockItem(ruby_ore,new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName("ruby_ore"));
}
}
Assets/testmod/lockStates/ruby_ore.json:
{
"variants": {
"": { "model": "testmod:block/ruby_ore"}
}
}
Assets/Testmod/Models/Block/ruby_ore.json:
{
"parent": "block/cube_all",
"textures": {
"all": "testmod:blocks/ruby_ore"
}
}
Assets/testmod/Models/Item/ruby_ore.json:
{
"parent": "testmod:block/ruby_block"
}
推荐答案
(来自评论)
您没有在文件assets/testmod/models/item/ruby_ore.json
中写入好的项目。应该是:
{
"parent": "testmod:block/ruby_ore"
}
这篇关于BLOCK纹理加载成功,但BlockItem纹理不在Main World Forge 1.15.2中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:BLOCK纹理加载成功,但BlockItem纹理不在Main World Forge 1.15.2中
- 获取数字的最后一位 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 转换 ldap 日期 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01