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) {
if (--this.displayTime % 2 == 0)
public boolean display(ServerPlayerEntity player, boolean tick) {
if(tick)
--this.displayTime;
if (this.displayTime % 2 == 0)
return this.toDisplay.isRemoved();
int[] dims = this.toDisplay.getDimensions();
if (this.poss == null || this.changed(dims)) {

View File

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