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:
@@ -150,6 +150,10 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
|||||||
@Override
|
@Override
|
||||||
public void updateScreen(){
|
public void updateScreen(){
|
||||||
if(animationTimer > 0) animationTimer--;
|
if(animationTimer > 0) animationTimer--;
|
||||||
|
if(arcaneWorkbenchContainer.needsRefresh){
|
||||||
|
arcaneWorkbenchContainer.refreshBookshelfSlots();
|
||||||
|
arcaneWorkbenchContainer.needsRefresh = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
|
|||||||
private boolean sortDescending = false;
|
private boolean sortDescending = false;
|
||||||
private String searchText = "";
|
private String searchText = "";
|
||||||
|
|
||||||
|
public boolean needsRefresh;
|
||||||
|
|
||||||
public ContainerArcaneWorkbench(IInventory inventory, TileEntityArcaneWorkbench tileentity){
|
public ContainerArcaneWorkbench(IInventory inventory, TileEntityArcaneWorkbench tileentity){
|
||||||
|
|
||||||
this.tileentity = tileentity;
|
this.tileentity = tileentity;
|
||||||
@@ -351,6 +353,10 @@ public class ContainerArcaneWorkbench extends Container implements ISpellSortabl
|
|||||||
*/
|
*/
|
||||||
private boolean mergeStackIntoBookshelves(ItemStack stack){
|
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!
|
// LinkedHashSet preserves iteration order whilst ignoring duplicates - neat!
|
||||||
Set<VirtualSlot> slots = new LinkedHashSet<>(bookshelfSlots.size());
|
Set<VirtualSlot> slots = new LinkedHashSet<>(bookshelfSlots.size());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user