Implements #equals for BlockImpl

This commit is contained in:
TheMode 2021-08-11 21:28:13 +02:00
parent be07fdb647
commit 35d63ae547

View File

@ -13,10 +13,7 @@ import org.jetbrains.annotations.Nullable;
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
final class BlockImpl implements Block {
@ -142,6 +139,23 @@ final class BlockImpl implements Block {
return nbt != null ? tag.read(nbt) : null;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BlockImpl block = (BlockImpl) o;
return registry.equals(block.registry) &&
propertyEntry.equals(block.propertyEntry) &&
properties.equals(block.properties) &&
Objects.equals(nbt, block.nbt) &&
Objects.equals(handler, block.handler);
}
@Override
public int hashCode() {
return Objects.hash(registry, propertyEntry, properties, nbt, handler);
}
@Override
public String toString() {
return name() + "{" +