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 made a custom potion item that extends PotionItem and it works perfectly. I provided it with a multi-layer model with two layers, one for the "glass bottle" and one for the "potion liquid". However, when I loaded in, all of the custom potions used the same, default texture. So I went into ItemColors and tried to replicate the code that registers the colors of other potion variants using PotionUtils.getColor. Even though the game didn't crash, the colors of the potions didn't change.

I've checked multiple threads on this forum about similar issues, but they are either outdated and some of the methods don't work or they are only tangentially related.

TLDR: How do I change the color of my custom potions' texture to match the effect?

Here is my code for my potion item:

//Commented out imports

public class GelledPotionItem extends PotionItem
{
	public GelledPotionItem(Item.Properties builder)
	{
		super(builder);
	}
	public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) 
	{
		return null;
	}
	public int getUseDuration(ItemStack stack)
	{
		return 0;
	}
	public UseAction getUseAction(ItemStack stack) 
	{
		return null;
	}
	public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) 
	{
		return null;
		
	}
}

Here is my main class:

// Commented out imports

// The value here should match an entry in the META-INF/mods.toml file
@Mod("minormagicks")
public class MinorMagicks
{
	public static MinorMagicks instance;
    private static final Logger LOGGER = LogManager.getLogger();
    public static final String MOD_ID = "minormagicks";
    public MinorMagicks() 
    {
    	instance = this;
    	
    	final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
    	
        modEventBus.addListener(this::setup);
        modEventBus.addListener(this::doClientStuff);
       
        ItemRegistryHandler.ITEMS.register(modEventBus);
        PotionRegistryHandler.POTIONS.register(modEventBus);
        MinecraftForge.EVENT_BUS.register(this);
        MinecraftForge.EVENT_BUS.register(new MinorMagicksForgeEventHandler());

    }

    private void setup(final FMLCommonSetupEvent event)
    {
    	MagicksItemColors.registerColors();
    	PotionRegistryHandler.replaceRecipes();
    	MagicksPotionBrewing.init();
    }
    private void doClientStuff(final FMLClientSetupEvent event) 
    {
    	
    }
}

My model json for my item:

{
  "parent": "item/generated",
  "textures": {
	"layer0": "minormagicks:items/gelled_potion_liquid",
	"layer1": "minormagicks:items/gelled_potion"
  }
}

 

Edited by OberonPuck

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.