mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 22:43:14 +01:00
Implement base methods for tags
By: md_5 <git@md-5.net>
This commit is contained in:
parent
0278929667
commit
060be9b96a
1 changed files with 27 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
package org.bukkit.craftbukkit.tag;
|
||||
|
||||
import java.util.Objects;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
@ -29,4 +30,30 @@ public abstract class CraftTag<N, B extends Keyed> implements Tag<B> {
|
|||
public NamespacedKey getKey() {
|
||||
return CraftNamespacedKey.fromMinecraft(tag.location());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 59 * hash + Objects.hashCode(this.registry);
|
||||
hash = 59 * hash + Objects.hashCode(this.tag);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(obj instanceof CraftTag<?, ?> other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Objects.equals(this.registry, other.registry) && Objects.equals(this.tag, other.tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftTag{" + this.tag + '}';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue