Skip to content

Commit

Permalink
Merge pull request #3194 from refinedmods/develop
Browse files Browse the repository at this point in the history
1.10.0-beta.4
  • Loading branch information
raoulvdberge authored Dec 28, 2021
2 parents 01a8254 + 6cdb16a commit 01dabbe
Show file tree
Hide file tree
Showing 74 changed files with 406 additions and 240 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: raoulvdberge
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]

### Fixed

- Fixed client crash when hovering over a fluid in the Fluid Grid by [@jackodsteel](https://github.com/jackodsteel).
- Fixed random client crashes when starting the game.

### Changed

- Update Korean translation by [@mindy15963](https://github.com/mindy15963).

## [v1.10.0-beta.3] - 2021-12-17

### Fixed

- Fixed networks and network devices being removed when a chunk unloads.

## [v1.10.0-beta.2] - 2021-12-16
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ apply plugin: 'maven-publish'

group = 'com.refinedmods'
archivesBaseName = 'refinedstorage'
version = '1.10.0-beta.3'
version = '1.10.0-beta.4'

if (System.getenv('GITHUB_SHA') != null) {
version += '+' + System.getenv('GITHUB_SHA').substring(0, 7)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/refinedmods/refinedstorage/RS.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.refinedmods.refinedstorage.config.ServerConfig;
import com.refinedmods.refinedstorage.datageneration.DataGenerators;
import com.refinedmods.refinedstorage.integration.curios.CuriosIntegration;
import com.refinedmods.refinedstorage.item.group.MainItemGroup;
import com.refinedmods.refinedstorage.item.group.MainCreativeModeTab;
import com.refinedmods.refinedstorage.network.NetworkHandler;
import com.refinedmods.refinedstorage.setup.ClientSetup;
import com.refinedmods.refinedstorage.setup.CommonSetup;
Expand All @@ -28,7 +28,7 @@ public final class RS {
public static final String NAME = "Refined Storage";

public static final NetworkHandler NETWORK_HANDLER = new NetworkHandler();
public static final CreativeModeTab MAIN_GROUP = new MainItemGroup();
public static final CreativeModeTab CREATIVE_MODE_TAB = new MainCreativeModeTab();
public static final ServerConfig SERVER_CONFIG = new ServerConfig();
public static final ClientConfig CLIENT_CONFIG = new ClientConfig();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/refinedmods/refinedstorage/RSItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private RSItems() {
}

private static <T extends BaseBlock> RegistryObject<BlockItem> registerBlockItemFor(RegistryObject<T> block) {
return ITEMS.register(block.getId().getPath(), () -> new BaseBlockItem(block.get(), new Item.Properties().tab(RS.MAIN_GROUP)));
return ITEMS.register(block.getId().getPath(), () -> new BaseBlockItem(block.get(), new Item.Properties().tab(RS.CREATIVE_MODE_TAB)));
}

public static void register() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/refinedmods/refinedstorage/apiimpl/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public Set<IExternalStorageProvider<?>> getExternalStorageProviders(StorageType
@Nonnull
public IStorageDisk<ItemStack> createDefaultItemDisk(ServerLevel level, int capacity, @Nullable Player owner) {
if (level == null) {
throw new IllegalArgumentException("World cannot be null");
throw new IllegalArgumentException("Level cannot be null");
}

return new ItemStorageDisk(level, capacity, owner == null ? null : owner.getGameProfile().getId());
Expand All @@ -255,7 +255,7 @@ public IStorageDisk<ItemStack> createDefaultItemDisk(ServerLevel level, int capa
@Nonnull
public IStorageDisk<FluidStack> createDefaultFluidDisk(ServerLevel level, int capacity, @Nullable Player owner) {
if (level == null) {
throw new IllegalArgumentException("World cannot be null");
throw new IllegalArgumentException("Level cannot be null");
}

return new FluidStorageDisk(level, capacity, owner == null ? null : owner.getGameProfile().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class NetworkListener {
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent e) {
public void onLevelTick(TickEvent.WorldTickEvent e) {
if (!e.world.isClientSide() && e.phase == TickEvent.Phase.END) {
e.world.getProfiler().push("network ticking");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.refinedmods.refinedstorage.api.network.INetwork;
import com.refinedmods.refinedstorage.api.network.INetworkManager;
import com.refinedmods.refinedstorage.api.network.NetworkType;
import com.refinedmods.refinedstorage.apiimpl.util.RSWorldSavedData;
import com.refinedmods.refinedstorage.apiimpl.util.RSSavedData;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
Expand All @@ -16,7 +16,7 @@
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;

public class NetworkManager extends RSWorldSavedData implements INetworkManager {
public class NetworkManager extends RSSavedData implements INetworkManager {
public static final String NAME = "refinedstorage_networks";

private static final String NBT_NETWORKS = "Networks";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void disconnectAll() {
listeners.forEach(INetworkNodeGraphListener::onChanged);
}

protected Level getWorld() {
protected Level getLevel() {
return network.getLevel();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.refinedmods.refinedstorage.api.util.Action;
import com.refinedmods.refinedstorage.util.NetworkUtils;
import com.refinedmods.refinedstorage.util.PlayerUtils;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -27,7 +27,7 @@ public void onBlockPlace(BlockEvent.EntityPlaceEvent e) {
INetworkNode node = NetworkUtils.getNodeFromBlockEntity(e.getWorld().getBlockEntity(e.getBlockSnapshot().getPos().relative(facing)));

if (node != null && node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, player)) {
WorldUtils.sendNoPermissionMessage(player);
LevelUtils.sendNoPermissionMessage(player);

e.setCanceled(true);

Expand Down Expand Up @@ -63,7 +63,7 @@ public void onBlockBreak(BlockEvent.BreakEvent e) {
INetworkNode node = NetworkUtils.getNodeFromBlockEntity(e.getWorld().getBlockEntity(e.getPos()));

if (node != null && node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
WorldUtils.sendNoPermissionMessage(e.getPlayer());
LevelUtils.sendNoPermissionMessage(e.getPlayer());

e.setCanceled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.refinedmods.refinedstorage.api.network.node.INetworkNodeFactory;
import com.refinedmods.refinedstorage.api.network.node.INetworkNodeManager;
import com.refinedmods.refinedstorage.apiimpl.API;
import com.refinedmods.refinedstorage.apiimpl.util.RSWorldSavedData;
import com.refinedmods.refinedstorage.apiimpl.util.RSSavedData;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
Expand All @@ -18,7 +18,7 @@
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;

public class NetworkNodeManager extends RSWorldSavedData implements INetworkNodeManager {
public class NetworkNodeManager extends RSSavedData implements INetworkNodeManager {
public static final String NAME = "refinedstorage_nodes";

private static final String NBT_NODES = "Nodes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.refinedmods.refinedstorage.container.factory.CraftingMonitorMenuProvider;
import com.refinedmods.refinedstorage.inventory.player.PlayerSlot;
import com.refinedmods.refinedstorage.item.WirelessCraftingMonitorItem;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -52,7 +52,7 @@ public boolean onOpen(INetwork network) {

if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player) ||
!network.getSecurityManager().hasPermission(Permission.AUTOCRAFTING, player)) {
WorldUtils.sendNoPermissionMessage(player);
LevelUtils.sendNoPermissionMessage(player);

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.refinedmods.refinedstorage.apiimpl.network.grid.factory.WirelessFluidGridGridFactory;
import com.refinedmods.refinedstorage.inventory.player.PlayerSlot;
import com.refinedmods.refinedstorage.item.WirelessFluidGridItem;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -49,7 +49,7 @@ public boolean onOpen(INetwork network) {
}

if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
WorldUtils.sendNoPermissionMessage(player);
LevelUtils.sendNoPermissionMessage(player);

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.refinedmods.refinedstorage.apiimpl.network.grid.factory.WirelessGridGridFactory;
import com.refinedmods.refinedstorage.inventory.player.PlayerSlot;
import com.refinedmods.refinedstorage.item.WirelessGridItem;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -49,7 +49,7 @@ public boolean onOpen(INetwork network) {
}

if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
WorldUtils.sendNoPermissionMessage(player);
LevelUtils.sendNoPermissionMessage(player);

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.refinedmods.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
import com.refinedmods.refinedstorage.item.UpgradeItem;
import com.refinedmods.refinedstorage.util.StackUtils;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.PositionImpl;
Expand Down Expand Up @@ -105,7 +105,7 @@ private void extractAndPlaceFluid(FluidStack stack) {
network.getCraftingManager().request(this, stack, FluidAttributes.BUCKET_VOLUME);
}
} else if (!level.getBlockState(front).getFluidState().isSource()) {
FluidUtil.tryPlaceFluid(WorldUtils.getFakePlayer((ServerLevel) level, getOwner()), level, InteractionHand.MAIN_HAND, front, new NetworkFluidHandler(StackUtils.copy(stack, FluidAttributes.BUCKET_VOLUME)), stack);
FluidUtil.tryPlaceFluid(LevelUtils.getFakePlayer((ServerLevel) level, getOwner()), level, InteractionHand.MAIN_HAND, front, new NetworkFluidHandler(StackUtils.copy(stack, FluidAttributes.BUCKET_VOLUME)), stack);
}
}

Expand All @@ -114,7 +114,7 @@ private void extractAndPlaceBlock(ItemStack stack) {
if (!took.isEmpty()) {
BlockPlaceContext ctx = new ConstructorBlockItemUseContext(
level,
WorldUtils.getFakePlayer((ServerLevel) level, getOwner()),
LevelUtils.getFakePlayer((ServerLevel) level, getOwner()),
InteractionHand.MAIN_HAND,
took,
new BlockHitResult(Vec3.ZERO, getDirection(), pos, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.refinedmods.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
import com.refinedmods.refinedstorage.item.UpgradeItem;
import com.refinedmods.refinedstorage.util.StackUtils;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -260,7 +260,7 @@ public IItemHandler getConnectedInventory() {
return null;
}

return WorldUtils.getItemHandler(proxy.getFacingBlockEntity(), proxy.getDirection().getOpposite());
return LevelUtils.getItemHandler(proxy.getFacingBlockEntity(), proxy.getDirection().getOpposite());
}

@Nullable
Expand All @@ -271,7 +271,7 @@ public IFluidHandler getConnectedFluidInventory() {
return null;
}

return WorldUtils.getFluidHandler(proxy.getFacingBlockEntity(), proxy.getDirection().getOpposite());
return LevelUtils.getFluidHandler(proxy.getFacingBlockEntity(), proxy.getDirection().getOpposite());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.refinedmods.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
import com.refinedmods.refinedstorage.item.UpgradeItem;
import com.refinedmods.refinedstorage.util.StackUtils;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -122,7 +122,7 @@ private void breakBlock() {
new BlockHitResult(Vec3.ZERO, getDirection().getOpposite(), front, false),
level,
front,
WorldUtils.getFakePlayer((ServerLevel) level, getOwner())
LevelUtils.getFakePlayer((ServerLevel) level, getOwner())
);

if (!frontStack.isEmpty() &&
Expand All @@ -133,7 +133,7 @@ private void breakBlock() {
(ServerLevel) level,
front,
level.getBlockEntity(front),
WorldUtils.getFakePlayer((ServerLevel) level, getOwner()),
LevelUtils.getFakePlayer((ServerLevel) level, getOwner()),
tool
);

Expand All @@ -143,10 +143,10 @@ private void breakBlock() {
}
}

BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(level, front, frontBlockState, WorldUtils.getFakePlayer((ServerLevel) level, getOwner()));
BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(level, front, frontBlockState, LevelUtils.getFakePlayer((ServerLevel) level, getOwner()));

if (!MinecraftForge.EVENT_BUS.post(e)) {
frontBlock.playerWillDestroy(level, front, frontBlockState, WorldUtils.getFakePlayer((ServerLevel) level, getOwner()));
frontBlock.playerWillDestroy(level, front, frontBlockState, LevelUtils.getFakePlayer((ServerLevel) level, getOwner()));

level.removeBlock(front, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.refinedmods.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
import com.refinedmods.refinedstorage.item.UpgradeItem;
import com.refinedmods.refinedstorage.util.StackUtils;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -87,7 +87,7 @@ public void update() {

if (canUpdate() && ticks % upgrades.getSpeed() == 0 && level.isLoaded(pos)) {
if (type == IType.ITEMS) {
IItemHandler handler = WorldUtils.getItemHandler(getFacingBlockEntity(), getDirection().getOpposite());
IItemHandler handler = LevelUtils.getItemHandler(getFacingBlockEntity(), getDirection().getOpposite());

if (handler != null) {
while (filterSlot + 1 < itemFilters.getSlots() && itemFilters.getStackInSlot(filterSlot).isEmpty()) {
Expand Down Expand Up @@ -167,7 +167,7 @@ public void update() {
filterSlot = 0;
}

IFluidHandler handler = WorldUtils.getFluidHandler(getFacingBlockEntity(), getDirection().getOpposite());
IFluidHandler handler = LevelUtils.getFluidHandler(getFacingBlockEntity(), getDirection().getOpposite());

if (handler != null) {
FluidStack stack = fluids[filterSlot];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.refinedmods.refinedstorage.blockentity.config.IType;
import com.refinedmods.refinedstorage.blockentity.config.IWhitelistBlacklist;
import com.refinedmods.refinedstorage.util.StackUtils;
import com.refinedmods.refinedstorage.util.WorldUtils;
import com.refinedmods.refinedstorage.util.LevelUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void update() {

if (type == IType.ITEMS) {
BlockEntity facing = getFacingBlockEntity();
IItemHandler handler = WorldUtils.getItemHandler(facing, getDirection().getOpposite());
IItemHandler handler = LevelUtils.getItemHandler(facing, getDirection().getOpposite());

if (facing instanceof DiskDriveBlockEntity || handler == null) {
return;
Expand Down Expand Up @@ -100,7 +100,7 @@ public void update() {
}
}
} else if (type == IType.FLUIDS && ticks % upgrades.getSpeed() == 0) {
IFluidHandler handler = WorldUtils.getFluidHandler(getFacingBlockEntity(), getDirection().getOpposite());
IFluidHandler handler = LevelUtils.getFluidHandler(getFacingBlockEntity(), getDirection().getOpposite());

if (handler != null) {
FluidStack stack = handler.drain(FluidAttributes.BUCKET_VOLUME, IFluidHandler.FluidAction.SIMULATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
// However, due to the memory footprint of worlds and modded minecraft having the tendency to have lots of worlds,
// Forge is planning to unload (aka remove) worlds so their instances will change.
// This is problematic as this attribute will target the wrong world in that case.
// Idea: possibly change to a getter based on RegistryKey<World>?
// Another note: this attribute isn't the *real* problem. Because network nodes are in WorldSavedData in a tick handler,
// Idea: possibly change to a getter based on RegistryKey<Level>?
// Another note: this attribute isn't the *real* problem. Because network nodes are in SavedData in a tick handler,
// new instances of network nodes will be created when the world refreshes (causing this field to be different too).
// However, network nodes in the network graph *AREN'T* recreated when the world refreshes, causing the graph to have the incorrect instance, and even worse,
// having multiple different instances of the same network node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ public void visit(INetworkNodeVisitor.Operator operator) {

if (canTransmit()) {
if (!isSameDimension()) {
Level dimensionWorld = level.getServer().getLevel(receiverDimension);
Level dimensionLevel = level.getServer().getLevel(receiverDimension);

if (dimensionWorld != null && dimensionWorld.getBlockEntity(receiver) instanceof NetworkReceiverBlockEntity) {
operator.apply(dimensionWorld, receiver, null);
if (dimensionLevel != null && dimensionLevel.getBlockEntity(receiver) instanceof NetworkReceiverBlockEntity) {
operator.apply(dimensionLevel, receiver, null);
}
} else {
if (level.getBlockEntity(receiver) instanceof NetworkReceiverBlockEntity) {
Expand Down
Loading

0 comments on commit 01dabbe

Please sign in to comment.