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.9 #552

Merged
merged 9 commits into from
Jun 9, 2024
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.0-milestone.3.9] - 2024-06-09

### Fixed

- Side button tooltip rendering issue with ModernUI.

## [2.0.0-milestone.3.8] - 2024-06-08

### Removed
Expand Down Expand Up @@ -584,7 +590,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.8...HEAD
[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.9...HEAD

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

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

Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
noIndiumVersion=1.1.0+1.20.4
trinketsVersion=3.8.0
cardinalComponentsVersion=5.4.0
curiosVersion=7.1.0+1.20.4
# Gradle
org.gradle.jvmargs=-Xmx1G
8 changes: 4 additions & 4 deletions refinedstorage2-grid-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ archivesBaseName = 'refinedstorage2-grid-api'

dependencies {
api libs.apiguardian
api project(':refinedstorage2-resource-api')
api project(':refinedstorage2-core-api')
api project(':refinedstorage2-storage-api')
api project(':refinedstorage2-query-parser')
implementation libs.slf4j.api
testImplementation libs.junit.api
testImplementation libs.junit.params
testRuntimeOnly libs.junit.engine
testRuntimeOnly libs.slf4j.impl
testImplementation libs.assertj
testImplementation libs.mockito
implementation project(':refinedstorage2-resource-api')
implementation project(':refinedstorage2-core-api')
implementation project(':refinedstorage2-storage-api')
implementation project(':refinedstorage2-query-parser')
}

test {
Expand Down
8 changes: 4 additions & 4 deletions refinedstorage2-network-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ archivesBaseName = 'refinedstorage2-network-api'

dependencies {
api libs.apiguardian
implementation project(':refinedstorage2-core-api')
implementation project(':refinedstorage2-resource-api')
implementation project(':refinedstorage2-storage-api')
implementation project(':refinedstorage2-grid-api')
api project(':refinedstorage2-core-api')
api project(':refinedstorage2-resource-api')
api project(':refinedstorage2-storage-api')
api project(':refinedstorage2-grid-api')
}

enableJavadoc()
Expand Down
16 changes: 10 additions & 6 deletions refinedstorage2-network-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
plugins {
id 'java-library'
}

archivesBaseName = 'refinedstorage2-network-test'

dependencies {
implementation project(':refinedstorage2-network-api')
implementation project(':refinedstorage2-network')
implementation project(':refinedstorage2-storage-api')
implementation project(':refinedstorage2-resource-api')
implementation project(':refinedstorage2-core-api')
implementation project(':refinedstorage2-grid-api')
api project(':refinedstorage2-network-api')
api project(':refinedstorage2-network')
api project(':refinedstorage2-storage-api')
api project(':refinedstorage2-resource-api')
api project(':refinedstorage2-core-api')
api project(':refinedstorage2-grid-api')
implementation libs.junit.api
testRuntimeOnly libs.junit.engine
testImplementation libs.assertj
Expand Down
14 changes: 9 additions & 5 deletions refinedstorage2-network/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
plugins {
id 'java-library'
}

archivesBaseName = 'refinedstorage2-network'

dependencies {
api project(':refinedstorage2-core-api')
api project(':refinedstorage2-network-api')
api project(':refinedstorage2-resource-api')
api project(':refinedstorage2-storage-api')
api project(':refinedstorage2-grid-api')
implementation libs.slf4j.api
testRuntimeOnly libs.slf4j.impl
testImplementation libs.junit.api
Expand All @@ -9,11 +18,6 @@ dependencies {
testImplementation libs.assertj
testImplementation libs.mockito
testImplementation project(':refinedstorage2-network-test')
implementation project(':refinedstorage2-core-api')
implementation project(':refinedstorage2-network-api')
implementation project(':refinedstorage2-resource-api')
implementation project(':refinedstorage2-storage-api')
implementation project(':refinedstorage2-grid-api')
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ public List<NetworkNodeContainer> sortDeterministically(final Set<NetworkNodeCon
return containers
.stream()
.sorted(Comparator.comparingInt(allowed::indexOf))
.collect(Collectors.toList());
.toList();
}
}
10 changes: 5 additions & 5 deletions refinedstorage2-platform-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ archivesBaseName = 'refinedstorage2-platform-api'

dependencies {
api libs.apiguardian
implementation project(':refinedstorage2-core-api')
implementation project(':refinedstorage2-storage-api')
implementation project(':refinedstorage2-resource-api')
implementation project(':refinedstorage2-network-api')
implementation project(':refinedstorage2-grid-api')
api project(':refinedstorage2-core-api')
api project(':refinedstorage2-storage-api')
api project(':refinedstorage2-resource-api')
api project(':refinedstorage2-network-api')
api project(':refinedstorage2-grid-api')
testImplementation libs.junit.api
testImplementation libs.junit.params
testRuntimeOnly libs.junit.engine
Expand Down
20 changes: 12 additions & 8 deletions refinedstorage2-platform-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
plugins {
id 'java-library'
}

archivesBaseName = 'refinedstorage2-platform-common'

commonProject()

dependencies {
implementation project(':refinedstorage2-platform-api')
implementation project(':refinedstorage2-core-api')
implementation project(':refinedstorage2-resource-api')
implementation project(':refinedstorage2-storage-api')
implementation project(':refinedstorage2-network-api')
implementation project(':refinedstorage2-network')
implementation project(':refinedstorage2-query-parser')
implementation project(':refinedstorage2-grid-api')
api project(':refinedstorage2-platform-api')
api project(':refinedstorage2-core-api')
api project(':refinedstorage2-resource-api')
api project(':refinedstorage2-storage-api')
api project(':refinedstorage2-network-api')
api project(':refinedstorage2-network')
api project(':refinedstorage2-query-parser')
api project(':refinedstorage2-grid-api')
testImplementation libs.junit.api
testImplementation libs.junit.params
testRuntimeOnly libs.junit.engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.refinedmods.refinedstorage2.platform.common.detector.DetectorScreen;
import com.refinedmods.refinedstorage2.platform.common.exporter.ExporterScreen;
import com.refinedmods.refinedstorage2.platform.common.grid.GridContainerMenu;
import com.refinedmods.refinedstorage2.platform.common.grid.NoopGridSynchronizer;
import com.refinedmods.refinedstorage2.platform.common.grid.WirelessGridContainerMenu;
import com.refinedmods.refinedstorage2.platform.common.grid.screen.CraftingGridScreen;
import com.refinedmods.refinedstorage2.platform.common.grid.screen.GridScreen;
Expand Down Expand Up @@ -51,13 +50,6 @@
import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier;

public abstract class AbstractClientModInitializer {
protected static void registerBaseGridSynchronizer() {
PlatformApi.INSTANCE.getGridSynchronizerRegistry().register(
createIdentifier("off"),
NoopGridSynchronizer.INSTANCE
);
}

protected static void registerScreens(final ScreenRegistration registration) {
registration.register(Menus.INSTANCE.getDiskDrive(), DiskDriveScreen::new);
registration.register(Menus.INSTANCE.getGrid(), GridScreen<GridContainerMenu>::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.refinedmods.refinedstorage2.platform.api.upgrade.UpgradeRegistry;
import com.refinedmods.refinedstorage2.platform.api.wirelesstransmitter.WirelessTransmitterRangeModifier;
import com.refinedmods.refinedstorage2.platform.common.grid.AbstractGridContainerMenu;
import com.refinedmods.refinedstorage2.platform.common.grid.NoopGridSynchronizer;
import com.refinedmods.refinedstorage2.platform.common.grid.screen.hint.GridInsertionHintsImpl;
import com.refinedmods.refinedstorage2.platform.common.grid.screen.hint.ItemGridInsertionHint;
import com.refinedmods.refinedstorage2.platform.common.grid.screen.hint.SingleItemGridInsertionHint;
Expand Down Expand Up @@ -88,7 +89,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.PriorityQueue;
import java.util.Queue;
Expand Down Expand Up @@ -116,7 +116,9 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.saveddata.SavedData;

import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier;
import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation;
import static java.util.Objects.requireNonNull;

public class PlatformApiImpl implements PlatformApi {
private final StorageRepository clientStorageRepository =
Expand Down Expand Up @@ -169,6 +171,10 @@ public class PlatformApiImpl implements PlatformApi {
private final CompositeSlotReferenceProvider slotReferenceProvider = new CompositeSlotReferenceProvider();
private final PlatformRegistry<PlatformPermission> permissionRegistry = new PlatformRegistryImpl<>();

public PlatformApiImpl() {
gridSynchronizerRegistry.register(createIdentifier("off"), NoopGridSynchronizer.INSTANCE);
}

@Override
public PlatformRegistry<StorageType> getStorageTypeRegistry() {
return storageTypeRegistry;
Expand All @@ -180,7 +186,7 @@ public StorageRepository getStorageRepository(final Level level) {
if (level.getServer() == null) {
return clientStorageRepository;
}
final ServerLevel serverLevel = Objects.requireNonNull(level.getServer().getLevel(Level.OVERWORLD));
final ServerLevel serverLevel = requireNonNull(level.getServer().getLevel(Level.OVERWORLD));
return serverLevel.getDataStorage().computeIfAbsent(new SavedData.Factory<>(
this::createStorageRepository,
this::createStorageRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public abstract class AbstractBaseScreen<T extends AbstractContainerMenu> extend
private final List<Rect2i> exclusionZones = new ArrayList<>();
private int sideButtonY;

@Nullable
private List<ClientTooltipComponent> deferredTooltip;

protected AbstractBaseScreen(final T menu, final Inventory playerInventory, final Component text) {
super(menu, playerInventory, text);
this.playerInventory = playerInventory;
Expand Down Expand Up @@ -189,9 +192,17 @@ protected void renderTooltip(final GuiGraphics graphics, final int x, final int
return;
}
}
if (deferredTooltip != null) {
Platform.INSTANCE.renderTooltip(graphics, deferredTooltip, x, y);
deferredTooltip = null;
}
super.renderTooltip(graphics, x, y);
}

public void setDeferredTooltip(@Nullable final List<ClientTooltipComponent> deferredTooltip) {
this.deferredTooltip = deferredTooltip;
}

private List<ClientTooltipComponent> getUpgradeTooltip(final ItemStack carried, final UpgradeSlot upgradeSlot) {
if (!carried.isEmpty() || upgradeSlot.hasItem()) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.IOException;
import java.nio.file.AtomicMoveNotSupportedException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

import com.mojang.logging.LogUtils;
Expand All @@ -27,17 +28,23 @@ public void save(final File file) {
compoundTag.put("data", this.save(new CompoundTag()));
NbtUtils.addCurrentDataVersion(compoundTag);
try {
// Write to temp file first.
NbtIo.writeCompressed(compoundTag, tempFile);
// Try atomic move
try {
Files.move(tempFile, targetPath, StandardCopyOption.ATOMIC_MOVE);
} catch (final AtomicMoveNotSupportedException ignored) {
Files.move(tempFile, targetPath, StandardCopyOption.REPLACE_EXISTING);
}
doSave(compoundTag, tempFile, targetPath);
} catch (final IOException e) {
LOGGER.error("Could not save data {}", this, e);
}
setDirty(false);
}

private void doSave(final CompoundTag compoundTag,
final Path tempFile,
final Path targetPath) throws IOException {
// Write to temp file first.
NbtIo.writeCompressed(compoundTag, tempFile);
// Try atomic move
try {
Files.move(tempFile, targetPath, StandardCopyOption.ATOMIC_MOVE);
} catch (final AtomicMoveNotSupportedException ignored) {
Files.move(tempFile, targetPath, StandardCopyOption.REPLACE_EXISTING);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.refinedmods.refinedstorage2.platform.common.support.widget;

import com.refinedmods.refinedstorage2.platform.common.Platform;
import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseScreen;
import com.refinedmods.refinedstorage2.platform.common.support.TextureIds;
import com.refinedmods.refinedstorage2.platform.common.support.tooltip.HelpClientTooltipComponent;
import com.refinedmods.refinedstorage2.platform.common.support.tooltip.SmallTextClientTooltipComponent;
Expand All @@ -11,8 +11,10 @@

import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
Expand Down Expand Up @@ -66,7 +68,10 @@ public void renderWidget(final GuiGraphics graphics, final int mouseX, final int
graphics.blit(getTextureIdentifier(), getX(), getY(), 238, 54, WIDTH, HEIGHT);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
Platform.INSTANCE.renderTooltip(graphics, buildTooltip(), mouseX, mouseY);
final Screen screen = Minecraft.getInstance().screen;
if (screen instanceof AbstractBaseScreen<?> baseScreen) {
baseScreen.setDeferredTooltip(buildTooltip());
}
}
if (warning != null) {
renderWarning(graphics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"block.refinedstorage2.grid": "Grid",
"block.refinedstorage2.crafting_grid": "Crafting Grid",
"block.refinedstorage2.controller": "Controller",
"block.refinedstorage2.controller.rei_fully_charged": "Fully charged Controller",
"block.refinedstorage2.creative_controller": "Creative Controller",
"block.refinedstorage2.1k_storage_block": "1K Storage Block",
"block.refinedstorage2.4k_storage_block": "4K Storage Block",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public Optional<String> getModName(final String modId) {
void setUp() {
viewBuilder = new GridViewBuilderImpl(
FACTORY,
(view) -> Comparator.comparing(GridResource::getName),
(view) -> Comparator.comparing(GridResource::getAmount)
view -> Comparator.comparing(GridResource::getName),
view -> Comparator.comparing(GridResource::getAmount)
);
dirt = new ItemResource(Items.DIRT, null);
stone = new ItemResource(Items.STONE, null);
Expand Down
Loading
Loading