diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java b/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java index 222efc9c4b..a0e1545255 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java @@ -17,15 +17,22 @@ import java.io.DataOutput; import java.io.IOException; import static io.anuke.mindustry.Vars.content; +import static io.anuke.mindustry.Vars.threads; public class SortedUnloader extends Unloader implements SelectionTrait{ protected float speed = 1f; + private static Item lastItem; public SortedUnloader(String name){ super(name); configurable = true; } + @Override + public void playerPlaced(Tile tile){ + threads.runDelay(() -> Call.setSortedUnloaderItem(null, tile, lastItem)); + } + @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void setSortedUnloaderItem(Player player, Tile tile, Item item){ SortedUnloaderEntity entity = tile.entity(); @@ -65,7 +72,10 @@ public class SortedUnloader extends Unloader implements SelectionTrait{ @Override public void buildTable(Tile tile, Table table){ SortedUnloaderEntity entity = tile.entity(); - buildItemTable(table, () -> entity.sortItem, item -> Call.setSortedUnloaderItem(null, tile, item)); + buildItemTable(table, () -> entity.sortItem, item -> { + lastItem = item; + Call.setSortedUnloaderItem(null, tile, item); + }); } @Override