mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-25 09:39:19 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@bf5852a Fix NPE for PlayerPostRespawnEvent#getRespawnedLocation (#11268) PaperMC/Paper@fb53074 Apply optimise collision checking in move packet handling patch PaperMC/Paper@81bfda8 [ci skip] Specify rebase location in CONTRIBUTING (#11255) PaperMC/Paper@9571983 Fix scanForLegacyEnderDragon world config (#11262) PaperMC/Paper@ec55c11 Fix indestructable light blocks (#11275) PaperMC/Paper@1b8ab11 Add Configuration for vertical Despawn Ranges (#10440) PaperMC/Paper@534ab86 [ci-skip] Revert "Add Configuration for vertical Despawn Ranges (#10440)" (#11278) PaperMC/Paper@e619744 Allow skipping of world symlink validation (#11250) PaperMC/Paper@78216fe Re-implement portalCreateRadius world config (#11267) PaperMC/Paper@4829fbf Handle custom registry elements properly (#11230) PaperMC/Paper@d5ffc57 Implement more methods for horse inventories (#11147) PaperMC/Paper@52ae4ad Migrate ArmorStand meta to using entity tag (#11107)
51 lines
2.2 KiB
Diff
51 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 30 Nov 2022 15:51:59 +0100
|
|
Subject: [PATCH] Cache BlockStatePairKey hash
|
|
|
|
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following mixin:
|
|
"me/jellysquid/mods/lithium/mixin/cached_hashcode/BlockNeighborGroupMixin.java"
|
|
By: Angeline <jellysquid3@users.noreply.github.com>
|
|
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
|
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
|
|
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 29947de9eb6887f2e61516523ff08d8b581b0f53..b807f4a5239f32e6b6080a58e055357b7341cf00 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
@@ -600,11 +600,18 @@ public class Block extends BlockBehaviour implements ItemLike {
|
|
private final BlockState first;
|
|
private final BlockState second;
|
|
private final Direction direction;
|
|
+ private final int hash; // Gale - Lithium - cache BlockStatePairKey hash
|
|
|
|
public BlockStatePairKey(BlockState self, BlockState other, Direction facing) {
|
|
this.first = self;
|
|
this.second = other;
|
|
this.direction = facing;
|
|
+ // Gale start - Lithium - cache BlockStatePairKey hash
|
|
+ int hash = this.first.hashCode();
|
|
+ hash = 31 * hash + this.second.hashCode();
|
|
+ hash = 31 * hash + this.direction.hashCode();
|
|
+ this.hash = hash;
|
|
+ // Gale end - Lithium - cache BlockStatePairKey hash
|
|
}
|
|
|
|
public boolean equals(Object object) {
|
|
@@ -620,11 +627,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; // Gale - Lithium - cache BlockStatePairKey hash
|
|
}
|
|
}
|
|
}
|