mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 23:19:18 +00:00
1. Wet the drys 2. Dry the wets 3. Wet the drys 4. Dry the wets 5. Wet the drys 6. Now dust the wets
40 lines
2.6 KiB
Diff
40 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
|
Date: Tue, 22 Oct 2024 17:07:36 +0800
|
|
Subject: [PATCH] Cache blockstate cache array
|
|
|
|
|
|
diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
index 117c7cedb9f355b5139b9aa9b15f4459453e3675..7f46f33fa565fa1a3aedce5524f19be8ba420352 100644
|
|
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
@@ -1050,6 +1050,10 @@ public abstract class BlockBehaviour implements FeatureElement {
|
|
static final class Cache {
|
|
private static final Direction[] DIRECTIONS = Direction.values();
|
|
private static final int SUPPORT_TYPE_COUNT = SupportType.values().length;
|
|
+ // Leaf start - Cache blockstate cache array
|
|
+ private static final SupportType[] SUPPORT_TYPE_VALUES = SupportType.values();
|
|
+ private static final Direction.Axis[] DIRECTION_AXIS_VALUES = Direction.Axis.values();
|
|
+ // Leaf end - Cache blockstate cache array
|
|
protected final VoxelShape collisionShape;
|
|
protected boolean largeCollisionShape;
|
|
private final boolean[] faceSturdy;
|
|
@@ -1068,7 +1072,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
|
);
|
|
} else {
|
|
// Leaf start - Remove stream in BlockBehaviour cache blockstate
|
|
- for (Direction.Axis axis : Direction.Axis.values()) {
|
|
+ for (Direction.Axis axis : DIRECTION_AXIS_VALUES) { // Leaf - Cache blockstate cache array
|
|
if (this.collisionShape.min(axis) < 0.0 || this.collisionShape.max(axis) > 1.0) {
|
|
this.largeCollisionShape = true;
|
|
break;
|
|
@@ -1078,7 +1082,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
|
this.faceSturdy = new boolean[DIRECTIONS.length * SUPPORT_TYPE_COUNT];
|
|
|
|
for (Direction direction : DIRECTIONS) {
|
|
- for (SupportType supportType : SupportType.values()) {
|
|
+ for (SupportType supportType : SUPPORT_TYPE_VALUES) { // Leaf - Cache blockstate cache array
|
|
this.faceSturdy[getFaceSupportIndex(direction, supportType)] = supportType.isSupporting(
|
|
state, EmptyBlockGetter.INSTANCE, BlockPos.ZERO, direction
|
|
);
|