Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I want to make it so that when you craft a bed, it will be given a special lore(AddInformation method I think.) but I'm not sure how. I researched crafting handlers and achievements but they are for old versions and none seem to work.

  • Author

PlayerEvent.ItemCraftedEvent

should work.

I created this class, but am I supposed to register it in my main file? If so, how?

 

package bloopers.novelties.handlers;

import net.minecraft.item.ItemBed;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

public class EventItemCrafted 
{
@SubscribeEvent
public void onItemCrafted(ItemCraftedEvent event)
{
	ItemStack stack = event.crafting;
	NBTTagCompound nbt = stack.getTagCompound();

	if (stack.getItem() instanceof ItemBed)
	{
		stack.setTagInfo("Test", null);
	}
}
}

  • Author

That is from an old tutorial, registering it in my main class didn't work. Unless I'm just doing something wrong.

  • Author

Seems like you don't really want to help, so I'll go to another forum. Thanks for what you have helped me with though.

  • Author

Seems like you don't really want to help, so I'll go to another forum. Thanks for what you have helped me with though.

I am sorry, but my magic remote code-viewing device is currently broken. You will have to post what you attempted manually.

 

He means that we need code you say you tried to use to register events for us to be able to fix it for ya.

No code = can't help.

 

Proper way:

MinecraftForge.EVENT_BUS.register(new EventClass());

 

Also - I am not sure if NBT accepts null values, maybe that was keys tho...

1.7.10 is no longer supported by forge, you are on your own.

I am sorry, but my magic remote code-viewing device is currently broken. You will have to post what you attempted manually.

 

He means that we need code you say you tried to use to register events for us to be able to fix it for ya.

No code = can't help.

 

Proper way:

MinecraftForge.EVENT_BUS.register(new EventClass());

 

Also - I am not sure if NBT accepts null values, maybe that was keys tho...

1.7.10 is no longer supported by forge, you are on your own.

Also - I am not sure if NBT accepts null values, maybe that was keys tho...

As Ernio noted, do not use null in NBT values as it will crash your game. I personally tested this when I was creating my own item.

Also - I am not sure if NBT accepts null values, maybe that was keys tho...

As Ernio noted, do not use null in NBT values as it will crash your game. I personally tested this when I was creating my own item.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.