Jump to content

titanknox

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by titanknox

  1. This event would be called something along the lines of ItemTakeEvent, and is fired when the player tries to click on an item to move it to a different slot. It should be cancellable, and should pass the EntityPlayer and the ItemStack. I already made a fork and implemented the feature, but when I made a pull request I was notified that the way I did it would probably hinder with some mods' functions. Here is an example showing how one might use the new Event: public class FilterEventHandler { @SubscribeEvent public void onItemTake(ItemTakeEvent event) { // Stop the player from being allowed to acquire TNT through an inventory. if (event.getItemStack().getItem().getRegistryName().toString().equals("minecraft:tnt")) { event.setCanceled(true); } } } The reason I thought of this event because I am currently making a mod called InventoryFilter that allows you to write a list of regular expressions. All items that would go into your inventory are compared against this filter either as a whitelist or blacklist. I already have item pickups filtered, but when trying to filter taking items from inventories, I found out there was no event readily made for that. Hope this can be implemented!
×
×
  • Create New...

Important Information

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