9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-20 07:19:23 +00:00
Files
DivineMC/patches/server/0022-lithium-cached_hashcode.patch
NONPLAYT 0c6f8fb702 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@f2307b8 Updated Upstream (Paper)
PurpurMC/Purpur@bba87bf Updated Upstream (Paper)
PurpurMC/Purpur@f530395 Fix no exp drops from spawners using silk touch pickaxe without option enabled  (#1582)
PurpurMC/Purpur@3510a9e Updated Upstream (Paper)
2024-08-18 11:24:47 +03:00

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
}
}
}