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

  • Author

Where can I find where Forge references the bow to change it's texture? Or does the bow implement it's features differently than the way you explained it? Looking at example codes help me learn the best I think.

EDIT: Oh, I think I understand what you mean. I found https://mcforge.readthedocs.io/en/latest/models/overrides/ which seems pretty close to what I want. So from what I am understanding, I am defining a new "predicate" for the item to recognize within the json file?

My next question is, where do I insert the FMLClientSetupEvent event?
I figured out where to put it! I have trouble editing this line to have it reflect with the number of stacks:
return entity != null && stack.getCount() && entity.getActiveItemStack() == stack ? 1.0F : 0.0F;

I am assuming I don't need to check if entity is null or not but only have it register the number of item stack?

Edited by Sinu

  • Author

I think I got a hang of what I should be doing but I think I am doing something wrong.
My json file looks like this which I think is correct:

{
	"parent": "item/generated",
	"textures": {
		"layer0": "brimheim:items/coin_bronze"
	},
	"overrides": [
		{
			"predicate": {
				"brimheim:stack": 16
			},
			"model": "brimheim:item/coin_bronze_stack"
		},
		{
			"predicate": {
				"brimheim:stack": 32
			},
			"model": "brimheim:item/coin_bronze_bag"
		}
	]
}

and this is my FMLClientSetupEvent event:

@Mod.EventBusSubscriber(modid = Brimheim.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class BrimheimClient
{
	@SubscribeEvent
	public void setModelProperties(final FMLClientSetupEvent event)
	{
		event.enqueueWork(() ->
		{
			ItemModelsProperties.register(BrimheimItems.COIN_BRONZE.get(), 
				new ResourceLocation(Brimheim.MODID, "stack"), (stack, world, entity) -> {
	        return stack.getCount();
	        });
		});
	}
}

Also, I am not sure if the event method should be public or private. When I had it on private, I had a java.lang.RuntimeException: Illegal private member with @SubscribeEvent annotation error.

Edited by Sinu

  • Author

Actually I figured it out. Instead of doing SubscribeEvent, I just registered it to my main method with: 

FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

private void doClientStuff(FMLClientSetupEvent event) {
		event.enqueueWork(() ->
		{
			ItemModelsProperties.register(BrimheimItems.COIN_BRONZE.get(), 
				new ResourceLocation(Brimheim.MODID, "stack"), (stack, world, entity) -> {
	        return stack.getCount();
	        });
		});
    }

 

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.