mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
44 lines
1.7 KiB
Diff
44 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Sat, 25 May 2024 17:13:35 +0300
|
|
Subject: [PATCH] lithium: cached_hashcode
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
index 4ff7e3693305069e7fad185802a3b0481ab70a4a..26dd81b4a6fb929f2b4304442f79e7f3f6c46aa3 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
@@ -633,11 +633,19 @@ public class Block extends BlockBehaviour implements ItemLike {
|
|
private final BlockState first;
|
|
private final BlockState second;
|
|
private final Direction direction;
|
|
+ private final int hash; // DivineMC - lithium: cached_hashcode
|
|
|
|
public BlockStatePairKey(BlockState self, BlockState other, Direction facing) {
|
|
this.first = self;
|
|
this.second = other;
|
|
this.direction = facing;
|
|
+
|
|
+ // DivineMC start - lithium: cached_hashcode
|
|
+ int i = this.first.hashCode();
|
|
+ i = 31 * i + this.second.hashCode();
|
|
+ i = 31 * i + this.direction.hashCode();
|
|
+ this.hash = i;
|
|
+ // DivineMC end
|
|
}
|
|
|
|
public boolean equals(Object object) {
|
|
@@ -653,11 +661,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
|
}
|
|
|
|
public int hashCode() {
|
|
- int i = this.first.hashCode();
|
|
-
|
|
- i = 31 * i + this.second.hashCode();
|
|
- i = 31 * i + this.direction.hashCode();
|
|
- return i;
|
|
+ return this.hash; // DivineMC - lithium: cached_hashcode
|
|
}
|
|
}
|
|
}
|