From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alfie Cleveland 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 index ebe22b4f5c1c3eb5920a05fd87107e617f509dc5..7c111568b0cb15be0021c704aa1d96f4d7189928 100644 --- 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 { return value.toString(); } - @Override - public boolean equals(Object object) { + public boolean equals_unused(Object object) { // Paper if (this == object) { return true; } else { 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 index 21e16078ecca0908c4b442b5e4d5cb9183a5fca5..a39d77e3f007411aacdbea5bf9facb4d70f14fbc 100644 --- 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 @@ -45,8 +45,7 @@ public class EnumProperty & StringRepresentable> extends Prope return value.getSerializedName(); } - @Override - public boolean equals(Object object) { + public boolean equals_unused(Object object) { // Paper if (this == object) { return true; } else { 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 index 18d7c0a678cbb6aa792815db458f0c0feb07bd92..9523762404be6443bd5d4e5d2ea07d215c40db07 100644 --- 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 @@ -35,8 +35,7 @@ public class IntegerProperty extends Property { return this.values; } - @Override - public boolean equals(Object object) { + public boolean equals_unused(Object object) { // Paper if (this == object) { return true; } else { 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 index 18f77e0cb6725f3343c4ab579c163037329cfac8..e6bc018d5b1fc9be4881ec9f439ff16f0ecbb8b4 100644 --- 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 @@ -70,14 +70,7 @@ public abstract class Property> { @Override public boolean equals(Object object) { - if (this == object) { - return true; - } else if (!(object instanceof Property)) { - return false; - } else { - Property property = (Property)object; - return this.clazz.equals(property.clazz) && this.name.equals(property.name); - } + return this == object; // Paper } @Override