@Override public void updateEntity() { ticksExisted++; // If a comparator or such has accessed the container and // the contents have been changed, send a block update. if (hasComparatorAccessed() && hasContentsChanged()) comparatorUpdateAndReset(); if (syncPlayersUsing()) { int newPlayersUsing = WorldUtils.syncPlayersUsing(this, playersUsing); if (newPlayersUsing != playersUsing) doSyncPlayersUsing(playersUsing = newPlayersUsing); } prevLidAngle = lidAngle; if (playersUsing > 0) { if (lidAngle < 1.0F) lidAngle = Math.min(1.0F, lidAngle + getLidSpeed()); } else if (lidAngle > 0.0F) lidAngle = Math.max(0.0F, lidAngle - getLidSpeed()); }
/** Called when a player closes this container. */ public void onContainerClosed() { doSyncPlayersUsing(--playersUsing); }
/** Called when a player opens this container. */ public void onContainerOpened() { doSyncPlayersUsing(++playersUsing); }