Jump to content

[1.14.4] Can't get example_item to appear anywhere [Solved]


Recommended Posts

Posted (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 by Profinger
Posted
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"?

  • Like 1

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.

Posted (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 by Profinger
Posted
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.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.