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
|
2024-04-12 21:14:06 +02:00
|
|
|
index ee2f1bff22fed14cda434173dc6286e4d4520822..b63116b333b6e06494091a82588acfb639bddb71 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) {
|
2024-01-22 19:01:10 +01:00
|
|
|
+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-23 19:02:08 +02:00
|
|
|
index f4d9856420a6e7e857fc9b9cb6182a54fe341568..3097298fe356df98967cf4bdeaaede69dfe8a441 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
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -44,8 +44,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) {
|
2024-01-22 19:01:10 +01:00
|
|
|
+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-12 21:14:06 +02:00
|
|
|
index 3c590d400032d8266de63aae301fedbd83d37a1d..3a850321a4bcc68058483b5fd53e829c425a68af 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) {
|
2024-01-22 19:01:10 +01:00
|
|
|
+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-23 19:02:08 +02:00
|
|
|
index 7cbc5e6e75f389f47ef07045f9876cec192f14e4..9055f15af0cae55effa6942913a9d7edf3857e07 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
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -70,7 +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) {
|
2024-04-12 21:14:06 +02:00
|
|
|
- return this == object || object instanceof Property<?> property && this.clazz.equals(property.clazz) && this.name.equals(property.name);
|
2024-01-22 19:01:10 +01:00
|
|
|
+ return this == object; // Paper - Perf: Optimize hashCode/equals
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-11-24 23:26:32 +01:00
|
|
|
@Override
|