fix claim display keep getting added for same claim causing lots of particles

This commit is contained in:
Flemmli97 2022-12-18 20:37:36 +01:00
parent f5fe7cd457
commit 959cdd70d3
16 changed files with 76 additions and 22 deletions

View File

@ -1,3 +1,7 @@
Flan 1.8.3
================
- Fix claim display keep getting added for same claim causing lots of particles
Flan 1.8.2 Flan 1.8.2
================ ================
- Some QOL changes - Some QOL changes

View File

@ -15,9 +15,10 @@ import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.platform.ClaimPermissionCheck; import io.github.flemmli97.flan.platform.ClaimPermissionCheck;
import io.github.flemmli97.flan.platform.CrossPlatformStuff; import io.github.flemmli97.flan.platform.CrossPlatformStuff;
import io.github.flemmli97.flan.platform.integration.webmap.WebmapCalls; import io.github.flemmli97.flan.platform.integration.webmap.WebmapCalls;
import io.github.flemmli97.flan.player.DisplayBox;
import io.github.flemmli97.flan.player.LogoutTracker; import io.github.flemmli97.flan.player.LogoutTracker;
import io.github.flemmli97.flan.player.PlayerClaimData; import io.github.flemmli97.flan.player.PlayerClaimData;
import io.github.flemmli97.flan.player.display.ClaimDisplayBox;
import io.github.flemmli97.flan.player.display.DisplayBox;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
@ -855,7 +856,7 @@ public class Claim implements IPermissionContainer {
} }
public DisplayBox display() { public DisplayBox display() {
return new DisplayBox(() -> new DisplayBox.Box(this.minX, this.minY, this.minZ, this.maxX, this.world.getMaxBuildHeight(), this.maxZ), this::isRemoved); return new ClaimDisplayBox(this, () -> new DisplayBox.Box(this.minX, this.minY, this.minZ, this.maxX, this.world.getMaxBuildHeight(), this.maxZ), this::isRemoved);
} }
public enum InfoType { public enum InfoType {

View File

@ -17,12 +17,12 @@ import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck; import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck;
import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler; import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler;
import io.github.flemmli97.flan.platform.integration.webmap.WebmapCalls; import io.github.flemmli97.flan.platform.integration.webmap.WebmapCalls;
import io.github.flemmli97.flan.player.DisplayBox;
import io.github.flemmli97.flan.player.EnumDisplayType;
import io.github.flemmli97.flan.player.EnumEditMode; import io.github.flemmli97.flan.player.EnumEditMode;
import io.github.flemmli97.flan.player.OfflinePlayerData; import io.github.flemmli97.flan.player.OfflinePlayerData;
import io.github.flemmli97.flan.player.PlayerClaimData; import io.github.flemmli97.flan.player.PlayerClaimData;
import io.github.flemmli97.flan.player.PlayerDataHandler; import io.github.flemmli97.flan.player.PlayerDataHandler;
import io.github.flemmli97.flan.player.display.DisplayBox;
import io.github.flemmli97.flan.player.display.EnumDisplayType;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;

View File

@ -20,10 +20,10 @@ import io.github.flemmli97.flan.event.ItemInteractEvents;
import io.github.flemmli97.flan.gui.ClaimMenuScreenHandler; import io.github.flemmli97.flan.gui.ClaimMenuScreenHandler;
import io.github.flemmli97.flan.gui.PersonalGroupScreenHandler; import io.github.flemmli97.flan.gui.PersonalGroupScreenHandler;
import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler; import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler;
import io.github.flemmli97.flan.player.EnumDisplayType;
import io.github.flemmli97.flan.player.EnumEditMode; import io.github.flemmli97.flan.player.EnumEditMode;
import io.github.flemmli97.flan.player.OfflinePlayerData; import io.github.flemmli97.flan.player.OfflinePlayerData;
import io.github.flemmli97.flan.player.PlayerClaimData; import io.github.flemmli97.flan.player.PlayerClaimData;
import io.github.flemmli97.flan.player.display.EnumDisplayType;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;

View File

@ -8,8 +8,8 @@ import io.github.flemmli97.flan.claim.ClaimStorage;
import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.gui.LockedLecternScreenHandler; import io.github.flemmli97.flan.gui.LockedLecternScreenHandler;
import io.github.flemmli97.flan.platform.CrossPlatformStuff; import io.github.flemmli97.flan.platform.CrossPlatformStuff;
import io.github.flemmli97.flan.player.EnumDisplayType;
import io.github.flemmli97.flan.player.PlayerClaimData; import io.github.flemmli97.flan.player.PlayerClaimData;
import io.github.flemmli97.flan.player.display.EnumDisplayType;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;

View File

@ -11,9 +11,9 @@ import io.github.flemmli97.flan.claim.ClaimStorage;
import io.github.flemmli97.flan.claim.PermHelper; import io.github.flemmli97.flan.claim.PermHelper;
import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler; import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler;
import io.github.flemmli97.flan.player.EnumDisplayType;
import io.github.flemmli97.flan.player.EnumEditMode; import io.github.flemmli97.flan.player.EnumEditMode;
import io.github.flemmli97.flan.player.PlayerClaimData; import io.github.flemmli97.flan.player.PlayerClaimData;
import io.github.flemmli97.flan.player.display.EnumDisplayType;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;

View File

@ -8,7 +8,7 @@ import io.github.flemmli97.flan.Flan;
import io.github.flemmli97.flan.claim.Claim; import io.github.flemmli97.flan.claim.Claim;
import io.github.flemmli97.flan.claim.ClaimStorage; import io.github.flemmli97.flan.claim.ClaimStorage;
import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.player.DisplayBox; import io.github.flemmli97.flan.player.display.DisplayBox;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ChunkPos;

View File

@ -2,7 +2,7 @@ package io.github.flemmli97.flan.platform.integration.claiming;
import io.github.flemmli97.flan.Flan; import io.github.flemmli97.flan.Flan;
import io.github.flemmli97.flan.claim.Claim; import io.github.flemmli97.flan.claim.Claim;
import io.github.flemmli97.flan.player.DisplayBox; import io.github.flemmli97.flan.player.display.DisplayBox;
import java.util.Set; import java.util.Set;

View File

@ -15,6 +15,9 @@ import io.github.flemmli97.flan.claim.PermHelper;
import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.event.EntityInteractEvents; import io.github.flemmli97.flan.event.EntityInteractEvents;
import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler; import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler;
import io.github.flemmli97.flan.player.display.ClaimDisplay;
import io.github.flemmli97.flan.player.display.DisplayBox;
import io.github.flemmli97.flan.player.display.EnumDisplayType;
import io.github.flemmli97.flan.scoreboard.ClaimCriterias; import io.github.flemmli97.flan.scoreboard.ClaimCriterias;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;

View File

@ -1,4 +1,4 @@
package io.github.flemmli97.flan.player; package io.github.flemmli97.flan.player.display;
import io.github.flemmli97.flan.claim.Claim; import io.github.flemmli97.flan.claim.Claim;
import io.github.flemmli97.flan.claim.ParticleIndicators; import io.github.flemmli97.flan.claim.ParticleIndicators;

View File

@ -0,0 +1,36 @@
package io.github.flemmli97.flan.player.display;
import io.github.flemmli97.flan.claim.Claim;
import java.util.function.Supplier;
public class ClaimDisplayBox extends DisplayBox {
private final Claim claim;
private final Supplier<Box> boxSup;
public ClaimDisplayBox(Claim claim, Supplier<Box> sup, Supplier<Boolean> removed) {
super(sup.get(), removed);
this.claim = claim;
this.boxSup = sup;
}
@Override
public Box box() {
return this.boxSup.get();
}
@Override
public int hashCode() {
return super.hashCode() >> this.claim.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj instanceof ClaimDisplayBox box)
return this.claim == box.claim;
return false;
}
}

View File

@ -1,4 +1,4 @@
package io.github.flemmli97.flan.player; package io.github.flemmli97.flan.player.display;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -10,7 +10,6 @@ import java.util.function.Supplier;
public class DisplayBox { public class DisplayBox {
private final Box box; private final Box box;
private final Supplier<Box> boxSup;
private final Supplier<Boolean> removed; private final Supplier<Boolean> removed;
private final EnumSet<Direction> excludedSides = EnumSet.noneOf(Direction.class); private final EnumSet<Direction> excludedSides = EnumSet.noneOf(Direction.class);
@ -21,7 +20,6 @@ public class DisplayBox {
public DisplayBox(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Supplier<Boolean> removed, Direction... exclude) { public DisplayBox(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Supplier<Boolean> removed, Direction... exclude) {
this.box = new Box(minX, minY, minZ, Math.max(minX + 1, maxX), maxY, Math.max(minZ + 1, maxZ)); this.box = new Box(minX, minY, minZ, Math.max(minX + 1, maxX), maxY, Math.max(minZ + 1, maxZ));
this.boxSup = null;
this.removed = removed; this.removed = removed;
this.excludedSides.addAll(Arrays.asList(exclude)); this.excludedSides.addAll(Arrays.asList(exclude));
} }
@ -29,9 +27,8 @@ public class DisplayBox {
/** /**
* For claims with dynamic size (atm only from this mod) * For claims with dynamic size (atm only from this mod)
*/ */
public DisplayBox(Supplier<Box> sup, Supplier<Boolean> removed, Direction... exclude) { public DisplayBox(Box box, Supplier<Boolean> removed, Direction... exclude) {
this.box = sup.get(); this.box = box;
this.boxSup = sup;
this.removed = removed; this.removed = removed;
this.excludedSides.addAll(Arrays.asList(exclude)); this.excludedSides.addAll(Arrays.asList(exclude));
} }
@ -41,8 +38,6 @@ public class DisplayBox {
} }
public Box box() { public Box box() {
if (this.boxSup != null)
return this.boxSup.get();
return this.box; return this.box;
} }
@ -50,6 +45,21 @@ public class DisplayBox {
return this.excludedSides; return this.excludedSides;
} }
@Override
public int hashCode() {
return this.box.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj instanceof DisplayBox other)
return this.box.equals(other.box);
return false;
}
public record Box(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { public record Box(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
@Override @Override

View File

@ -1,4 +1,4 @@
package io.github.flemmli97.flan.player; package io.github.flemmli97.flan.player.display;
public enum EnumDisplayType { public enum EnumDisplayType {
MAIN, MAIN,

View File

@ -7,7 +7,7 @@ import io.github.flemmli97.flan.claim.Claim;
import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.platform.integration.claiming.FTBChunks; import io.github.flemmli97.flan.platform.integration.claiming.FTBChunks;
import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck; import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck;
import io.github.flemmli97.flan.player.DisplayBox; import io.github.flemmli97.flan.player.display.DisplayBox;
import java.util.Set; import java.util.Set;

View File

@ -9,7 +9,7 @@ import io.github.flemmli97.flan.claim.ClaimStorage;
import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.platform.integration.claiming.FTBChunks; import io.github.flemmli97.flan.platform.integration.claiming.FTBChunks;
import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck; import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck;
import io.github.flemmli97.flan.player.DisplayBox; import io.github.flemmli97.flan.player.display.DisplayBox;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;

View File

@ -8,7 +8,7 @@ forge_version=1.19.2-43.1.57
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
loader_version=0.14.8 loader_version=0.14.8
# Mod Properties # Mod Properties
mod_version=1.8.2 mod_version=1.8.3
maven_group=io.github.flemmli97 maven_group=io.github.flemmli97
archives_base_name=flan archives_base_name=flan