mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 18:39:23 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939) PaperMC/Paper@1922be90 Update custom tags (#12183) PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009) PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949) PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992) PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974) PaperMC/Paper@42b653b1 Expose more argument types (#12665) PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010) PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996) PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
75 lines
2.6 KiB
Diff
75 lines
2.6 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 FluidOcclusionCacheKey hash
|
|
|
|
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
The JMH benchmark of this patch can be found in SunBox's `RecordHashCode`
|
|
|
|
diff --git a/ca/spottedleaf/moonrise/patches/collisions/util/FluidOcclusionCacheKey.java b/ca/spottedleaf/moonrise/patches/collisions/util/FluidOcclusionCacheKey.java
|
|
index cf9ffdeff6bf0b62a45f7a44dbfe0dd7d17dc4f4..fcff01c84d611a75dbf79b1644092516c7cfb0bc 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/collisions/util/FluidOcclusionCacheKey.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/collisions/util/FluidOcclusionCacheKey.java
|
|
@@ -3,5 +3,58 @@ package ca.spottedleaf.moonrise.patches.collisions.util;
|
|
import net.minecraft.core.Direction;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
-public record FluidOcclusionCacheKey(BlockState first, BlockState second, Direction direction, boolean result) {
|
|
+// Gale start - cache FluidOcclusionCacheKey hash
|
|
+public final class FluidOcclusionCacheKey {
|
|
+ private final BlockState first;
|
|
+ private final BlockState second;
|
|
+ private final Direction direction;
|
|
+ private final boolean result;
|
|
+ private final int hash;
|
|
+
|
|
+ public FluidOcclusionCacheKey(BlockState first, BlockState second, Direction direction, boolean result) {
|
|
+ this.first = first;
|
|
+ this.second = second;
|
|
+ this.direction = direction;
|
|
+ this.result = result;
|
|
+ this.hash = java.util.Objects.hash(first, second, direction, result);
|
|
+ }
|
|
+
|
|
+ public BlockState first() {
|
|
+ return first;
|
|
+ }
|
|
+
|
|
+ public BlockState second() {
|
|
+ return second;
|
|
+ }
|
|
+
|
|
+ public Direction direction() {
|
|
+ return direction;
|
|
+ }
|
|
+
|
|
+ public boolean result() {
|
|
+ return result;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean equals(Object o) {
|
|
+ return o instanceof FluidOcclusionCacheKey fluidOcclusionCacheKey
|
|
+ && this.first == fluidOcclusionCacheKey.first
|
|
+ && this.second == fluidOcclusionCacheKey.second
|
|
+ && this.direction == fluidOcclusionCacheKey.direction;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int hashCode() {
|
|
+ return hash;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public String toString() {
|
|
+ return "FluidOcclusionCacheKey[" +
|
|
+ "first=" + first + ", " +
|
|
+ "second=" + second + ", " +
|
|
+ "direction=" + direction + ", " +
|
|
+ "result=" + result + ']';
|
|
+ }
|
|
+ // Gale end - cache FluidOcclusionCacheKey hash
|
|
}
|