Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.0.0-milestone.3.3 #475

Merged
merged 37 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e30a442
Merge pull request #453 from refinedmods/main
raoulvdberge Nov 3, 2023
694ddac
refactor: remove disk_inactive
raoulvdberge Dec 27, 2023
0845ed9
feat: pass disk item ID in update packet
raoulvdberge Dec 27, 2023
4b462a8
refactor: remove lossy abstraction in storage container helper
raoulvdberge Dec 27, 2023
f8fd21f
feat: custom disk models
raoulvdberge Dec 27, 2023
483a85f
chore: some sonar issues
raoulvdberge Dec 27, 2023
b372340
Merge pull request #461 from refinedmods/feat/GH-460/custom-disks
raoulvdberge Dec 27, 2023
3cd791e
refactor: decouple storage state from multistorage
raoulvdberge Dec 27, 2023
80c432d
Merge pull request #462 from refinedmods/refactor/GH-93/storage-state
raoulvdberge Dec 27, 2023
3ce4d47
refactor: remove resource list indexing as it wasn't used
raoulvdberge Nov 4, 2023
e24705a
feat: content for portable grid
raoulvdberge Nov 4, 2023
a2f0140
refactor: improve disk drive model baking in forge
raoulvdberge Dec 29, 2023
6ea0f43
chore: add loot item function for portable grid
raoulvdberge Dec 29, 2023
bc8bca8
Merge pull request #454 from refinedmods/feat/GH-93/portable-grid
raoulvdberge Dec 29, 2023
ecbb220
feat: portable grid menu
raoulvdberge Dec 29, 2023
552910a
feat: portable grid disk model sync
raoulvdberge Dec 30, 2023
5d89d3d
feat: portable grid activeness and energy
raoulvdberge Dec 30, 2023
cfb40a2
feat: show infinity symbol on creative items
raoulvdberge Dec 31, 2023
cec6e71
feat: portable grid config
raoulvdberge Dec 31, 2023
e1f11ca
refactor: simplify initial grid packet
raoulvdberge Dec 31, 2023
ebc21f3
refactor: improve StateTrackedStorage test
raoulvdberge Dec 31, 2023
2020283
Merge pull request #465 from refinedmods/feat/GH-93/portable-grid-menu
raoulvdberge Dec 31, 2023
a2b0865
fix: grid not retrieving resources from the new master network in a n…
raoulvdberge Jan 1, 2024
fc6d121
Merge pull request #467 from refinedmods/fix/GH-366/grid-merge
raoulvdberge Jan 2, 2024
eea3eee
feat: portable grid interactions
raoulvdberge Jan 1, 2024
3867bfd
chore: add GridWatcherManagerImpl test
raoulvdberge Jan 2, 2024
4ff04c8
Merge pull request #468 from refinedmods/feat/GH-93/portable-grid-int…
raoulvdberge Jan 2, 2024
8193a5d
feat: port to minecraft 1.20.4
raoulvdberge Jan 28, 2024
f29f89a
Merge pull request #471 from refinedmods/feat/GH-470/mc-port
raoulvdberge Jan 28, 2024
bca26d6
feat: portable grid item
raoulvdberge Jan 14, 2024
80a9ef1
Merge pull request #472 from refinedmods/feat/GH-93/portable-grid-item
raoulvdberge Feb 17, 2024
7b3e998
fix: incompatibility with invmove
raoulvdberge Feb 17, 2024
589f766
fix: enchanted book recipes not working on fabric
raoulvdberge Feb 17, 2024
bd429b4
Merge pull request #473 from refinedmods/fix/GH-466/invmove-fix
raoulvdberge Feb 17, 2024
61897f1
feat: chinese translation by Jiangsubei
raoulvdberge Feb 17, 2024
454b7e9
Merge pull request #474 from refinedmods/feat/GH-469/chinese-lang
raoulvdberge Feb 17, 2024
28a5521
chore: prepare release v2.0.0-milestone.3.3
raoulvdberge Feb 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ on:
types: [ opened, synchronize, reopened ]
jobs:
build:
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.11.3
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
type: string
jobs:
draft:
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.11.3
with:
release-type: ${{ inputs.release-type }}
version-number-override: ${{ inputs.version-number-override }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-for-unsupported-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
types: [ labeled, unlabeled, reopened ]
jobs:
unsupported-labeler:
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.11.3
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- closed
jobs:
publish-release:
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.11.3
secrets: inherit
with:
project-name: 'Refined Storage'
2 changes: 1 addition & 1 deletion .github/workflows/resolved-issue-locking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
- cron: '0 0 * * *'
jobs:
lock:
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.11.3
2 changes: 1 addition & 1 deletion .github/workflows/validate-branch-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: Validate branch name
on: [ pull_request ]
jobs:
validate-branch-name:
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.11.3
2 changes: 1 addition & 1 deletion .github/workflows/validate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ]
jobs:
validate-changelog:
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.11.3
2 changes: 1 addition & 1 deletion .github/workflows/validate-commit-messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: Validate commit messages
on: [ pull_request ]
jobs:
validate-commit-messages:
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.9.0
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.11.3
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

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

