Skip to content

Commit

Permalink
Add quality methods to StaticDimensionType
Browse files Browse the repository at this point in the history
  • Loading branch information
booky10 committed Jul 1, 2024
1 parent 699fd9a commit 0690c45
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ public String getTranslationKey() {

@Override
public boolean equals(Object obj) {
if (this == obj || super.equals(obj)) return true;
if (this == obj) return true;
if (!(obj instanceof StaticBannerPattern)) return false;
if (!super.equals(obj)) return false;
StaticBannerPattern that = (StaticBannerPattern) obj;
if (!this.assetId.equals(that.assetId)) return false;
return this.translationKey.equals(that.translationKey);
}

@Override
public int hashCode() {
return this.data != null ? super.hashCode() :
Objects.hash(this.assetId, this.translationKey);
return Objects.hash(super.hashCode(), this.assetId, this.translationKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.github.retrooper.packetevents.util.mappings.TypesBuilderData;
import org.jetbrains.annotations.Nullable;

import java.util.Objects;
import java.util.OptionalLong;

public class StaticDimensionType extends AbstractMappedEntity implements DimensionType {
Expand Down Expand Up @@ -185,4 +186,35 @@ public NBT getMonsterSpawnLightLevel() {
public int getMonsterSpawnBlockLightLimit() {
return this.monsterSpawnBlockLightLimit;
}

@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof StaticDimensionType)) return false;
if (!super.equals(obj)) return false;
StaticDimensionType that = (StaticDimensionType) obj;
if (this.hasSkyLight != that.hasSkyLight) return false;
if (this.hasCeiling != that.hasCeiling) return false;
if (this.ultraWarm != that.ultraWarm) return false;
if (this.natural != that.natural) return false;
if (Double.compare(that.coordinateScale, this.coordinateScale) != 0) return false;
if (this.bedWorking != that.bedWorking) return false;
if (this.respawnAnchorWorking != that.respawnAnchorWorking) return false;
if (this.minY != that.minY) return false;
if (this.height != that.height) return false;
if (this.logicalHeight != that.logicalHeight) return false;
if (Float.compare(that.ambientLight, this.ambientLight) != 0) return false;
if (this.piglinSafe != that.piglinSafe) return false;
if (this.hasRaids != that.hasRaids) return false;
if (this.monsterSpawnBlockLightLimit != that.monsterSpawnBlockLightLimit) return false;
if (!this.fixedTime.equals(that.fixedTime)) return false;
if (!this.infiniburnTag.equals(that.infiniburnTag)) return false;
if (!this.effectsLocation.equals(that.effectsLocation)) return false;
return this.monsterSpawnLightLevel.equals(that.monsterSpawnLightLevel);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), this.fixedTime, this.hasSkyLight, this.hasCeiling, this.ultraWarm, this.natural, this.coordinateScale, this.bedWorking, this.respawnAnchorWorking, this.minY, this.height, this.logicalHeight, this.infiniburnTag, this.effectsLocation, this.ambientLight, this.piglinSafe, this.hasRaids, this.monsterSpawnLightLevel, this.monsterSpawnBlockLightLimit);
}
}

0 comments on commit 0690c45

Please sign in to comment.