Skip to content

Commit

Permalink
Merge pull request #495 from refinedmods/release/2.0.0-milestone.3.4
Browse files Browse the repository at this point in the history
Release v2.0.0-milestone.3.4
  • Loading branch information
raoulvdberge authored Mar 16, 2024
2 parents 61eaab4 + 0a59360 commit 01ff8a0
Show file tree
Hide file tree
Showing 518 changed files with 7,380 additions and 7,831 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.0-milestone.3.4] - 2024-03-16

### Added

- Void excess mode to storages.

### Fixed

- Fixed losing disk when using Wrench dismantling on the Portable Grid.
- Fixed losing energy when using Wrench dismantling on the Portable Grid and the Controller.
- Fixed changing side buttons not working on Forge.
- Fixed External Storage not displaying empty allowlist warning.
- Fixed incrementing starting from 1 in amount screens not having an intended off-by-one.
- Fixed problems moving network devices with "Carry On" mod.
- Fixed escape key not working on auto-selected Grid search box.

## [2.0.0-milestone.3.3] - 2024-02-17

### Added
Expand Down Expand Up @@ -516,7 +532,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- The Grid can now use smooth scrolling.
- The Grid now has syntax highlighting for the search query.

[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.3...HEAD
[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.4...HEAD

[2.0.0-milestone.3.4]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.3...v2.0.0-milestone.3.4

[2.0.0-milestone.3.3]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.2...v2.0.0-milestone.3.3

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ this mod that allow the player to setup auto-crafting, allowing the crafting of
- [Roadmap](https://github.com/refinedmods/refinedstorage2/projects)
- [Wiki](https://github.com/refinedmods/refinedstorage2/wiki)
- [Refined Mods on GitHub](https://github.com/refinedmods)
- [Javadoc](https://refinedmods.com/javadoc/refinedstorage2)
- [Discord](https://discordapp.com/invite/VYzsydb)
- [Twitter](https://twitter.com/refinedmods)
- [Mastodon](https://anvil.social/@refinedmods)
Expand Down
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ subprojects {

ext {
apis = [
':refinedstorage2-core-api',
':refinedstorage2-resource-api',
':refinedstorage2-storage-api',
':refinedstorage2-network-api',
':refinedstorage2-network',
':refinedstorage2-grid-api',
':refinedstorage2-query-parser'
':refinedstorage2-core-api',
':refinedstorage2-resource-api',
':refinedstorage2-storage-api',
':refinedstorage2-network-api',
':refinedstorage2-network',
':refinedstorage2-grid-api',
':refinedstorage2-query-parser'
]
compileApis = [':refinedstorage2-platform-api']
}
Expand All @@ -22,7 +22,6 @@ enableSonarQube("refinedmods_refinedstorage2")
sonarqube {
properties {
property "sonar.coverage.exclusions", "refinedstorage2-platform-forge/**/*,refinedstorage2-platform-fabric/**/*,refinedstorage2-platform-common/**/*,refinedstorage2-platform-api/**/*"
// TODO: REI code is duplicated as reusing it in a common module isn't possible/too difficult. Fix this.
property "sonar.cpd.exclusions", "refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/integration/recipemod/rei/*,refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/integration/recipemod/rei/*"
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package com.refinedmods.refinedstorage2.api.grid.operations;

import com.refinedmods.refinedstorage2.api.resource.ResourceKey;
import com.refinedmods.refinedstorage2.api.storage.ExtractableStorage;
import com.refinedmods.refinedstorage2.api.storage.InsertableStorage;

import org.apiguardian.api.API;

/**
* Grid operations, used for grids to interact with the storage network.
*
* @param <T> the resource type
*/
@API(status = API.Status.STABLE, since = "2.0.0-milestone.1.2")
public interface GridOperations<T> {
public interface GridOperations {
/**
* Tries to move a resource from the network storage to the destination.
* The amount being extracted depends on the extraction mode.
Expand All @@ -20,7 +19,7 @@ public interface GridOperations<T> {
* @param extractMode the extract mode
* @param destination the destination
*/
boolean extract(T resource, GridExtractMode extractMode, InsertableStorage<T> destination);
boolean extract(ResourceKey resource, GridExtractMode extractMode, InsertableStorage destination);

/**
* Tries to move a resource from the source to the network storage.
Expand All @@ -30,5 +29,5 @@ public interface GridOperations<T> {
* @param insertMode the insertion mode
* @param source the source
*/
boolean insert(T resource, GridInsertMode insertMode, ExtractableStorage<T> source);
boolean insert(ResourceKey resource, GridInsertMode insertMode, ExtractableStorage source);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.refinedmods.refinedstorage2.api.grid.operations;

import com.refinedmods.refinedstorage2.api.resource.ResourceAmount;
import com.refinedmods.refinedstorage2.api.resource.ResourceKey;
import com.refinedmods.refinedstorage2.api.storage.Actor;
import com.refinedmods.refinedstorage2.api.storage.ExtractableStorage;
import com.refinedmods.refinedstorage2.api.storage.InsertableStorage;
Expand All @@ -12,10 +13,10 @@
import org.apiguardian.api.API;

@API(status = API.Status.STABLE, since = "2.0.0-milestone.1.2")
public class GridOperationsImpl<T> implements GridOperations<T> {
private final StorageChannel<T> storageChannel;
public class GridOperationsImpl implements GridOperations {
private final StorageChannel storageChannel;
private final Actor actor;
private final ToLongFunction<T> maxAmountProvider;
private final ToLongFunction<ResourceKey> maxAmountProvider;
private final long singleAmount;

/**
Expand All @@ -25,9 +26,9 @@ public class GridOperationsImpl<T> implements GridOperations<T> {
* @param singleAmount amount that needs to be extracted when using
* {@link GridInsertMode#SINGLE_RESOURCE} or {@link GridExtractMode#SINGLE_RESOURCE}
*/
public GridOperationsImpl(final StorageChannel<T> storageChannel,
public GridOperationsImpl(final StorageChannel storageChannel,
final Actor actor,
final ToLongFunction<T> maxAmountProvider,
final ToLongFunction<ResourceKey> maxAmountProvider,
final long singleAmount) {
this.storageChannel = storageChannel;
this.actor = actor;
Expand All @@ -36,22 +37,22 @@ public GridOperationsImpl(final StorageChannel<T> storageChannel,
}

@Override
public boolean extract(final T resource,
public boolean extract(final ResourceKey resource,
final GridExtractMode extractMode,
final InsertableStorage<T> destination) {
final InsertableStorage destination) {
final long amount = getExtractableAmount(resource, extractMode);
if (amount == 0) {
return false;
}
return TransferHelper.transfer(resource, amount, actor, storageChannel, destination, storageChannel) > 0;
}

private long getExtractableAmount(final T resource, final GridExtractMode extractMode) {
private long getExtractableAmount(final ResourceKey resource, final GridExtractMode extractMode) {
final long extractableAmount = getExtractableAmount(resource);
return adjustExtractableAmountAccordingToExtractMode(extractMode, extractableAmount);
}

private long getExtractableAmount(final T resource) {
private long getExtractableAmount(final ResourceKey resource) {
final long totalSize = storageChannel.get(resource).map(ResourceAmount::getAmount).orElse(0L);
final long maxAmount = maxAmountProvider.applyAsLong(resource);
return Math.min(totalSize, maxAmount);
Expand All @@ -67,7 +68,9 @@ private long adjustExtractableAmountAccordingToExtractMode(final GridExtractMode
}

@Override
public boolean insert(final T resource, final GridInsertMode insertMode, final ExtractableStorage<T> source) {
public boolean insert(final ResourceKey resource,
final GridInsertMode insertMode,
final ExtractableStorage source) {
final long amount = switch (insertMode) {
case ENTIRE_RESOURCE -> maxAmountProvider.applyAsLong(resource);
case SINGLE_RESOURCE -> singleAmount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package com.refinedmods.refinedstorage2.api.grid.operations;

import com.refinedmods.refinedstorage2.api.resource.ResourceKey;
import com.refinedmods.refinedstorage2.api.storage.ExtractableStorage;
import com.refinedmods.refinedstorage2.api.storage.InsertableStorage;

public class NoopGridOperations<T> implements GridOperations<T> {
public class NoopGridOperations implements GridOperations {
@Override
public boolean extract(final T resource,
public boolean extract(final ResourceKey resource,
final GridExtractMode extractMode,
final InsertableStorage<T> destination) {
final InsertableStorage destination) {
return false;
}

@Override
public boolean insert(final T resource,
public boolean insert(final ResourceKey resource,
final GridInsertMode insertMode,
final ExtractableStorage<T> source) {
final ExtractableStorage source) {
return false;
}
}
Loading

0 comments on commit 01ff8a0

Please sign in to comment.