geforkt von Mirrors/Paper
64 Zeilen
3.0 KiB
Diff
64 Zeilen
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Chaoscaot <chaos@chaoscaot.de>
|
|
Date: Tue, 13 Aug 2024 11:45:21 +0200
|
|
Subject: [PATCH] SW optimized Blocks cache
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
|
index 223259e7a09ada681b6181c898f6857888594f85..3f31a3115c69fd976ccb1e396018d94bba0f3557 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
|
@@ -1,7 +1,9 @@
|
|
package net.minecraft.world.level.block;
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
import java.util.function.Function;
|
|
import java.util.function.ToIntFunction;
|
|
+import net.minecraft.Util;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.core.Direction;
|
|
@@ -7797,17 +7799,18 @@ public class Blocks {
|
|
}
|
|
|
|
public static void rebuildCache() {
|
|
- Block.BLOCK_STATE_REGISTRY.forEach(BlockBehaviour.BlockStateBase::initCache);
|
|
+ ExecutorService executor = Util.backgroundExecutor();
|
|
+ Block.BLOCK_STATE_REGISTRY.forEach(b -> executor.submit(b::initCache));
|
|
}
|
|
|
|
static {
|
|
for (Block block : BuiltInRegistries.BLOCK) {
|
|
for (BlockState blockState : block.getStateDefinition().getPossibleStates()) {
|
|
Block.BLOCK_STATE_REGISTRY.add(blockState);
|
|
- blockState.initCache();
|
|
+ //blockState.initCache();
|
|
}
|
|
|
|
- block.getLootTable();
|
|
+ //block.getLootTable();
|
|
}
|
|
}
|
|
}
|
|
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 d0109633e8bdf109cfc9178963d7b6cf92f8b189..ea142873eaeb6cd0ebf4eb65a7ed582cfe80c709 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
|
|
@@ -78,6 +78,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
|
import net.minecraft.world.phys.AABB;
|
|
import net.minecraft.world.phys.BlockHitResult;
|
|
import net.minecraft.world.phys.Vec3;
|
|
+import net.minecraft.world.phys.shapes.BooleanOp;
|
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
|
import net.minecraft.world.phys.shapes.Shapes;
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
@@ -1436,7 +1437,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
|
}
|
|
}
|
|
|
|
- this.isCollisionShapeFullBlock = Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
|
|
+ this.isCollisionShapeFullBlock = !Shapes.joinIsNotEmpty(Shapes.block(), state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO), BooleanOp.NOT_SAME); //Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
|
|
}
|
|
}
|
|
|