mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 18:09:27 +00:00
修复加载
This commit is contained in:
@@ -496,6 +496,7 @@ public final class BlockGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class PerformBoneMealInterceptor {
|
||||
public static final PerformBoneMealInterceptor INSTANCE = new PerformBoneMealInterceptor();
|
||||
|
||||
|
||||
@@ -1571,7 +1571,8 @@ public final class CoreReflections {
|
||||
);
|
||||
|
||||
public static final Method method$BlockBehaviour$hasAnalogOutputSignal = requireNonNull(
|
||||
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, boolean.class, new String[]{"hasAnalogOutputSignal", "c"}, clazz$BlockState)
|
||||
ReflectionUtils.getDeclaredMethod(clazz$BlockBehaviour, boolean.class, new String[]{"hasAnalogOutputSignal",
|
||||
VersionHelper.isOrAbove1_20_5() ? "c_" : "d_"}, clazz$BlockState)
|
||||
);
|
||||
|
||||
public static final Method method$BlockBehaviour$getAnalogOutputSignal = requireNonNull(
|
||||
|
||||
@@ -1057,7 +1057,6 @@ public final class NetworkReflections {
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
public static final Constructor<?> constructor$ClientboundMoveEntityPacket$PosRot = requireNonNull(
|
||||
ReflectionUtils.getTheOnlyConstructor(clazz$ClientboundMoveEntityPacket$PosRot)
|
||||
);
|
||||
|
||||
@@ -100,7 +100,7 @@ public abstract class BlockBehavior {
|
||||
return false;
|
||||
}
|
||||
|
||||
//BlockState state Level level BlockPos pos
|
||||
//BlockState state, Level level, BlockPos pos
|
||||
public int getAnalogOutputSignal(Object thisBlock, Object[] args) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,8 @@ public class Dependencies {
|
||||
"adventure-nbt",
|
||||
List.of(Relocation.of("option", "net{}kyori{}option"),
|
||||
Relocation.of("examination", "net{}kyori{}examination"),
|
||||
Relocation.of("adventure", "net{}kyori{}adventure"))
|
||||
Relocation.of("adventure", "net{}kyori{}adventure")),
|
||||
true
|
||||
) {
|
||||
@Override
|
||||
public String getVersion() {
|
||||
|
||||
@@ -12,11 +12,7 @@ import net.momirealms.sparrow.nbt.ListTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.*;
|
||||
|
||||
public class CEChunk {
|
||||
public final CEWorld world;
|
||||
@@ -26,7 +22,7 @@ public class CEChunk {
|
||||
public final Map<BlockPos, BlockEntity> blockEntities;
|
||||
private volatile boolean dirty;
|
||||
private volatile boolean loaded;
|
||||
protected final Map<BlockPos, ReplaceableTickingBlockEntity> tickingBlockEntitiesByPos = new ConcurrentHashMap<>();
|
||||
protected final Map<BlockPos, ReplaceableTickingBlockEntity> tickingBlockEntitiesByPos = new HashMap<>();
|
||||
|
||||
public CEChunk(CEWorld world, ChunkPos chunkPos) {
|
||||
this.world = world;
|
||||
@@ -71,6 +67,13 @@ public class CEChunk {
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAllBlockEntities() {
|
||||
this.blockEntities.values().forEach(e -> e.setValid(false));
|
||||
this.blockEntities.clear();
|
||||
this.tickingBlockEntitiesByPos.values().forEach((ticker) -> ticker.setTicker(DummyTickingBlockEntity.INSTANCE));
|
||||
this.tickingBlockEntitiesByPos.clear();
|
||||
}
|
||||
|
||||
public <T extends BlockEntity> void replaceOrCreateTickingBlockEntity(T blockEntity) {
|
||||
ImmutableBlockState blockState = blockEntity.blockState();
|
||||
BlockEntityTicker<T> ticker = blockState.createBlockEntityTicker(this.world, blockEntity.type());
|
||||
@@ -250,6 +253,7 @@ public class CEChunk {
|
||||
public void unload() {
|
||||
if (!this.loaded) return;
|
||||
this.world.removeLoadedChunk(this);
|
||||
this.clearAllBlockEntities();
|
||||
this.loaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user