2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Alfie Cleveland <alfeh@me.com>
|
|
|
|
Date: Fri, 19 Aug 2016 01:52:56 +0100
|
|
|
|
Subject: [PATCH] Optimise BlockState's hashCode/equals
|
|
|
|
|
|
|
|
These are singleton "single instance" objects. We can rely on
|
|
|
|
object identity checks safely.
|
|
|
|
|
|
|
|
Use a simpler optimized hashcode
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
|
2023-09-22 19:31:02 +02:00
|
|
|
index ebe22b4f5c1c3eb5920a05fd87107e617f509dc5..7c111568b0cb15be0021c704aa1d96f4d7189928 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
|
|
|
|
@@ -30,8 +30,7 @@ public class BooleanProperty extends Property<Boolean> {
|
|
|
|
return value.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public boolean equals(Object object) {
|
|
|
|
+ public boolean equals_unused(Object object) { // Paper
|
|
|
|
if (this == object) {
|
|
|
|
return true;
|
2023-09-21 22:35:39 +02:00
|
|
|
} else {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
|
2023-09-22 19:31:02 +02:00
|
|
|
index 21e16078ecca0908c4b442b5e4d5cb9183a5fca5..a39d77e3f007411aacdbea5bf9facb4d70f14fbc 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
|
2021-11-23 14:22:49 +01:00
|
|
|
@@ -45,8 +45,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope
|
2021-06-12 08:02:49 +02:00
|
|
|
return value.getSerializedName();
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public boolean equals(Object object) {
|
|
|
|
+ public boolean equals_unused(Object object) { // Paper
|
|
|
|
if (this == object) {
|
|
|
|
return true;
|
2023-09-21 22:35:39 +02:00
|
|
|
} else {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
|
2023-09-22 19:31:02 +02:00
|
|
|
index 18d7c0a678cbb6aa792815db458f0c0feb07bd92..9523762404be6443bd5d4e5d2ea07d215c40db07 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
|
2022-06-07 21:55:39 +02:00
|
|
|
@@ -35,8 +35,7 @@ public class IntegerProperty extends Property<Integer> {
|
2021-06-11 14:02:28 +02:00
|
|
|
return this.values;
|
|
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public boolean equals(Object object) {
|
|
|
|
+ public boolean equals_unused(Object object) { // Paper
|
|
|
|
if (this == object) {
|
|
|
|
return true;
|
2023-09-21 22:35:39 +02:00
|
|
|
} else {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
|
2023-09-22 19:31:02 +02:00
|
|
|
index 18f77e0cb6725f3343c4ab579c163037329cfac8..e6bc018d5b1fc9be4881ec9f439ff16f0ecbb8b4 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -70,14 +70,7 @@ public abstract class Property<T extends Comparable<T>> {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-11-24 23:26:32 +01:00
|
|
|
@Override
|
2021-06-11 14:02:28 +02:00
|
|
|
public boolean equals(Object object) {
|
|
|
|
- if (this == object) {
|
|
|
|
- return true;
|
|
|
|
- } else if (!(object instanceof Property)) {
|
|
|
|
- return false;
|
|
|
|
- } else {
|
2021-11-24 23:26:32 +01:00
|
|
|
- Property<?> property = (Property)object;
|
|
|
|
- return this.clazz.equals(property.clazz) && this.name.equals(property.name);
|
2021-06-11 14:02:28 +02:00
|
|
|
- }
|
2021-11-23 14:22:49 +01:00
|
|
|
+ return this == object; // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-11-24 23:26:32 +01:00
|
|
|
@Override
|