Posted August 22, 20196 yr Hello guys, I'm working on a Minecraft mod which will add certain blocks and items. I was adding a new block when I came across this error, "ItemBlock cannot be resolved to a type." My code is the following: package maxgaming3648.vanillaextension; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import maxgaming3648.vanillaextension.lists.BlockList; import maxgaming3648.vanillaextension.lists.ItemList; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; 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; @Mod("vanillaextension") public class VanillaExtension { public static VanillaExtension instance; public static final String modid = "vanillaextension"; private static final Logger logger = LogManager.getLogger(modid); public static final ItemGroup miscellaneous = new MiscellaneousItemGroup(); public static final ItemGroup buildingblocks = new BuildingBlocksItemGroup(); public VanillaExtension() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { logger.info("Setup method registered."); } private void clientRegistries(final FMLClientSetupEvent event) { logger.info("clientRegistries method registered."); } @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( // Items ItemList.ruby = new Item(new Item.Properties().group(miscellaneous)).setRegistryName(location("ruby")), // Blocks ItemList.ruby_block = new ItemBlock(BlockList.ruby_block, new Item.Properties().group(buildingblocks)) ); logger.info("Items registered."); } @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll( BlockList.ruby_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5.0f, 30.0f).sound(SoundType.METAL)).setRegistryName(location("ruby_block")) ); logger.info("Items registered."); } private static ResourceLocation location(String name) { return new ResourceLocation(modid, name); } } } I tried manually importing "net.minecraft.item.Itemblock", but it just said "The import net.minecraft.item.ItemBlock cannot be resolved." What can I do to fix the problem?
August 22, 20196 yr 10 minutes ago, maxgaming3648 said: ItemBlock cannot be resolved to a type. It's called BlockItem now. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.