Posted May 22, 20169 yr 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.
May 22, 20169 yr 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); } } }
May 22, 20169 yr Author That is from an old tutorial, registering it in my main class didn't work. Unless I'm just doing something wrong.
May 24, 20169 yr 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.
May 24, 20169 yr 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.
May 24, 20169 yr 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.
May 24, 20169 yr 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.
May 24, 20169 yr 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.
May 24, 20169 yr 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.