Skip to content

better hopper optimize #743

Open
Open

Description

@moonstars-github

when hoppers more(huge storage system), it lag was still huge
Image
this scene no any item in hoppers and barrels, hopper render like that because resource pack(let hopper rending faster)

Describe alternatives you've considered
this is my simple opinion, I'm not a professor of java, and something inaccurate explanation because it may not like vanilla, but I think it can help

hopper have CD 8 ticks, if there have thousands of hoppers, calculate their CD is hard
so create 8 queues, when the hopper need to work, calculate when(day time) and join queue {daytime_when_it_need_run}%8, in every tick just need to calculate only one queue
use process queue can avoid to calculate the CD

at the first time to load a chunk, scan all the hopper and check it need to work or not
if it need to work, add them in process queue

when a hopper process, if it can't have any operation, and the hopper under it can't get item in it,remove it in the queue.
↑ ok, I just this part may not like vanilla, so wait for sometime I'll try to make another vanilla like optimization algorithm

if there have a item update(players put something in a chest or other item operation), check block near it
if some hopper need to calculate, join it to this process queue

check the position of the item, hopper_minecrat chest_minecrat and so on, if under them is hopper, add them in process queue

Activity

  1. added
    T-enhancement
    on May 24, 2026
  2. 2No2Name commented on May 28, 2026

    @2No2Name
    Member

    Since all the hoppers in your setup are empty, the lag is coming from attempting to tick the sleeping hoppers. It is possible to optimize this further by implementing a custom list that allows skipping inactive elements.

    I think the cooldown optimization for transferring hoppers may be viable, it cannot be applied to hoppers that do not have a cooldown though

  3. 2No2Name commented on May 28, 2026

    @2No2Name
    Member

    Lithium already has a huge hopper optimization, I think future work includes reducing its complexity

  4. moonstars-github commented on Jun 14, 2026

    @moonstars-github
    Author

    This algorithm was developed by me during my free time, so there may be issues. However, I will do my best to modify it to align with the original logic and enhance its performance within this framework. I also hope that the Lithium mod can bring better performance to Minecraft redstone players without sacrificing compatibility as much as possible. Additionally, I would like to thank all the players who have contributed to optimizing Minecraft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions