Since we're syncing anyway, make the client do a deferred refresh to allow syncing to occur, rather than trying to keep track of prev stacks itself

This commit is contained in:
Electroblob77
2020-04-12 23:00:23 +01:00
parent 8682fcbe91
commit e985bc6f69
2 changed files with 10 additions and 0 deletions
@@ -78,6 +78,8 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
private boolean sortDescending = false;
private String searchText = "";
public boolean needsRefresh;
public ContainerArcaneWorkbench(IInventory inventory, TileEntityArcaneWorkbench tileentity){
this.tileentity = tileentity;
@@ -351,6 +353,10 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
*/
private boolean mergeStackIntoBookshelves(ItemStack stack){
// As far as the client is concerned, which stacks were *previously* in which slots never affects whether a
// given book can fit or not, so as long as it refreshes it doesn't matter where the book actually gets put
if(tileentity.getWorld().isRemote) this.needsRefresh = true; // It's a bit clunky but it works!
// LinkedHashSet preserves iteration order whilst ignoring duplicates - neat!
Set<VirtualSlot> slots = new LinkedHashSet<>(bookshelfSlots.size());