Jump to content

Recommended Posts

Posted (edited)

I have an ItemBlock connected that's tied to a block and I want it to be wearable as a helmet (it's a mob skull) and I have the block fully working but when I put it on as a helmet it just uses the JSON model for the Item (a flat texture) instead of the armor model that I define in the ItemBlock class.

//In the itemblock class:
@Override
	public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) {
		return armorType == EntityEquipmentSlot.HEAD;
	}

	@Override
	public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
	{
		return Ref.MOD_ID + ":textures/entites/hirschgeist.png";
	}

	@Override 	
	@SideOnly(Side.CLIENT)
	public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot,
			ModelBiped defaultModel) {
		return ClientProxy.helmetModel;
	}

//Client Proxy
public static final ModelHirschgeistSkullArmorPiece helmetModel = new ModelHirschgeistSkullArmorPiece(0.0625F);

//Block registry events

		/**
		 * Register this mod's {@link Block}s.
		 *
		 * @param event The event
		 */
		@SubscribeEvent
		public static void registerBlocks(final RegistryEvent.Register<Block> event) {
			final IForgeRegistry<Block> registry = event.getRegistry();

			final Block[] blocks = {
					trillium,
					hirschgeistskull,
			};

			registry.registerAll(blocks);

			GameRegistry.registerTileEntity(TileEntityTrillium.class, new ResourceLocation(Ref.MOD_ID + ":" + trillium.getRegistryName()));
			GameRegistry.registerTileEntity(TileEntityHirschgeistSkull.class, Ref.MOD_ID + ":" + hirschgeistskull.getRegistryName());
		}


		/**
		 * Register this mod's {@link ItemBlock}s.
		 *
		 * @param event The event
		 */
		@SubscribeEvent
		public static void registerItemBlocks(final RegistryEvent.Register<Item> event) {
			final ItemBlock[] items = {
					new ItemBlock(trillium),
					hirschgeistskull.getItemBlock(),
			};

			final IForgeRegistry<Item> registry = event.getRegistry();

			for (final ItemBlock item : items) {
				final Block block = item.getBlock();
				final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block);
				registry.register(item.setRegistryName(registryName));
				ITEM_BLOCKS.add(item);
			}
		}

 

How should I be registering the model?

The Block is a TE with a TESR and that's registered, but I'm not sure how I should register my model.

If I use ModelLoader.setCustomModelResourceLocation it's just the item texture on my head, not the java model. I put a print statement in getArmorModel and it doesn't seem like it's running.

By the way, getItemBlock(); returns a new instance of my ItemBlock class.

Edited by hiotewdew
Posted

How dynamic is your block? Does it need a TESR or can it be rendered with a custom baked model? If it can be rendered with a custom model, do it this way for the block first, then work on the item model. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
16 hours ago, Cadiboo said:

How dynamic is your block? Does it need a TESR or can it be rendered with a custom baked model? If it can be rendered with a custom model, do it this way for the block first, then work on the item model. 

I cannot bake it, no.

Posted (edited)

Bump

 

Here's my code:

http://github.com/itsmeow/betteranimalsplus

Edited by hiotewdew
Posted

I made a seperate wearable item and a seperate placeable item instead of an ItemBlock with armor attributes.

 

Apparently minecraft requires it to extend ItemArmor for getArmorModel() to work.

A shame.

Posted
56 minutes ago, hiotewdew said:

I made a seperate wearable item and a seperate placeable item instead of an ItemBlock with armor attributes.

 

Apparently minecraft requires it to extend ItemArmor for getArmorModel() to work.

A shame.

You could copy most of the code from ItemBlock and put it into your ItemArmor class

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
57 minutes ago, Cadiboo said:

You could copy most of the code from ItemBlock and put it into your ItemArmor class

I could, but the Block Registry requires it to extend ItemBlock.

Posted

No forge registry requires you to have an item be an ItemBlock

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.