dont tick down display when the claiming tools are held

This commit is contained in:
Flemmli97 2020-11-28 20:01:02 +01:00
parent 676ba1b69f
commit 27f39ea48e
2 changed files with 12 additions and 6 deletions

View File

@ -55,8 +55,10 @@ public class ClaimDisplay {
} }
} }
public boolean display(ServerPlayerEntity player) { public boolean display(ServerPlayerEntity player, boolean tick) {
if (--this.displayTime % 2 == 0) if(tick)
--this.displayTime;
if (this.displayTime % 2 == 0)
return this.toDisplay.isRemoved(); return this.toDisplay.isRemoved();
int[] dims = this.toDisplay.getDimensions(); int[] dims = this.toDisplay.getDimensions();
if (this.poss == null || this.changed(dims)) { if (this.poss == null || this.changed(dims)) {

View File

@ -176,14 +176,18 @@ public class PlayerClaimData {
} }
public void tick() { public void tick() {
this.displayToAdd.forEach(add -> { boolean tool = this.player.getMainHandStack().getItem() == ConfigHandler.config.claimingItem
|| this.player.getOffHandStack().getItem() == ConfigHandler.config.claimingItem;
boolean stick = this.player.getMainHandStack().getItem() == ConfigHandler.config.inspectionItem
|| this.player.getOffHandStack().getItem() == ConfigHandler.config.inspectionItem;
this.displayToAdd.forEach(add -> {
if (!this.claimDisplayList.add(add)) { if (!this.claimDisplayList.add(add)) {
this.claimDisplayList.removeIf(c -> c.equals(add) && c.type != add.type); this.claimDisplayList.removeIf(c -> c.equals(add) && c.type != add.type);
this.claimDisplayList.add(add); this.claimDisplayList.add(add);
} }
}); });
this.displayToAdd.clear(); this.displayToAdd.clear();
this.claimDisplayList.removeIf(d -> d.display(this.player)); this.claimDisplayList.removeIf(d -> d.display(this.player, !tool && !stick));
if (++this.lastBlockTick > ConfigHandler.config.ticksForNextBlock) { if (++this.lastBlockTick > ConfigHandler.config.ticksForNextBlock) {
this.addClaimBlocks(1); this.addClaimBlocks(1);
this.lastBlockTick = 0; this.lastBlockTick = 0;
@ -196,8 +200,8 @@ public class PlayerClaimData {
if (--this.confirmTick < 0) if (--this.confirmTick < 0)
this.confirmDeleteAll = false; this.confirmDeleteAll = false;
if (this.displayEditing != null) if (this.displayEditing != null)
this.displayEditing.display(this.player); this.displayEditing.display(this.player, !tool && !stick);
if (this.player.getMainHandStack().getItem() != ConfigHandler.config.claimingItem && this.player.getOffHandStack().getItem() != ConfigHandler.config.claimingItem) { if (!tool) {
this.setEditingCorner(null); this.setEditingCorner(null);
this.setEditClaim(null, 0); this.setEditClaim(null, 0);
this.claimBlockMessage = false; this.claimBlockMessage = false;