From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:43:43 +0800 Subject: [PATCH] Remove stream in BlockBehaviour cache blockstate diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java index b631e35e965b1914cdeeddab8bd6bdbfd2465079..c13c8c82bf7bd0a9a33fd4027884ad852a7c64b6 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -1051,7 +1051,7 @@ public abstract class BlockBehaviour implements FeatureElement { private static final Direction[] DIRECTIONS = Direction.values(); private static final int SUPPORT_TYPE_COUNT = SupportType.values().length; protected final VoxelShape collisionShape; - protected final boolean largeCollisionShape; + protected boolean largeCollisionShape; // Leaf - not final private final boolean[] faceSturdy; protected final boolean isCollisionShapeFullBlock; @@ -1067,8 +1067,14 @@ public abstract class BlockBehaviour implements FeatureElement { ) ); } else { - this.largeCollisionShape = Arrays.stream(Direction.Axis.values()) - .anyMatch(dir -> this.collisionShape.min(dir) < 0.0 || this.collisionShape.max(dir) > 1.0); + // Leaf start - Remove stream + for (Direction.Axis axis : Direction.Axis.values()) { + if (this.collisionShape.min(axis) < 0.0 || this.collisionShape.max(axis) > 1.0) { + this.largeCollisionShape = true; + break; + } + } + // Leaf end - Remove stream this.faceSturdy = new boolean[DIRECTIONS.length * SUPPORT_TYPE_COUNT]; for (Direction direction : DIRECTIONS) {