(4.0.0 - 4.21.1) 2.0.2 (4.0.0 - 4.21.1) 2.0.1 (4.0.0 - 4.21.1) 2.0.0 (4.0.0 - 4.21.1) 1.3.0 (4.11.0 - 4.21.1) 2.1.0 (5.0.0 - 5.16.0) 2.2.2
557
Read more on poggitIn pm4, hopper blocks were implemented to have an inventory. But the logic for pushing, pulling and picking up items was missing nonetheless. This plugin aims to add this logic to the hopper.
Normally a hopper should run a block update every tick to reduce and check its cooldown if it has expired. Because it is highly inefficient to update all loaded hoppers every tick, just for letting them reduce their cooldown by one, the block update of hoppers is always scheduled to the expiration of their cooldown and not directly the next tick. To prevent any issues with the cooldown, hoppers are saving in which tick they were lastly updated to prevent them from updating too early.
Customizations can be done in the config.yml
in the plugin's plugin_data
folder:
hopper.transferCooldown
: 8
hopper.itemsPerUpdate
: 1
hopper.alwaysSetCooldown
: false
hopper.updatesPerTick
: 0
Every information about the logic for pushing, pulling and picking up items came from the minecraft fandom wiki.
Minecraft's hopper logic is very complex. To prevent anybody from getting confused about how certain things were done, most parts were commented to explain what was done and why.
I did, but it was stated that hopper logic won't be implemented in pm4 and because I didn't want to maintain a PR for the time till pm5, I closed it. Still, I wanted to use that logic in a plugin to use it myself and therefore I created this.
Functionality tests
"Performance" tests
class EventListener implements Listener
) in your plugin and import (use
keyword) them by their namespace (event name
: namespace
).BlockItemPickupEvent
: pocketmine\event\block\BlockItemPickupEvent
HopperEvent
: ColinHDev\VanillaHopper\events\HopperEvent
HopperPushEvent
: ColinHDev\VanillaHopper\events\HopperPushEvent
HopperPushContainerEvent
: ColinHDev\VanillaHopper\events\HopperPushContainerEvent
HopperPushJukeboxEvent
: ColinHDev\VanillaHopper\events\HopperPushJukeboxEvent
HopperPullEvent
: ColinHDev\VanillaHopper\events\HopperPullEvent
HopperPullContainerEvent
: ColinHDev\VanillaHopper\events\HopperPullContainerEvent