9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-21 07:49:18 +00:00

[ci-skip] finish patches

This commit is contained in:
NONPLAYT
2023-03-21 20:54:44 +03:00
parent 747de0799b
commit 340edaf4d3
62 changed files with 597 additions and 176 deletions

View File

@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jellysquid3 <jellysquid3@users.noreply.github.com>
Date: Wed, 15 Dec 2021 11:30:23 -0500
Subject: [PATCH] lithium: cached hashcode
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
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 a85e788ff5a55288df753a0e630b32270760f8de..ebb3808fbaaec82283db0839335b5efca28d4881 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -604,11 +604,18 @@ public class Block extends BlockBehaviour implements ItemLike {
private final BlockState first;
private final BlockState second;
private final Direction direction;
+ private int hash; // JettPack
public BlockStatePairKey(BlockState self, BlockState other, Direction facing) {
this.first = self;
this.second = other;
this.direction = facing;
+ // JettPack start - lithium: cached_hashcode
+ int hash = this.first.hashCode();
+ hash = 31 * hash + this.second.hashCode();
+ hash = 31 * hash + this.direction.hashCode();
+ this.hash = hash;
+ // JettPack end
}
public boolean equals(Object object) {
@@ -624,11 +631,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; // JettPack
}
}
}