pyromaniac13_ Posted July 3, 2016 Posted July 3, 2016 I've been searching forever even through minecraft's code, and I cant figure out how to get the custom bow animations to work. Right now I'm just trying to get a basic bow for my mod working, based off the vanilla bow. Everything works fine except the pulling animations. The standby texture is fine, but the pulling_ textures don't work. I'm guessing its the resource location override that I need to do? But I'm not sure how that works. Any help would be great. Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 package com.pyro13.tut.item; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemBow; public class ItemModBow extends ItemBow { public ItemModBow(String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(CreativeTabs.COMBAT); this.setMaxStackSize(1); } } { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_standby" }, "display": { "thirdperson_righthand": { "rotation": [ -80, 260, -40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -80, -280, 40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "pulling": 1 }, "model": "item/fel_bow_pulling_0" }, { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "item/fel_bow_pulling_1" }, { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "item/fel_bow_pulling_2" } ] } Sorry, new to forums and whatnot. Usually try to figure these things out on my own but this bow animation is killing me. Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 I just based it off the vanilla bow.json, which i take was incorrect to do? How should I format it? Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Oh, man, can't believe it was that simple. Forgot the modid: , and I also changed the parent of the pulling json files for some reason. Got it working now, thanks. Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Actually I lied, its mostly working fine. I'm not getting any artifacts or exceptions, but when I draw the bow back, the texture of the bow simply warps like it normally does, and doesn't cycle through the pulling_ textures. It stays at the standby texture. Whats causing that? Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_standby" }, "display": { "thirdperson_righthand": { "rotation": [ -80, 260, -40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -80, -280, 40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "pulling": 1 }, "model": "fel:item/fel_bow_pulling_0" }, { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "fel:item/fel_bow_pulling_1" }, { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "fel:item/fel_bow_pulling_2" } ] } { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_pulling_0" } } Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 fel_bow.json { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_standby" }, "display": { "thirdperson_righthand": { "rotation": [ -80, 260, -40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -80, -280, 40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "pulling": 1 }, "model": "fel:item/fel_bow_pulling_0" }, { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "fel:item/fel_bow_pulling_1" }, { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "fel:item/fel_bow_pulling_2" } ] } fel_bow_pulling_0.json { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_pulling_0" } } fel_bow_pulling_1.json { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_pulling_1" } } fel_bow_pulling_2.json { "parent": "item/generated", "textures": { "layer0": "fel:items/fel_bow_pulling_2" } } Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Not 100% sure what you mean, but what you want is probably in this class so I'll post it all. Bow registers are at the bottom of the register lists. package com.pyro13.tut.init; import com.pyro13.tut.client.Reference; import com.pyro13.tut.item.ItemModArmor; import com.pyro13.tut.item.ItemModAxe; import com.pyro13.tut.item.ItemModBow; import com.pyro13.tut.item.ItemModHoe; import com.pyro13.tut.item.ItemModMultitool; import com.pyro13.tut.item.ItemModPickaxe; import com.pyro13.tut.item.ItemModShovel; import com.pyro13.tut.item.ItemModSword; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; public class FelItems { //items public static Item fel_essence; public static Item fel_ore; public static Item felsteel; public static Item felsteel_hide; public static Item cured_leather_hide; //armor public static ArmorMaterial FelArmor = EnumHelper.addArmorMaterial("FelArmor", "fel:fel", 50, new int[]{4,9,6,3}, 64, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F); public static Item fel_helmet; public static Item fel_chestplate; public static Item fel_leggings; public static Item fel_boots; //tools public static ToolMaterial Felsteel = EnumHelper.addToolMaterial("Felsteel", 4, 2000, 8.0f, 3.0f, 20); public static Item felsteel_sword; public static Item felsteel_pickaxe; public static Item felsteel_axe; public static Item felsteel_hoe; public static Item felsteel_shovel; public static Item felsteel_multitool; public static Item fel_bow; public static void init() { fel_essence = new Item().setCreativeTab(CreativeTabs.MISC).setMaxStackSize(64).setUnlocalizedName("fel_essence"); fel_ore = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setUnlocalizedName("fel_ore"); felsteel = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setUnlocalizedName("felsteel"); felsteel_hide = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setUnlocalizedName("felsteel_hide"); cured_leather_hide = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setUnlocalizedName("cured_leather_hide"); } public static void register() { GameRegistry.registerItem(fel_essence, fel_essence.getUnlocalizedName().substring(5)); GameRegistry.registerItem(fel_ore, fel_ore.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel, felsteel.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel_hide, felsteel_hide.getUnlocalizedName().substring(5)); GameRegistry.registerItem(cured_leather_hide, cured_leather_hide.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel_sword = new ItemModSword("felsteel_sword", Felsteel), felsteel_sword.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel_pickaxe = new ItemModPickaxe("felsteel_pickaxe", Felsteel), felsteel_pickaxe.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel_axe = new ItemModAxe("felsteel_axe", Felsteel), felsteel_axe.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel_hoe = new ItemModHoe("felsteel_hoe", Felsteel), felsteel_hoe.getUnlocalizedName().substring(5)); GameRegistry.registerItem(felsteel_shovel = new ItemModShovel("felsteel_shovel", Felsteel), felsteel_shovel.getUnlocalizedName().substring(5)); GameRegistry.registerItem(fel_helmet = new ItemModArmor("fel_helmet", FelArmor, 1, EntityEquipmentSlot.HEAD), fel_helmet.getUnlocalizedName ().substring(5)); GameRegistry.registerItem(fel_chestplate = new ItemModArmor("fel_chestplate", FelArmor, 1, EntityEquipmentSlot.CHEST), fel_chestplate.getUnlocalizedName ().substring(5)); GameRegistry.registerItem(fel_leggings = new ItemModArmor("fel_leggings", FelArmor, 1, EntityEquipmentSlot.LEGS), fel_leggings.getUnlocalizedName ().substring(5)); GameRegistry.registerItem(fel_boots = new ItemModArmor("fel_boots", FelArmor, 1, EntityEquipmentSlot.FEET), fel_boots.getUnlocalizedName ().substring(5)); GameRegistry.registerItem(felsteel_multitool = new ItemModMultitool("felsteel_multitool", Felsteel), felsteel_multitool.getUnlocalizedName().substring(5)); GameRegistry.registerItem(fel_bow = new ItemModBow("fel_bow", Felsteel), fel_bow.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender (fel_essence); registerRender (fel_ore); registerRender (felsteel); registerRender (felsteel_hide); registerRender (cured_leather_hide); registerRender (felsteel_sword); registerRender (felsteel_pickaxe); registerRender (felsteel_axe); registerRender (felsteel_hoe); registerRender (felsteel_shovel); registerRender (fel_helmet); registerRender (fel_chestplate); registerRender (fel_leggings); registerRender (fel_boots); registerRender (felsteel_multitool); registerRender (fel_bow); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName ().substring(5), "inventory")); } } Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 You should be using ModelLoader.setCustomModelResourceLocation instead of that thing you have in registerRender . Also don't use the unlocalized name to determine the model name (and not the registry name either, on that note), usually new ModelResourceLocation(item.getRegistryName(), "inventory") is appropriate for simple items. Okay now you've confused me, I'm relatively new to coding. Everything worked fine with what I had for registerRender, and I'm not sure how I should use the ModeLoader thing? Also you will need to mimic what ItemBow does in it's constructor for the "pull" property override, since it is hardcoded to only support Items.BOW . I was trying to figure that out before I created this thread, I couldnt seem to get it right. Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 This is my preInit.. @EventHandler public void preInit(FMLPreInitializationEvent event) { FelItems.init(); FelItems.register(); FelBlocks.init(); FelBlocks.register(); you want me to put it there? And I'm still uncertain on how to do the method, new ModelResourceLocation(item.getRegistryName(), "inventory"); What else? And I'm not certain what all to mimic from ItemBow.class, so this is what I have now, the IItemPropertyGetter(); is throwing me off. public class ItemModBow extends ItemBow { public ItemModBow(String unlocalizedName, ToolMaterial material) { this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(CreativeTabs.COMBAT); this.setMaxStackSize(1); this.addPropertyOverride(new ResourceLocation("pull"), IItemPropertyGetter(); sorry if I'm being difficult or anything, I'm just having a hard time wrapping my mind around this bit, but I appreciate your help thus far. Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Now you call this registerRender from registerRenders . Both of these methods need to move into your client proxy. In your client proxy you call registerRenders I assume, currently from init. Change it to preInit. I think I got everything else you said, but this bit is confusing. I'm looking at 3 classes right now: Client Proxy public class ClientProxy extends CommonProxy { @Override public void registerRenders() { FelItems.registerRenders(); FelBlocks.registerRenders(); } } Main Mod class public void preInit(FMLPreInitializationEvent event) { FelItems.init(); FelItems.register(); FelBlocks.init(); FelBlocks.register(); Items class public static void init() { } public static void register() { GameRegistry.registerItem(fel_bow = new ItemModBow(), fel_bow.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender (fel_bow); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem();ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getRegistryName(), "inventory")); //let me know if i got anything wrong here. } } Now, what changes to what and where? Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Took care of the other things you mentioned, but I'm not sure what you mean by where is the method called from? Quote
Draco18s Posted July 3, 2016 Posted July 3, 2016 Functions are not invoked by magic just because you wrote it. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Well, that's a given, don't ya think? Quote
Draco18s Posted July 3, 2016 Posted July 3, 2016 So....where do you invoke it? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 I have no idea, that's what I'm not understanding. Care to help? Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Nevermind, had to look at another forum to figure that out. It was being called from Init(FMLInitializationEvent..), I just moved it to preInit. Now what, cause everything seems broken now Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 can't figure out github for some reason. again, I'm new to this. Main mod class package com.pyro13.tut.client; import com.pyro13.tut.init.FelBlocks; import com.pyro13.tut.init.FelItems; import com.pyro13.tut.proxy.CommonProxy; import com.pyro13.tut.world.FelWorldGen; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Metadata; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION) public class FelMod { @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.registerRenders(); FelItems.init(); FelItems.register(); FelBlocks.init(); FelBlocks.register(); } @EventHandler public void Init(FMLInitializationEvent event) { GameRegistry.registerWorldGenerator(new FelWorldGen(), 0); //GameRegistry.registerFuelHandler(new TutFuelHandler()); //Item Recipes GameRegistry.addRecipe(new ItemStack(FelItems.felsteel), "EEE", "EIE", "EEE", 'E', FelItems.fel_essence, 'I', Items.IRON_INGOT); GameRegistry.addShapelessRecipe(new ItemStack(FelItems.felsteel_hide), new Object[]{FelItems.cured_leather_hide, FelItems.cured_leather_hide, FelItems.felsteel, FelItems.felsteel}); GameRegistry.addRecipe(new ItemStack(FelBlocks.felsteel_block), "FFF", "FFF", "FFF", 'F', FelItems.felsteel); GameRegistry.addShapelessRecipe(new ItemStack(FelItems.felsteel, 9), new Object[]{FelBlocks.felsteel_block}); //Tool Recipes GameRegistry.addRecipe(new ItemStack(FelItems.felsteel_sword), "*F*", "*F*", "*S*", 'F',FelItems.felsteel, 'S', Items.STICK); GameRegistry.addRecipe(new ItemStack(FelItems.felsteel_pickaxe), "FFF", "*S*", "*S*", 'F',FelItems.felsteel, 'S', Items.STICK); GameRegistry.addRecipe(new ItemStack(FelItems.felsteel_axe), "FF*", "FS*", "*S*", 'F',FelItems.felsteel, 'S', Items.STICK); GameRegistry.addRecipe(new ItemStack(FelItems.felsteel_shovel), "*F*", "*S*", "*S*", 'F',FelItems.felsteel, 'S', Items.STICK); GameRegistry.addRecipe(new ItemStack(FelItems.felsteel_hoe), "FF*", "*S*", "*S*", 'F',FelItems.felsteel, 'S', Items.STICK); //Armor Recipes GameRegistry.addRecipe(new ItemStack(FelItems.fel_helmet), "LFL", "FLF", "L*L", 'F',FelItems.felsteel, 'L', FelItems.felsteel_hide); GameRegistry.addRecipe(new ItemStack(FelItems.fel_chestplate), "F*F", "FLF", "FLF", 'F',FelItems.felsteel, 'L', FelItems.felsteel_hide); GameRegistry.addRecipe(new ItemStack(FelItems.fel_leggings), "FFF", "FLF", "LLL", 'F',FelItems.felsteel, 'L', FelItems.felsteel_hide); GameRegistry.addRecipe(new ItemStack(FelItems.fel_boots), "L*L", "FLF", "FLF", 'F',FelItems.felsteel, 'L', FelItems.felsteel_hide); //Smelting GameRegistry.addSmelting(FelItems.fel_ore, new ItemStack(FelItems.fel_essence), 15.0f); GameRegistry.addSmelting(Items.LEATHER, new ItemStack(FelItems.cured_leather_hide), 15.0f); GameRegistry.addSmelting(FelItems.fel_boots, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.fel_chestplate, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.fel_helmet, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.fel_leggings, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.felsteel_sword, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.felsteel_axe, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.felsteel_pickaxe, new ItemStack(FelItems.felsteel), 2.0f); GameRegistry.addSmelting(FelItems.felsteel_shovel, new ItemStack(FelItems.fel_essence, 3), 2.0f); GameRegistry.addSmelting(FelItems.felsteel_hoe, new ItemStack(FelItems.felsteel), 2.0f); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Client Proxy package com.pyro13.tut.proxy; import com.pyro13.tut.init.FelBlocks; import com.pyro13.tut.init.FelItems; public class ClientProxy extends CommonProxy { @Override public void registerRenders() { FelItems.registerRenders(); FelBlocks.registerRenders(); } } Items class package com.pyro13.tut.init; import com.pyro13.tut.client.Reference; import com.pyro13.tut.item.ItemModArmor; import com.pyro13.tut.item.ItemModAxe; import com.pyro13.tut.item.ItemModBow; import com.pyro13.tut.item.ItemModHoe; import com.pyro13.tut.item.ItemModMultitool; import com.pyro13.tut.item.ItemModPickaxe; import com.pyro13.tut.item.ItemModShovel; import com.pyro13.tut.item.ItemModSword; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; public class FelItems { //items public static Item fel_essence; public static Item fel_ore; public static Item felsteel; public static Item felsteel_hide; public static Item cured_leather_hide; //armor public static ArmorMaterial FelArmor = EnumHelper.addArmorMaterial("FelArmor", "fel:fel", 50, new int[]{4,9,6,3}, 64, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F); public static Item fel_helmet; public static Item fel_chestplate; public static Item fel_leggings; public static Item fel_boots; //tools public static ToolMaterial Felsteel = EnumHelper.addToolMaterial("Felsteel", 4, 2000, 8.0f, 3.0f, 20); public static Item felsteel_sword; public static Item felsteel_pickaxe; public static Item felsteel_axe; public static Item felsteel_hoe; public static Item felsteel_shovel; public static Item felsteel_multitool; public static Item fel_bow; public static void init() { fel_essence = new Item().setCreativeTab(CreativeTabs.MISC).setMaxStackSize(64).setRegistryName("fel_essence"); fel_ore = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("fel_ore"); felsteel = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("felsteel"); felsteel_hide = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("felsteel_hide"); cured_leather_hide = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("cured_leather_hide"); } public static void register() { GameRegistry.register(fel_essence, fel_essence.getRegistryName()); GameRegistry.register(fel_ore, fel_ore.getRegistryName()); GameRegistry.register(felsteel, felsteel.getRegistryName()); GameRegistry.register(felsteel_hide, felsteel_hide.getRegistryName()); GameRegistry.register(cured_leather_hide, cured_leather_hide.getRegistryName()); GameRegistry.register(felsteel_sword = new ItemModSword("felsteel_sword", Felsteel), felsteel_sword.getRegistryName()); GameRegistry.register(felsteel_pickaxe = new ItemModPickaxe("felsteel_pickaxe", Felsteel), felsteel_pickaxe.getRegistryName()); GameRegistry.register(felsteel_axe = new ItemModAxe("felsteel_axe", Felsteel), felsteel_axe.getRegistryName()); GameRegistry.register(felsteel_hoe = new ItemModHoe("felsteel_hoe", Felsteel), felsteel_hoe.getRegistryName()); GameRegistry.register(felsteel_shovel = new ItemModShovel("felsteel_shovel", Felsteel), felsteel_shovel.getRegistryName()); GameRegistry.register(fel_helmet = new ItemModArmor("fel_helmet", FelArmor, 1, EntityEquipmentSlot.HEAD), fel_helmet.getRegistryName()); GameRegistry.register(fel_chestplate = new ItemModArmor("fel_chestplate", FelArmor, 1, EntityEquipmentSlot.CHEST), fel_chestplate.getRegistryName()); GameRegistry.register(fel_leggings = new ItemModArmor("fel_leggings", FelArmor, 1, EntityEquipmentSlot.LEGS), fel_leggings.getRegistryName()); GameRegistry.register(fel_boots = new ItemModArmor("fel_boots", FelArmor, 1, EntityEquipmentSlot.FEET), fel_boots.getRegistryName()); GameRegistry.register(felsteel_multitool = new ItemModMultitool("felsteel_multitool", Felsteel), felsteel_multitool.getRegistryName()); GameRegistry.register(fel_bow = new ItemModBow(), fel_bow.getRegistryName()); } public static void registerRenders() { registerRender (fel_essence); registerRender (fel_ore); registerRender (felsteel); registerRender (felsteel_hide); registerRender (cured_leather_hide); registerRender (felsteel_sword); registerRender (felsteel_pickaxe); registerRender (felsteel_axe); registerRender (felsteel_hoe); registerRender (felsteel_shovel); registerRender (fel_helmet); registerRender (fel_chestplate); registerRender (fel_leggings); registerRender (fel_boots); registerRender (felsteel_multitool); registerRender (fel_bow); } public static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } Bow class package com.pyro13.tut.item; import javax.annotation.Nullable; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ItemModBow extends ItemBow { public ItemModBow() { this.maxStackSize = 1; this.setRegistryName(getRegistryName()); this.setMaxDamage(384); this.setCreativeTab(CreativeTabs.COMBAT); this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { if (entityIn == null) { return 0.0F; } else { ItemStack itemstack = entityIn.getActiveItemStack(); return itemstack != null && itemstack.getItem() == Items.BOW ? (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F; } } }); this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F; } }); } } Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 I have seperate classes for all my tools and things. Pickaxe, for example package com.pyro13.tut.item; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemPickaxe; public class ItemModPickaxe extends ItemPickaxe{ public ItemModPickaxe(String unlocalizedName, ToolMaterial material) { super(material); this.setRegistryName(getRegistryName()); this.setCreativeTab(CreativeTabs.TOOLS); this.setMaxStackSize(1); } } I set the registry name there, does that not do it? Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 Alright well at this point I'm a little confused on why I've done all this so far, everything worked perfectly fine before hand and now its all screwed up. But anyways, I'm already here, now I just gotta fix it. • Is my init, preInit stuff all straight? with the client proxy and all that? • Is it just the registry that's messed up now? • How exactly would I set the registryname and do the register method? Quote
pyromaniac13_ Posted July 3, 2016 Author Posted July 3, 2016 fel_essence = new Item().setCreativeTab(CreativeTabs.MISC).setMaxStackSize(64).setRegistryName("fel_essence"); fel_ore = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("fel_ore"); felsteel = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("felsteel"); felsteel_hide = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("felsteel_hide"); cured_leather_hide = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setRegistryName("cured_leather_hide"); I already set the registry name. Did you miss that or something? Got me all confused thinking I didnt. Also, not only does my bow still not function properly, but I can't even start the game. So, after what it seems like following all of your instructions, what am I missing? Quote
yooksi Posted October 9, 2016 Posted October 9, 2016 I've been searching forever even through minecraft's code, and I cant figure out how to get the custom bow animations to work. Right now I'm just trying to get a basic bow for my mod working, based off the vanilla bow. Everything works fine except the pulling animations. The standby texture is fine, but the pulling_ textures don't work. I'm guessing its the resource location override that I need to do? But I'm not sure how that works. Any help would be great. Thank you for asking this question, I am having the same problem. Reading through the thread now. Quote I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java. Follow me on GitHub: https://github.com/yooksi Contact me on Twitter: https://twitter.com/yooksi Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/
yooksi Posted October 9, 2016 Posted October 9, 2016 For anyone else who might be having the same issue and wants to create custom bows without custom models, this is how I did it: link to the solution on GitHub. Hope it helps. Quote I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java. Follow me on GitHub: https://github.com/yooksi Contact me on Twitter: https://twitter.com/yooksi Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/
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.