haveric / StackableItems

Minecraft Bukkit plugin that allows you to change the default stack size of items.
22 stars 17 forks source link

Support for item filters. #146

Open JVT038 opened 4 years ago

JVT038 commented 4 years ago

I wanted to create an item filter for Totem of Undying, but that doesn't work, because the comperator only creates an output signal of 1 redstone dust, so the traditional / most common item filter doesn't work. image Can you fix this?

haveric commented 4 years ago

I'm not entirely sure I understand the issue, so I'm hoping you can clarify what exactly you did to recreate only have one redstone signal. What's currently in the hopper? Did you place it in or drop it in?

StackableItems itself doesn't interfere with comparators currently and there is no way to tell the client that the max stack amount has changed, so it should be using the vanilla logic where a single totem should be getting you 3 signal.

JVT038 commented 4 years ago

I'm not entirely sure I understand the issue, so I'm hoping you can clarify what exactly you did to recreate only have one redstone signal. What's currently in the hopper? Did you place it in or drop it in?

StackableItems itself doesn't interfere with comparators currently and there is no way to tell the client that the max stack amount has changed, so it should be using the vanilla logic where a single totem should be getting you 3 signal.

If I put in 1 totem, it indeed gives me a 3 signal, but it doesn't filter it, because then it will automatically go down to the hopper and into wherever I store the things (a chest for example). So then the filter doesn't work anymore. And also if I make a hopper face into a chest with 1 totem, the totems coming into the chest from the hopper, won't be stacked, it won't be raised to 2, but it will be going to the next free / empty spot in the chest. That's also an issue. I'm not a Java programmer, so I don't know if this is hard / easy for you to fix, but I would appreciate it.

haveric commented 4 years ago

I can confirm that clicking the items into the inventory can sometimes trip up the logic and the items won't go through. If you drop them in one at a time, it doesn't seem to have any issues.

In terms of the general support for hoppers, I had originally removed support due to a duplication bug, which at the time was an unavoidable and unfortunate decision that had to be made. Now that I've dropped support for older versions, I will re-evaluate them and see if support can be added back in.

josiahseaman commented 4 years ago

I would really appreciate support for hoppers and item filters. I'm using items in shulker boxes pushed one at a time into the shulker to act as a filter. The sorter still ends up using vanilla stack sizes (16 ender pearls will stack up, then it moves to the next). I'm a mod developer myself, so I know you probably have better things to do, but I'd be happy to send you $20 if you could figure out hoppers and item filters. My issue is not with the comparator signal, just the vanilla stack size inside of hoppers and chests through redstone events.

haveric commented 4 years ago

@josiahseaman Unfortunately the Spigot/Bukkit API doesn't provide a good solution for this at this time, so any attempt I can do to implement hoppers will just result in duplication or items disappearing. Please feel free to stop by the discord if you have any suggestions or would like to know more about why it currently isn't possible.

josiahseaman commented 4 years ago

Thanks for the clarification. If it's going to be a pain, don't worry about it. After some feedback from my players, they didn't want the way that items stack in chests to change because of all the builds they already have. So I'm going to restrict my changes to player inventories and shulkers. That will empower people to carry around extra stuff but doesn't affect builds or redstone at all. Since hoppers are unaffected, it also means my sorting system using shulkers should be equally unaffected.

Here's my new configuration that did the trick:

allWorlds:
  default:
    MIN: -1
    MAX: -1
  inventory:
    chest:
      MIN: -1
      MAX: -1
    player,shulker_box:
      MIN: 64
      MAX: -1
      golden_sword: 1
      BLACK_SHULKER_BOX: -1
      BLUE_SHULKER_BOX: -1
      BROWN_SHULKER_BOX: -1
      CYAN_SHULKER_BOX: -1
      GRAY_SHULKER_BOX: -1
      GREEN_SHULKER_BOX: -1
      LIGHT_BLUE_SHULKER_BOX: -1
      LIGHT_GRAY_SHULKER_BOX: -1
      LIME_SHULKER_BOX: -1
      MAGENTA_SHULKER_BOX: -1
      ORANGE_SHULKER_BOX: -1
      PINK_SHULKER_BOX: -1
      PURPLE_SHULKER_BOX: -1
      RED_SHULKER_BOX: -1
      SHULKER_BOX: -1
      WHITE_SHULKER_BOX: -1
      YELLOW_SHULKER_BOX: -1
  player: {}

I excluded shulker boxes because of a duplication exploit combined with BetterShulkers.