Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have a block, "SummonerEmpty" which has variants. They all render correctly in the world, and the ItemBlocks for them seem to function correctly (eg: they place the correct blocks)

However, all the ItemBlocks, when in inventory slots, are the "missing texture", while held they are the "missing texture" block.

This is my currrent block class:

public class SummonerEmpty extends ModBlock {

	public static final IProperty<EndersteelType> VARIANT = PropertyEnum.create("variant", EndersteelType.class);

	public SummonerEmpty() {
		super("summoner_empty", new Material(MapColor.STONE).setTransparent());
		setHasItem();
		setHardness(5F);
		setResistance(30F);
		setHarvestLevel("pickaxe", 1);
		setSoundType(SoundType.METAL);
		setDefaultState(getDefaultState().withProperty(VARIANT, EndersteelType.NORMAL));
	}

	@Override
	protected BlockStateContainer createBlockState() {
		List<IProperty<?>> props = new ArrayList<>(super.createBlockState().getProperties());
		props.add(VARIANT);
		return new BlockStateContainer(this, props.toArray(new IProperty<?>[0]));
	}

	@Override
	public IBlockState getStateFromMeta(int meta) {
		return getDefaultState().withProperty(VARIANT, EndersteelType.byMetadata(meta));
	}

	@Override
	public int getMetaFromState(IBlockState state) {
		return state.getValue(VARIANT).getMeta();
	}

	@Override
	public int damageDropped(IBlockState state) {
		return getMetaFromState(state);
	}

	@Override
	public void getSubBlocks(CreativeTab tab, NonNullList<ItemStack> list) {
		for (EndersteelType enumType : EndersteelType.values()) {
			Logger.info("" + enumType.getMeta());
			list.add(new ItemStack(this, 1, enumType.getMeta()));
		}
	}

	@Override
	public ItemBlock getItemBlock() {
		ItemBlock result = new ItemBlock(this) {
			@Override
			public int getMetadata(int damage) {
				return damage;
			}
		};

		result.setRegistryName(getRegistryName());

		return result;
	}
}


And then models/item/summoner_empty.json:

{
	"parent": "soulus:block/summoner"
}


Which inherits models/block/summoner.json:

{
	"parent": "minecraft:block/cube_all",
	"textures": {
		"all": "soulus:blocks/summoner_normal"
	}
}


I know this wouldn't work for the variants, because it only specifies the normal texture, but I would have expected this to show that texture for all of them, instead of texture erroring... I'm assuming I'm missing something pretty basic for the variants to work?

[solved, this was like 10 billion different issues all rolled into one]

Edited by Aarilight

Block models are automatically registered, but item models are not. You need to call ModelLoader.setCustomModelResourceLocation for your item if you want the model to load properly.

Whatever Minecraft needs, it is most likely not yet another tool tier.

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.