9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-20 15:39:37 +00:00
Files
Leaf/patches/server/0075-Remove-stream-in-BlockBehaviour-cache-blockstate.patch
Dreeam 4a06d00973 Refactor: Leaf Config v3 (#81)
* 1

* 2

* 3

* 4

* 5

* 6

* 7

* Change contact info in config

* Add contact info for QQ group

* Add more detailed explanation for configurable connection message config

* Fix comments grammar issues

* Purge old or outdated config on load config

* Clean up
2024-07-12 01:34:15 +08:00

38 lines
2.5 KiB
Diff

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/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 155a099eb9b0196385947f5765fad4e5c5b74b44..8b46772221cd60691a6cc4f6b691bdfe94e78608 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -1302,7 +1302,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@Nullable
final VoxelShape[] occlusionShapes;
protected final VoxelShape collisionShape;
- protected final boolean largeCollisionShape;
+ protected boolean largeCollisionShape; // Leaf - not final
private final boolean[] faceSturdy;
protected final boolean isCollisionShapeFullBlock;
@@ -1334,9 +1334,14 @@ public abstract class BlockBehaviour implements FeatureElement {
if (!this.collisionShape.isEmpty() && state.hasOffsetFunction()) {
throw new IllegalStateException(String.format(Locale.ROOT, "%s has a collision shape and an offset type, but is not marked as dynamicShape in its properties.", BuiltInRegistries.BLOCK.getKey(block)));
} else {
- this.largeCollisionShape = Arrays.stream(Direction.Axis.values()).anyMatch((enumdirection_enumaxis) -> {
- return this.collisionShape.min(enumdirection_enumaxis) < 0.0D || this.collisionShape.max(enumdirection_enumaxis) > 1.0D;
- });
+ // Leaf start - Remove stream
+ for (Direction.Axis axis : Direction.Axis.values()) {
+ if (this.collisionShape.min(axis) < 0.0D || this.collisionShape.max(axis) > 1.0D) {
+ this.largeCollisionShape = true;
+ break;
+ }
+ }
+ // Leaf end - Remove stream
this.faceSturdy = new boolean[BlockBehaviour.BlockStateBase.Cache.DIRECTIONS.length * BlockBehaviour.BlockStateBase.Cache.SUPPORT_TYPE_COUNT];
Direction[] aenumdirection1 = BlockBehaviour.BlockStateBase.Cache.DIRECTIONS;
int k = aenumdirection1.length;