Skip to content

Commit

Permalink
Merge pull request #211 from refinedmods/develop
Browse files Browse the repository at this point in the history
v2.0.0-milestone.2.2
  • Loading branch information
raoulvdberge authored Aug 6, 2022
2 parents c984e57 + 5ad28ca commit b7b091a
Show file tree
Hide file tree
Showing 130 changed files with 2,887 additions and 1,342 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Changed

- All directional blocks no longer transmit a network signal out of the direction.
- All directional blocks no longer accept a network signal from the facing direction.
- Upgrade items now state the applicable destinations in the tooltip.
- Upgrade items can now have a maximum of 1 type per upgrade inventory.
- You can now SHIFT + CLICK transfer resources in the filter slots again.

### Fixed

- Fixed network connection state not rebuilding after using Wrench on a directional block.
- Fixed Grid tooltip being too small in some cases and item durability not being rendered.

### Added

- Upgrade
- Speed Upgrade
- Stack Upgrade

## [2.0.0-milestone.2.1] - 2022-07-30

### Changed

- The Importer will now extract as much of 1 resource type as possible, according to the per tick transfer quota, at
once for all the inventory slots.
- The Importer no longer transmits a network signal on the direction it's facing.
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ allprojects {

subprojects {
group = 'com.refinedmods.refinedstorage2'
version = '2.0.0-milestone.2.1'
version = '2.0.0-milestone.2.2'

if (System.getenv('GITHUB_SHA') != null) {
version += '+' + System.getenv('GITHUB_SHA').substring(0, 7)
Expand Down Expand Up @@ -40,6 +40,7 @@ subprojects {

checkstyle {
configFile rootProject.file("checkstyle.xml")
configDirectory.set(rootProject.projectDir)
toolVersion = project.checkstyleVersion
}

Expand Down
6 changes: 6 additions & 0 deletions checkstyle-imports.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE import-control PUBLIC
"-//Checkstyle//DTD ImportControl Configuration 1.4//EN"
"https://checkstyle.org/dtds/import_control_1_4.dtd">
<import-control pkg="com.refinedmods.refinedstorage2" strategyOnMismatch="allowed">
<disallow pkg="org.jetbrains.annotations"/>
</import-control>
3 changes: 3 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
</module>
<module name="AvoidNestedBlocks"/>
<module name="AvoidStarImport"/>
<module name="ImportControl">
<property name="file" value="${config_loc}/checkstyle-imports.xml"/>
</module>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ public static <T> void validateContains(final Collection<T> collection, final T
throw new IllegalArgumentException(message);
}
}

public static <T> void validateNotContains(final Collection<T> collection, final T value, final String message) {
if (collection.contains(value)) {
throw new IllegalArgumentException(message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ class CoreValidationsTest {
@Test
void shouldValidateEquals() {
// Act & assert
final Exception e1 =
assertThrows(IllegalStateException.class, () -> CoreValidations.validateEquals(1, 2, "bla"));
final Exception e1 = assertThrows(
IllegalStateException.class,
() -> CoreValidations.validateEquals(1, 2, "bla")
);
assertThat(e1.getMessage()).isEqualTo("bla");

final Exception e2 =
assertThrows(IllegalStateException.class, () -> CoreValidations.validateEquals(null, 2, "bla"));
final Exception e2 = assertThrows(
IllegalStateException.class,
() -> CoreValidations.validateEquals(null, 2, "bla")
);
assertThat(e2.getMessage()).isEqualTo("bla");

final Exception e3 =
assertThrows(IllegalStateException.class, () -> CoreValidations.validateEquals(1, null, "bla"));
final Exception e3 = assertThrows(
IllegalStateException.class,
() -> CoreValidations.validateEquals(1, null, "bla")
);
assertThat(e3.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateEquals(1, 1, "bla"));
Expand All @@ -31,8 +37,10 @@ void shouldValidateEquals() {
@Test
void shouldValidateNotNull() {
// Act & assert
final Exception e =
assertThrows(NullPointerException.class, () -> CoreValidations.validateNotNull(null, "bla"));
final Exception e = assertThrows(
NullPointerException.class,
() -> CoreValidations.validateNotNull(null, "bla")
);
assertThat(e.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateNotNull("not null", "bla"));
Expand All @@ -43,25 +51,31 @@ void shouldValidateNotNull() {
@Test
void shouldValidateNotNegative() {
// Act & assert
final Exception e =
assertThrows(IllegalArgumentException.class, () -> CoreValidations.validateNotNegative(-1, "bla"));
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateNotNegative(-1, "bla")
);
assertThat(e.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateNotNegative(0, "bla"));
assertDoesNotThrow(() -> CoreValidations.validateNotNegative(1, "bla"));

assertThat(CoreValidations.validateNotNegative(0, "test")).isEqualTo(0);
assertThat(CoreValidations.validateNotNegative(0, "test")).isZero();
}

@Test
void shouldValidateNegative() {
// Act & assert
final Exception e1 =
assertThrows(IllegalArgumentException.class, () -> CoreValidations.validateNegative(0, "bla"));
final Exception e1 = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateNegative(0, "bla")
);
assertThat(e1.getMessage()).isEqualTo("bla");

final Exception e2 =
assertThrows(IllegalArgumentException.class, () -> CoreValidations.validateNegative(1, "bla"));
final Exception e2 = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateNegative(1, "bla")
);
assertThat(e2.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateNegative(-1, "bla"));
Expand All @@ -71,8 +85,10 @@ void shouldValidateNegative() {
@Test
void shouldValidateLargerThanZero() {
// Act & assert
final Exception e =
assertThrows(IllegalArgumentException.class, () -> CoreValidations.validateLargerThanZero(0, "bla"));
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateLargerThanZero(0, "bla")
);
assertThat(e.getMessage()).isEqualTo("bla");

final Exception e2 =
Expand All @@ -86,8 +102,11 @@ void shouldValidateLargerThanZero() {
@Test
void shouldValidateEmpty() {
// Act & assert
final Exception e =
assertThrows(IllegalArgumentException.class, () -> CoreValidations.validateEmpty(List.of(1), "bla"));
final List<Integer> badList = List.of(1);
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateEmpty(badList, "bla")
);
assertThat(e.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateEmpty(List.of(), "bla"));
Expand All @@ -96,10 +115,26 @@ void shouldValidateEmpty() {
@Test
void shouldValidateContains() {
// Act & assert
final Exception e =
assertThrows(IllegalArgumentException.class, () -> CoreValidations.validateContains(List.of(1), 2, "bla"));
final List<Integer> badList = List.of(1);
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateContains(badList, 2, "bla")
);
assertThat(e.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateContains(List.of(1), 1, "bla"));
}

@Test
void shouldValidateNotContains() {
// Act & assert
final List<Integer> badList = List.of(1);
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> CoreValidations.validateNotContains(badList, 1, "bla")
);
assertThat(e.getMessage()).isEqualTo("bla");

assertDoesNotThrow(() -> CoreValidations.validateNotContains(List.of(1), 2, "bla"));
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
package com.refinedmods.refinedstorage2.api.grid;

import com.refinedmods.refinedstorage2.api.resource.list.ResourceListOperationResult;
import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource;

import javax.annotation.Nullable;

import org.apiguardian.api.API;

/**
* A grid listener.
*/
@API(status = API.Status.STABLE, since = "2.0.0-milestone.1.0")
public interface GridWatcher {
public interface GridWatcher<T> {
/**
* Called when the activeness state of the grid has changed.
*
* @param newActive the new activeness state
*/
void onActiveChanged(boolean newActive);

/**
* Called when a resource is changed.
*
* @param change the change
* @param trackedResource the tracked resource, if present
*/
void onChanged(ResourceListOperationResult<T> change, @Nullable TrackedResource trackedResource);
}
Loading

0 comments on commit b7b091a

Please sign in to comment.