Posted March 6, 20178 yr Yep, it's me again Any help on this? It does not work. GymDbellItem.java package com.bagasmc.gym.items; import java.util.List; import com.bagasmc.gym.handlers.CreativeTabHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; public class GymDbellItem extends Item { public static ItemBase gymDumbbell; public static ItemStack dumBell; public static void init() { gymDumbbell = register(new ItemBase("dumbBell").setCreativeTab(CreativeTabHandler.tabBlocks)); } @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean check) { list.add(" STAMINA "); list.add("3 kilos 6.6 lbs"); } private static <T extends Item> T register(T item) { GameRegistry.register(item); if(item instanceof ItemModelProvider) { ((ItemModelProvider)item).registerItemModel(item); } return item; } } It does not show the lore
March 6, 20178 yr Author 1 minute ago, diesieben07 said: For example, yes.‚ Can you show how to properly use it please? it keeps giving me error..
March 7, 20178 yr Author 19 hours ago, diesieben07 said: Show what you tried. That one, gymDumbbell gymdumbbell = new gymDumbbell();
March 7, 20178 yr Author package com.bagasmc.gym.items; import java.util.List; import com.bagasmc.gym.handlers.CreativeTabHandler; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; public class GymDumbbell extends Item { public static ItemBase dumbBell; gymDumbbell gymdumbbell = new gymDumbbell(); public static void init() { dumbBell = register(new ItemBase("dumbbell").setCreativeTab(CreativeTabHandler.tabBlocks)); } @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean check) { list.add(" STAMINA "); list.add("3 kilos 6.6 lbs"); } private static <T extends Item> T register(T item) { GameRegistry.register(item); if(item instanceof ItemModelProvider) { ((ItemModelProvider)item).registerItemModel(item); } return item; } }
March 7, 20178 yr Try moving the gymdumbell = new gymdumbell() part into a moditems file and just calling the moditems in the common proxy. I can give a better example when I get home in about 5 and a half hours
March 8, 20178 yr You are registering ItemBase dumbBell and not GymDumbbell gymdumbbell . dumbBell is just ItemBase and will not have any properties from GymDumbbell. Also, If you have too many Items your code might begin to look ugly. Move register() and init() to seperate class just for registering and holding Item objects for cleaner code. Normally called ModItems. Edited March 8, 20178 yr by Gortart giving out copy-paste-ready code is not a good idea.
March 8, 20178 yr 9 minutes ago, diesieben07 said: Why? There is no reason for this if you don't have like 50 items or so. Please don't blindly recommend / follow practices like this if you don't understand why they exist. Also, please don't just post copy-paste-ready code, especially when it's obvious that OP doesn't have the necessary programming experience. Sorry, should I edit those parts out?
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.