### Added

- Ported to Minecraft 1.20.4.
- Custom disk models. Fluid disks now have a different model.
- Portable Grid
- Chinese translation by [@Jiangsubei](https://github.com/Jiangsubei).

### Changed

- The Portable Grid now shows an energy bar in the UI.
- The energy bar on creative items now shows the infinity symbol instead of the whole amount.

### Fixed

- Fixed bug where Grid contents weren't synced properly when a network merge occurs.
- Fixed incompatibility crash with InvMove on Fabric.

## [2.0.0-milestone.3.2] - 2023-11-03

### Added
Expand Down Expand Up @@ -497,7 +516,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.2...HEAD
[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.3...HEAD

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

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

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright © 2020 - 2023 Refined Mods
Copyright © 2020 - 2024 Refined Mods

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
Expand Down
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public GridOperationsImpl(final StorageChannel<T> storageChannel,
}

@Override
public boolean extract(final T resource, final GridExtractMode extractMode,
public boolean extract(final T resource,
final GridExtractMode extractMode,
final InsertableStorage<T> destination) {
final long amount = getExtractableAmount(resource, extractMode);
if (amount == 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.refinedmods.refinedstorage2.api.grid.operations;

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

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

@Override
public boolean insert(final T resource,
final GridInsertMode insertMode,
final ExtractableStorage<T> source) {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.refinedmods.refinedstorage2.api.grid.watcher;

import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel;
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType;

import java.util.Set;

import org.apiguardian.api.API;

/**
* Provides the {@link GridWatcherManagerImpl} with {@link StorageChannel}s.
*/
@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3")
public interface GridStorageChannelProvider {
Set<StorageChannelType<?>> getStorageChannelTypes();

<T> StorageChannel<T> getStorageChannel(StorageChannelType<T> type);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.refinedmods.refinedstorage2.api.grid;
package com.refinedmods.refinedstorage2.api.grid.watcher;

import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType;
import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource;
Expand Down Expand Up @@ -36,7 +36,7 @@ <T> void onChanged(
);

/**
* Called when the grid network has been changed.
* Usually called when the grid network has been changed.
*/
void onNetworkChanged();
void invalidate();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.refinedmods.refinedstorage2.api.grid.watcher;

import com.refinedmods.refinedstorage2.api.storage.Actor;

import org.apiguardian.api.API;

/**
* This manager helps with attaching and detaching listeners to
* {@link com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel}s.
*/
@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3")
public interface GridWatcherManager {
void addWatcher(
GridWatcher watcher,
Class<? extends Actor> actorType,
GridStorageChannelProvider storageChannelProvider
);

void attachAll(GridStorageChannelProvider storageChannelProvider);

void removeWatcher(GridWatcher watcher, GridStorageChannelProvider storageChannelProvider);

void detachAll(GridStorageChannelProvider storageChannelProvider);

void activeChanged(boolean active);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package com.refinedmods.refinedstorage2.api.grid.watcher;

import com.refinedmods.refinedstorage2.api.storage.Actor;
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType;

import java.util.HashMap;
import java.util.Map;

import org.apiguardian.api.API;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3")
public class GridWatcherManagerImpl implements GridWatcherManager {
private static final Logger LOGGER = LoggerFactory.getLogger(GridWatcherManagerImpl.class);

private final Map<GridWatcher, GridWatcherRegistration> watchers = new HashMap<>();

@Override
public void addWatcher(
final GridWatcher watcher,
final Class<? extends Actor> actorType,
final GridStorageChannelProvider storageChannelProvider
) {
if (watchers.containsKey(watcher)) {
throw new IllegalArgumentException("Watcher is already registered");
}
final GridWatcherRegistration registration = new GridWatcherRegistration(watcher, actorType);
attachAll(registration, storageChannelProvider, false);
watchers.put(watcher, registration);
LOGGER.info("Added watcher {}, new count is {}", watcher, watchers.size());
}

@Override
public void attachAll(final GridStorageChannelProvider storageChannelProvider) {
// If we get here we are affected by a network split or network merge.
// At this point, all the storages that are affected by the split or merge have not yet been processed
// as the grid has the highest priority.
watchers.forEach((watcher, registration) -> {
// Invalidate all watcher data, the resources that were synced earlier are no longer valid because we have
// a brand-new network.
watcher.invalidate();
// Re-attach the watcher to the new network, and send all the resources from the new network.
// Resources from the old network are not part of the new network yet, as mentioned above,
// but those will be synced when the storages are re-added.
attachAll(registration, storageChannelProvider, true);
});
}

private void attachAll(final GridWatcherRegistration registration,
final GridStorageChannelProvider storageChannelProvider,
final boolean replay) {
storageChannelProvider.getStorageChannelTypes().forEach(storageChannelType -> attach(
registration,
storageChannelType,
storageChannelProvider,
replay
));
}

private <T> void attach(
final GridWatcherRegistration registration,
final StorageChannelType<T> storageChannelType,
final GridStorageChannelProvider storageChannelProvider,
final boolean replay
) {
LOGGER.info("Attaching {} to {}", registration, storageChannelType);
registration.attach(storageChannelProvider.getStorageChannel(storageChannelType), storageChannelType, replay);
}

@Override
public void removeWatcher(final GridWatcher watcher, final GridStorageChannelProvider storageChannelProvider) {
final GridWatcherRegistration registration = watchers.get(watcher);
if (registration == null) {
throw new IllegalArgumentException("Watcher is not registered");
}
detachAll(registration, storageChannelProvider);
watchers.remove(watcher);
LOGGER.info("Removed watcher {}, remaining {}", watcher, watchers.size());
}

@Override
public void detachAll(final GridStorageChannelProvider storageChannelProvider) {
LOGGER.info("Detaching {} watchers", watchers.size());
watchers.values().forEach(w -> detachAll(w, storageChannelProvider));
}

private void detachAll(final GridWatcherRegistration registration,
final GridStorageChannelProvider storageChannelProvider) {
storageChannelProvider.getStorageChannelTypes().forEach(storageChannelType -> detach(
registration,
storageChannelType,
storageChannelProvider
));
}

private <T> void detach(
final GridWatcherRegistration registration,
final StorageChannelType<T> storageChannelType,
final GridStorageChannelProvider storageChannelProvider
) {
LOGGER.info("Detaching {} from {}", registration, storageChannelType);
registration.detach(storageChannelProvider.getStorageChannel(storageChannelType), storageChannelType);
}

@Override
public void activeChanged(final boolean active) {
watchers.keySet().forEach(watcher -> watcher.onActiveChanged(active));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.refinedmods.refinedstorage2.api.network.impl.node.grid;
package com.refinedmods.refinedstorage2.api.grid.watcher;

import com.refinedmods.refinedstorage2.api.grid.GridWatcher;
import com.refinedmods.refinedstorage2.api.resource.list.listenable.ResourceListListener;
import com.refinedmods.refinedstorage2.api.storage.Actor;
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel;
Expand All @@ -9,17 +8,19 @@
import java.util.HashMap;
import java.util.Map;

public class GridWatcherRegistration {
class GridWatcherRegistration {
private final GridWatcher watcher;
private final Class<? extends Actor> actorType;
private final Map<StorageChannelType<?>, ResourceListListener<?>> listeners = new HashMap<>();

public GridWatcherRegistration(final GridWatcher watcher, final Class<? extends Actor> actorType) {
GridWatcherRegistration(final GridWatcher watcher, final Class<? extends Actor> actorType) {
this.watcher = watcher;
this.actorType = actorType;
}

public <T> void attach(final StorageChannel<T> storageChannel, final StorageChannelType<T> storageChannelType) {
<T> void attach(final StorageChannel<T> storageChannel,
final StorageChannelType<T> storageChannelType,
final boolean replay) {
final ResourceListListener<T> listener = change -> watcher.onChanged(
storageChannelType,
change.resourceAmount().getResource(),
Expand All @@ -31,10 +32,21 @@ public <T> void attach(final StorageChannel<T> storageChannel, final StorageChan
);
storageChannel.addListener(listener);
listeners.put(storageChannelType, listener);
if (replay) {
storageChannel.getAll().forEach(resourceAmount -> watcher.onChanged(
storageChannelType,
resourceAmount.getResource(),
resourceAmount.getAmount(),
storageChannel.findTrackedResourceByActorType(
resourceAmount.getResource(),
actorType
).orElse(null)
));
}
}

@SuppressWarnings("unchecked")
public <T> void detach(final StorageChannel<T> storageChannel, final StorageChannelType<T> storageChannelType) {
<T> void detach(final StorageChannel<T> storageChannel, final StorageChannelType<T> storageChannelType) {
final ResourceListListener<T> listener = (ResourceListListener<T>) listeners.get(storageChannelType);
storageChannel.removeListener(listener);
listeners.remove(storageChannelType);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@ParametersAreNonnullByDefault
@FieldsAndMethodsAreNonnullByDefault
package com.refinedmods.refinedstorage2.api.grid;
package com.refinedmods.refinedstorage2.api.grid.watcher;

import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault;

Expand Down
Loading
Loading