13
0
geforkt von Mirrors/Paper

Optimise BlockState's hashCode/equals

These are singleton "single instance" objects. We can rely on
object identity checks safely.

Use a simpler optimized hashcode
Dieser Commit ist enthalten in:
Alfie Cleveland 2016-08-19 01:52:56 +01:00
Ursprung f7ae11f984
Commit c7287dd5ee
3 geänderte Dateien mit 35 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,12 @@
--- a/net/minecraft/world/level/block/state/properties/EnumProperty.java
+++ b/net/minecraft/world/level/block/state/properties/EnumProperty.java
@@ -59,8 +59,7 @@
return this.ordinalToIndex[enum_.ordinal()];
}
- @Override
- public boolean equals(Object object) {
+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals
if (this == object) {
return true;
} else {

Datei anzeigen

@ -0,0 +1,12 @@
--- a/net/minecraft/world/level/block/state/properties/IntegerProperty.java
+++ b/net/minecraft/world/level/block/state/properties/IntegerProperty.java
@@ -28,8 +28,7 @@
return this.values;
}
- @Override
- public boolean equals(Object object) {
+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals
if (this == object) {
return true;
} else {

Datei anzeigen

@ -0,0 +1,11 @@
--- a/net/minecraft/world/level/block/state/properties/Property.java
+++ b/net/minecraft/world/level/block/state/properties/Property.java
@@ -72,7 +72,7 @@
@Override
public boolean equals(Object object) {
- return this == object || object instanceof Property<?> property && this.clazz.equals(property.clazz) && this.name.equals(property.name);
+ return this == object; // Paper - Perf: Optimize hashCode/equals
}
@Override