Profinger Posted April 18, 2020 Posted April 18, 2020 (edited) Hey all. I finally got everything working and building with this tutorial (https://cadiboo.github.io/tutorials/1.14.4/forge/) however I can't get an item to appear. From what I can tell, I've followed the tutorial exactly save for a few things I modified to match someone else's code a bit who was asking the same question I was but his problem was that he was registering to the wrong eventbus. Anyone have any thoughts? Main.java: import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraftforge.fml.common.Mod; @Mod(Main.MODID) public final class Main { public static final String MODID = "itemtest1"; public static final Logger LOGGER = LogManager.getLogger(); public Main() { LOGGER.debug("TEST TEST"); } } ModEventSubscriber.java: import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.IForgeRegistryEntry; @Mod.EventBusSubscriber(modid = Main.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public final class ModEventSubscriber { @SubscribeEvent public static void onRegisterItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( setup(new Item(new Item.Properties()), "testitem") ); } public static <T extends IForgeRegistryEntry<T>> T setup(final T entry, final String name) { return setup(entry, new ResourceLocation(Main.MODID, name)); } public static <T extends IForgeRegistryEntry<T>> T setup(final T entry, final ResourceLocation registryName) { entry.setRegistryName(registryName); return entry; } } From what I can tell, everything here should be accurate and correct. However, when I load into a newly created world and try to type /give Dev testitem I get an error that it's not found. Edited April 19, 2020 by Profinger Quote
Animefan8888 Posted April 18, 2020 Posted April 18, 2020 3 minutes ago, Profinger said: From what I can tell, everything here should be accurate and correct. However, when I load into a newly created world and try to type /give Dev testitem I get an error that it's not found. Have you tried "modid:testitem"? 1 Quote 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.
Profinger Posted April 19, 2020 Author Posted April 19, 2020 (edited) Good lord.. That was the ticket lol Thank you so much! I hadn't actually seen any examples anywhere of the proper give command and I'm only really familiar with using /give in vanilla since I've never modded or really played with mods before. Minecraft kept autocompleting with /give Dev minecraft: things and just leaving the minecraft: designation off didn't help. I didn't realize I access them directly through my modid! Thank you! Edited April 19, 2020 by Profinger Quote
Animefan8888 Posted April 19, 2020 Posted April 19, 2020 9 minutes ago, Profinger said: I didn't realize I access them directly through my modid! The "minecraft: at the beginning IE "minecraft:diamond_pickaxe" is the modid for vanilla stuff. 1 Quote 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.
Recommended Posts
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.