Fix FerriteCore Port Mistake
slow-chunk-load bug may be fixed
This commit is contained in:
@@ -7,30 +7,34 @@ Original: malte0811/FerriteCore
|
|||||||
Copyright (C) 2023 malte0811
|
Copyright (C) 2023 malte0811
|
||||||
|
|
||||||
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
|
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 bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d1439be6c242 100644
|
index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..22f194956640b88c1d060b732e517f85d9091cf6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
@@ -737,9 +737,16 @@ public abstract class BlockBehaviour implements FeatureElement {
|
@@ -737,6 +737,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
protected BlockBehaviour.BlockStateBase.Cache cache;
|
protected BlockBehaviour.BlockStateBase.Cache cache;
|
||||||
private FluidState fluidState;
|
private FluidState fluidState;
|
||||||
private boolean isRandomlyTicking;
|
private boolean isRandomlyTicking;
|
||||||
+ // Plazma start - FerriteCore
|
+ // Plazma start - FerriteCore
|
||||||
+ public final java.util.Map<net.minecraft.world.phys.shapes.VoxelShape, net.minecraft.world.phys.shapes.VoxelShape> CACHE_COLLIDE = new java.util.HashMap<>();
|
+ public static final java.util.Map<net.minecraft.world.phys.shapes.VoxelShape, net.minecraft.world.phys.shapes.VoxelShape> CACHE_COLLIDE = new java.util.HashMap<>();
|
||||||
+ public final java.util.Map<VoxelShape, org.apache.commons.lang3.tuple.Pair<VoxelShape, VoxelShape[]>> CACHE_PROJECT = new java.util.HashMap<>();
|
+ public static final java.util.Map<VoxelShape, org.apache.commons.lang3.tuple.Pair<VoxelShape, VoxelShape[]>> CACHE_PROJECT = new java.util.HashMap<>();
|
||||||
+ public final java.util.Map<boolean[], boolean[]> CACHE_FACE_STURDY = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap<>(it.unimi.dsi.fastutil.booleans.BooleanArrays.HASH_STRATEGY);
|
+ public static final java.util.Map<boolean[], boolean[]> CACHE_FACE_STURDY = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap<>(it.unimi.dsi.fastutil.booleans.BooleanArrays.HASH_STRATEGY);
|
||||||
+ private final ThreadLocal<BlockBehaviour.BlockStateBase.Cache> LAST_CACHE = new ThreadLocal<>();
|
+ private static final ThreadLocal<BlockBehaviour.BlockStateBase.Cache> LAST_CACHE = new ThreadLocal<>();
|
||||||
+ // Plazma end
|
+ // Plazma end
|
||||||
|
|
||||||
protected BlockStateBase(Block block, ImmutableMap<Property<?>, Comparable<?>> propertyMap, MapCodec<BlockState> codec) {
|
protected BlockStateBase(Block block, ImmutableMap<Property<?>, Comparable<?>> propertyMap, MapCodec<BlockState> codec) {
|
||||||
super(block, propertyMap, codec);
|
super(block, propertyMap, codec);
|
||||||
+ LAST_CACHE.set(asState().cache); // Plazma - FerriteCore
|
@@ -795,6 +801,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
this.fluidState = Fluids.EMPTY.defaultFluidState();
|
// Paper end
|
||||||
BlockBehaviour.Properties blockbase_info = block.properties;
|
|
||||||
|
|
||||||
@@ -759,7 +766,60 @@ public abstract class BlockBehaviour implements FeatureElement {
|
public void initCache() {
|
||||||
this.offsetFunction = blockbase_info.offsetFunction;
|
+ LAST_CACHE.set(asState().cache); // Plazma - FerriteCore
|
||||||
this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak;
|
this.fluidState = ((Block) this.owner).getFluidState(this.asState());
|
||||||
this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
|
this.isRandomlyTicking = ((Block) this.owner).isRandomlyTicking(this.asState());
|
||||||
|
if (!this.getBlock().hasDynamicShape()) {
|
||||||
|
@@ -832,7 +839,61 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
+ // Plazma start - FerriteCore
|
+ // Plazma start - FerriteCore
|
||||||
+ if (asState().cache != null) {
|
+ if (asState().cache != null) {
|
||||||
+ Cache newCache = asState().cache;
|
+ Cache newCache = asState().cache;
|
||||||
@@ -67,6 +71,7 @@ index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d143
|
|||||||
+ }
|
+ }
|
||||||
+ // Plazma end
|
+ // Plazma end
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ // Plazma start - FerriteCore
|
+ // Plazma start - FerriteCore
|
||||||
+ private void replaceInternals(net.minecraft.world.phys.shapes.ArrayVoxelShape toKeep, net.minecraft.world.phys.shapes.ArrayVoxelShape toReplace) {
|
+ private void replaceInternals(net.minecraft.world.phys.shapes.ArrayVoxelShape toKeep, net.minecraft.world.phys.shapes.ArrayVoxelShape toReplace) {
|
||||||
+ if (toKeep == toReplace) return;
|
+ if (toKeep == toReplace) return;
|
||||||
@@ -85,10 +90,10 @@ index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d143
|
|||||||
+ return null;
|
+ return null;
|
||||||
}
|
}
|
||||||
+ // Plazma end
|
+ // Plazma end
|
||||||
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
|
||||||
private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
|
|
||||||
|
|
||||||
@@ -1205,10 +1265,10 @@ public abstract class BlockBehaviour implements FeatureElement {
|
public Block getBlock() {
|
||||||
|
return (Block) this.owner;
|
||||||
|
@@ -1205,10 +1266,10 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
final boolean propagatesSkylightDown;
|
final boolean propagatesSkylightDown;
|
||||||
final int lightBlock;
|
final int lightBlock;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -1100,7 +1100,7 @@ index 9a2ec50be757dfa3780a49ec96942fed89ed530c..d5b904a36d7c0a9d0f8787eccc770fd4
|
|||||||
System.out.println("Starting server");
|
System.out.println("Starting server");
|
||||||
Thread runThread = new Thread(() -> {
|
Thread runThread = new Thread(() -> {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index 69fe6480a52dca86b09a331345347e88f77a298d..7fedc6f701167c5b1ef39a89abe96e81704878ff 100644
|
index e363891e8ab872ed24c557e3f94110f36c6fb277..409d2e1d936932177caebdb1e12278bdd58db3b2 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -472,7 +472,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -472,7 +472,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|||||||
Reference in New Issue
Block a user