@@ -7,6 +7,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Fixed networks and network devices being removed when a chunk unloads.
|
||||
|
||||
## [v1.10.0-beta.2] - 2021-12-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed all Refined Storage advancements being granted when joining a world.
|
||||
@@ -27,3 +32,4 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
- Combined fluid and item view in the Pattern Grid.
|
||||
- Ported to Minecraft 1.18.1.
|
||||
- Focused side buttons now display their tooltip properly.
|
||||
- Improved performance of retrieving patterns by [@metalshark](https://github.com/metalshark).
|
||||
|
@@ -33,7 +33,7 @@ apply plugin: 'maven-publish'
|
||||
|
||||
group = 'com.refinedmods'
|
||||
archivesBaseName = 'refinedstorage'
|
||||
version = '1.10.0-beta.2'
|
||||
version = '1.10.0-beta.3'
|
||||
|
||||
if (System.getenv('GITHUB_SHA') != null) {
|
||||
version += '+' + System.getenv('GITHUB_SHA').substring(0, 7)
|
||||
|
@@ -12,6 +12,8 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
public abstract class BaseBlockEntity extends BlockEntity {
|
||||
protected final BlockEntitySynchronizationManager dataManager = new BlockEntitySynchronizationManager(this);
|
||||
|
||||
private boolean unloaded;
|
||||
|
||||
public BaseBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
@@ -48,6 +50,28 @@ public abstract class BaseBlockEntity extends BlockEntity {
|
||||
readUpdate(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoved() {
|
||||
super.setRemoved();
|
||||
// @Volatile: MC calls setRemoved when a chunk unloads now as well (see ServerLevel#unload -> LevelChunk#clearAllBlockEntities).
|
||||
// Since we don't want to remove network node data in that case, we need to know if it was removed due to unloading.
|
||||
// We can use "unloaded" for that, it's set in #onChunkUnloaded.
|
||||
// Since MC first calls #onChunkUnloaded and then #setRemoved, this check keeps working.
|
||||
if (!unloaded) {
|
||||
onRemovedNotDueToChunkUnload();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onRemovedNotDueToChunkUnload() {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnloaded() {
|
||||
super.onChunkUnloaded();
|
||||
unloaded = true;
|
||||
}
|
||||
|
||||
// @Volatile: Copied with some changes from the super method (avoid sending neighbor updates, it's not needed)
|
||||
@Override
|
||||
public void setChanged() {
|
||||
|
@@ -9,11 +9,11 @@ import com.refinedmods.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.Network;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.node.RootNetworkNode;
|
||||
import com.refinedmods.refinedstorage.capability.NetworkNodeProxyCapability;
|
||||
import com.refinedmods.refinedstorage.blockentity.config.IRedstoneConfigurable;
|
||||
import com.refinedmods.refinedstorage.blockentity.config.RedstoneMode;
|
||||
import com.refinedmods.refinedstorage.blockentity.data.RSSerializers;
|
||||
import com.refinedmods.refinedstorage.blockentity.data.BlockEntitySynchronizationParameter;
|
||||
import com.refinedmods.refinedstorage.blockentity.data.RSSerializers;
|
||||
import com.refinedmods.refinedstorage.capability.NetworkNodeProxyCapability;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
@@ -116,8 +116,8 @@ public class ControllerBlockEntity extends BaseBlockEntity implements INetworkNo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoved() {
|
||||
super.setRemoved();
|
||||
public void onRemovedNotDueToChunkUnload() {
|
||||
super.onRemovedNotDueToChunkUnload();
|
||||
|
||||
if (!level.isClientSide) {
|
||||
INetworkManager manager = API.instance().getNetworkManager((ServerLevel) level);
|
||||
|
@@ -82,8 +82,8 @@ public abstract class NetworkNodeBlockEntity<N extends NetworkNode> extends Base
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoved() {
|
||||
super.setRemoved();
|
||||
public void onRemovedNotDueToChunkUnload() {
|
||||
super.onRemovedNotDueToChunkUnload();
|
||||
|
||||
if (!level.isClientSide) {
|
||||
INetworkNodeManager manager = API.instance().getNetworkNodeManager((ServerLevel) level);
|
||||
|
Reference in New Issue
Block a user