Jump to content

[1.9] Make enchantment table not consume item?


iWasHere

Recommended Posts

Hey all, I'm trying to make an item that basically acts like an infinite source of lapis lazuli. You can use it to dye wool/sheep without consuming the item. However, there seems to be one problem.

 

Because the vanilla enchantment table uses lapis to enchant items since 1.8, you can use this item that cannot be consumed to enchant items. The problem is, the item is consumed when you enchant, as lapis normally is.

 

I've tried to see if there's some sort of event for enchanting items in the table, and there isn't. I can't find any possible method to make it so the enchant table doesn't consume my item. I've done several searches, and I guess I'm the only one that's tried this (given, it's a pretty specific problem).

 

Do you guys have any ideas on what I could do to solve this? Thanks for your time.

Link to comment
Share on other sites

Alright, I tried this out. It looks like it had some effect on the inventory, the only problem being that the enchantment table itself ceases to function. It acts like the item in the enchanting slot is already enchanted, no options to enchant or anything, even with vanilla lapis in the table.

 

Here's the code in the inventory class for getting the stack (where lapisGem is my item):

 

    @Override
    public ItemStack getStackInSlot(int index) {
        ItemStack stack = iInventory.getStackInSlot(index);
        if (stack.getItem().equals(RegisterItems.lapisGem)){
            stack = new ItemStack(Items.dye,64,4);
        }
        return stack;
    }

 

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.

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.