Fixed bug where EC closes if another player is still inside
This commit is contained in:
@ -113,7 +113,6 @@ public class SharedEnderChest implements ServerLifecycleEvents.ServerStopping, S
|
||||
}
|
||||
|
||||
public static void openSharedEnderChest(PlayerEntity player, World world, BlockPos pos) {
|
||||
playEnderChestOpenSound(world, pos);
|
||||
fakeEnderChestOpen(world, pos, true);
|
||||
sharedInventory.openedEnderChests.put(player, pos);
|
||||
player.openHandledScreen(new SimpleNamedScreenHandlerFactory((int_1, playerInventory, playerEntity) ->
|
||||
@ -133,6 +132,10 @@ public class SharedEnderChest implements ServerLifecycleEvents.ServerStopping, S
|
||||
return;
|
||||
}
|
||||
|
||||
if(open)
|
||||
playEnderChestOpenSound(world, pos);
|
||||
else
|
||||
playEnderChestCloseSound(world, pos);
|
||||
world.addSyncedBlockEvent(pos, Blocks.ENDER_CHEST, 1, open ? 1 : 0);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,8 @@ public class SharedInventory implements Inventory {
|
||||
@Override
|
||||
public void onClose(PlayerEntity player) {
|
||||
BlockPos pos = openedEnderChests.remove(player);
|
||||
if(openedEnderChests.containsValue(pos))
|
||||
return;
|
||||
SharedEnderChest.fakeEnderChestOpen(player.getWorld(), pos, false);
|
||||
SharedEnderChest.playEnderChestCloseSound(player.getWorld(), pos);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user