|
42 | 42 | import net.minecraft.world.level.block.state.BlockState;
|
43 | 43 | import net.neoforged.neoforge.common.util.INBTSerializable;
|
44 | 44 |
|
| 45 | +import java.util.Objects; |
45 | 46 | import java.util.Optional;
|
46 | 47 |
|
47 | 48 | public class MachineReference implements INBTSerializable<CompoundTag> {
|
@@ -210,4 +211,39 @@ public BlockEntity getInsertBlockEntity(Level level) {
|
210 | 211 | public boolean isValidFor(Level level) {
|
211 | 212 | return this.getExtractBlockEntity(level) != null && this.getInsertBlockEntity(level) != null;
|
212 | 213 | }
|
| 214 | + |
| 215 | + @Override |
| 216 | + public boolean equals(Object obj) { |
| 217 | + if(obj == this) |
| 218 | + return true; |
| 219 | + |
| 220 | + if (obj instanceof MachineReference) { |
| 221 | + MachineReference other = (MachineReference) obj; |
| 222 | + return this.extractGlobalPos.equals(other.extractGlobalPos) && |
| 223 | + this.extractRegistryName.equals(other.extractRegistryName) && |
| 224 | + this.extractChunkLoaded == other.extractChunkLoaded && |
| 225 | + this.extractFacing == other.extractFacing && |
| 226 | + this.insertGlobalPos.equals(other.insertGlobalPos) && |
| 227 | + this.insertRegistryName.equals(other.insertRegistryName) && |
| 228 | + this.insertChunkLoaded == other.insertChunkLoaded && |
| 229 | + this.insertFacing == other.insertFacing && |
| 230 | + this.customName.equals(other.customName); |
| 231 | + } |
| 232 | + return false; |
| 233 | + } |
| 234 | + |
| 235 | + @Override |
| 236 | + public int hashCode() { |
| 237 | + return Objects.hash( |
| 238 | + this.extractGlobalPos, |
| 239 | + this.extractRegistryName, |
| 240 | + this.extractChunkLoaded, |
| 241 | + this.extractFacing, |
| 242 | + this.insertGlobalPos, |
| 243 | + this.insertRegistryName, |
| 244 | + this.insertChunkLoaded, |
| 245 | + this.insertFacing, |
| 246 | + this.customName |
| 247 | + ); |
| 248 | + } |
213 | 249 | }
|
0 commit comments