mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-22 08:19:19 +00:00
add 2 lithium patches
This commit is contained in:
43
patches/server/0049-lithium-cached_hashcode.patch
Normal file
43
patches/server/0049-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 22d38bd7a8434685f2af084f1c608f48e9e6c0c2..888f763bb0ac451d4166055c2308fd6b5f4f0f88 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -629,11 +629,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) {
|
||||
@@ -649,11 +657,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