mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-22 16:29:23 +00:00
23/50 patches (lithium)
This commit is contained in:
43
patches/server/0022-lithium-cached_hashcode.patch
Normal file
43
patches/server/0022-lithium-cached_hashcode.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
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 6d012ca724f1373bcf9e8d86d22194143f56d52b..daad0d67428bb49d7f0b37bec430ceb0d30564cf 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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user