Jump to content

[1.16.5] [Forge 36.2.34] Cast Custom Item In Vanilla Honey Bottle Class


Recommended Posts

Hi i would like some help to cast my custom item into a method Vanilla Minecraft uses to return an empty bottle to the player after the use, the class i'm using as pattern it's "HoneyBottleItem" (forge_snapshot > net > minecraft > item > HoneyBottleItem).

The issue i'm occurring it's not recognizing the custom item of the mod, substituted with the glass bottle of Minecraft, here's my version:


package net.alexmaster75.tea.item.custom;

import net.alexmaster75.tea.item.TeaItems;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.stats.Stats;
import net.minecraft.world.World;

public class TeaCupConsume extends Item {
    public TeaCupConsume(Properties properties) {

    public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
        super.onItemUseFinish(stack, worldIn, entityLiving);
        if (entityLiving instanceof ServerPlayerEntity) {
            ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)entityLiving;
            CriteriaTriggers.CONSUME_ITEM.trigger(serverplayerentity, stack);

        if (stack.isEmpty()) {
            return new ItemStack(TeaItems.EMPTY_CUP); // <- Error: Required type: IItemProvider
																// Provided: RegistryObject <net.minecraft.item.Item>
        } else {
            if (entityLiving instanceof PlayerEntity && !((PlayerEntity)entityLiving).abilities.isCreativeMode) {
                ItemStack itemstack = new ItemStack(TeaItems.EMPTY_CUP); // <- Same error
                PlayerEntity playerentity = (PlayerEntity)entityLiving;
                if (!playerentity.inventory.addItemStackToInventory(itemstack)) {
                    playerentity.dropItem(itemstack, false);

            return stack;


^ My Version

It may seem a stupid error but i'm not getting the solution


Edited by Alexmaster75
Removed Vanilla code
Link to comment
Share on other sites

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.

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.

  • Create New...

Important Information

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