Implement base methods for tags
This commit is contained in:
parent
30fbdbaaf7
commit
5529a1769e
@ -1,5 +1,6 @@
|
|||||||
package org.bukkit.craftbukkit.tag;
|
package org.bukkit.craftbukkit.tag;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import net.minecraft.core.HolderSet;
|
import net.minecraft.core.HolderSet;
|
||||||
import net.minecraft.core.IRegistry;
|
import net.minecraft.core.IRegistry;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -29,4 +30,30 @@ public abstract class CraftTag<N, B extends Keyed> implements Tag<B> {
|
|||||||
public NamespacedKey getKey() {
|
public NamespacedKey getKey() {
|
||||||
return CraftNamespacedKey.fromMinecraft(tag.location());
|
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…
x
Reference in New Issue
Block a user