Jump to content

[1.10.2] Trouble registering item variants for custom logs


Recommended Posts

Posted

I have created some custom logs (in my mod, you can harvest bark from logs, leaving a stripped log). I'm updated to 1.10.2 and trying to register the item models for the log variants. I know I'm doing something wrong, but can't figure out what it is.

 

I have two log classes that mimic the old and new log classes from vanilla, and I have my own enum that specifies the log types. I need to register both log blocks, and all the variants for the items. Here's what I have so far.

 

My block registry:

public final class PrimalBlockRegistry
{
public static Block logStrippedOld = new PrimalBlockStrippedLogOld("log_stripped_old");
public static Block logStrippedNew = new PrimalBlockStrippedLogNew("log_stripped_new");
}

public static void createBlocks()
{
	registerBlockLogs(logStrippedOld, logStrippedNew);
}


private static void registerBlockLogs(Block block1, Block block2)
{
	GameRegistry.register(block1);
	GameRegistry.register(block2);
	for (EnumWoodType woodType : EnumWoodType.values())
	{
//			System.out.println("woodType: " + itemBlock);
		if (woodType.getMetadata() <= 3)
		{
			ItemBlock itemBlock = new ItemBlock(block1);
			itemBlock.setRegistryName(woodType.getName());
			GameRegistry.register(itemBlock);
			ModelLoader.setCustomModelResourceLocation(itemBlock, woodType.getMetadata(), new ModelResourceLocation(block1.getRegistryName(), "axis=y,variant=" + woodType.getName()));
		}
		if (woodType.getMetadata() >= 4)
		{
			ItemBlock itemBlock2 = new ItemBlock(block2);
			itemBlock2.setRegistryName(woodType.getName());
			GameRegistry.register(itemBlock2);
			ModelLoader.setCustomModelResourceLocation(itemBlock2, woodType.getMetadata(), new ModelResourceLocation(block2.getRegistryName(), "axis=y,variant=" + woodType.getName()));
		}
	}
}

 

The problem is I'm seeing only the four old log variants in my creative inventory, plus about 20 additional untextured items, and they are all named "tile.primalcraft:log_stripped_old:name" or "tile.primalcraft:log_stripped_new:name", and they all use the default texture (oak for old logs, acacia for new logs).

 

My wood type enum:

 

  Reveal hidden contents

 

 

My old log block class:

 

  Reveal hidden contents

 

 

My blockstate json for the old log (the new log is essentially the same, but for dark oak and acacia):

 

  Reveal hidden contents

 

 

Each type of wood has three block models (for the three axes) and one item model. Examples:

 

Block model log_oak_stripped:

 

  Reveal hidden contents

 

 

Block model log_oak_stripped_bare:

 

  Reveal hidden contents

 

 

Block model log_oak_stripped_side:

 

  Reveal hidden contents

 

 

Item model for oak:

 

  Reveal hidden contents

 

Posted

Anyone? I've been wrestling this for hours. Apparently I don't understand what Forge wants from me. When I print the unlocalized name to the console as I register each item model, it appears correct as, for example, "primalcraft:log_oak_stripped". But when I run the game, it appears as "primalcraft:log_stripped_old". And there's all these extra untextured items with the same name in the creative inventory. Here's a screen shot of what it looks like. http://screencast.com/t/Q0QFvdqa

Posted

Minecraft's implementation of logs is pretty poor and I would not emulate it if i were u. Rather, I would just make a cuatom generic block log class and make each log its own block and have facing block states.

Posted

I think there are those who would argue with you. One advantage of Minecraft's implementation is that it limits the number of blocks you have to register, and that helps with large modpacks.

 

If rewriting my log classes is what it takes, I may just have to go that direction. Sigh.

Posted

The opposite of that is that minecraft now has too many logs and are having to make classes like logs_old and logs_new which seems like it's time to make the individual blocks. I do agree that using that kind of implementation on a small scale is beneficial but not for such a ubiquitous block type like a log.

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.