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.4.3 #604

Merged
merged 13 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ out/
/bin/
logs/
.cache/
run/
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.0-milestone.4.3] - 2024-07-06

### Added

- Ability to open Portable Grid with a keybinding.

### Fixed

- Fixed Relay model not being able to load correctly.
- Fixed not being able to ghost drag resources from recipe viewers into filter slots on NeoForge.
- Fixed extra dark backgrounds due to drawing background on GUIs twice.
- Fixed Configuration Card not being able to transfer upgrades for the Wireless Transmitter.
- Fixed upgrade inventories not maintaining order after reloading. Upgrade inventories from the milestone 4.2 are incompatible and will be empty.
- Fixed Wireless Transmitter not dropping upgrades when breaking block.

## [2.0.0-milestone.4.2] - 2024-07-06

## [2.0.0-milestone.4.1] - 2024-07-05
Expand Down Expand Up @@ -647,7 +662,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.4.2...HEAD
[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.4.3...HEAD

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
import com.refinedmods.refinedstorage.platform.api.support.network.ConnectionLogic;
import com.refinedmods.refinedstorage.platform.api.support.network.InWorldNetworkNodeContainer;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.NetworkBoundItemHelper;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.api.support.registry.PlatformRegistry;
import com.refinedmods.refinedstorage.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceFactory;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceRendering;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceType;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.api.upgrade.BuiltinUpgradeDestinations;
import com.refinedmods.refinedstorage.platform.api.upgrade.UpgradeRegistry;
import com.refinedmods.refinedstorage.platform.api.wirelesstransmitter.WirelessTransmitterRangeModifier;
Expand Down Expand Up @@ -192,7 +192,7 @@ EnergyStorage asBlockItemEnergyStorage(

SlotReference createInventorySlotReference(Player player, InteractionHand hand);

void useNetworkBoundItem(Player player, Item... items);
void useSlotReferencedItem(Player player, Item... items);

BuiltinPermissions getBuiltinPermissions();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
import com.refinedmods.refinedstorage.platform.api.support.network.ConnectionLogic;
import com.refinedmods.refinedstorage.platform.api.support.network.InWorldNetworkNodeContainer;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.NetworkBoundItemHelper;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.api.support.registry.PlatformRegistry;
import com.refinedmods.refinedstorage.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceFactory;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceRendering;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceType;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.api.upgrade.BuiltinUpgradeDestinations;
import com.refinedmods.refinedstorage.platform.api.upgrade.UpgradeRegistry;
import com.refinedmods.refinedstorage.platform.api.wirelesstransmitter.WirelessTransmitterRangeModifier;
Expand Down Expand Up @@ -368,8 +368,8 @@ public SlotReference createInventorySlotReference(final Player player, final Int
}

@Override
public void useNetworkBoundItem(final Player player, final Item... items) {
ensureLoaded().useNetworkBoundItem(player, items);
public void useSlotReferencedItem(final Player player, final Item... items) {
ensureLoaded().useSlotReferencedItem(player, items);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import com.refinedmods.refinedstorage.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.NetworkBoundItemHelper;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.NetworkBoundItemSession;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceHandlerItem;

import java.util.List;
import java.util.Optional;
Expand All @@ -22,7 +23,7 @@
import org.apiguardian.api.API;

@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.1")
public abstract class AbstractNetworkBoundEnergyItem extends AbstractEnergyItem {
public abstract class AbstractNetworkBoundEnergyItem extends AbstractEnergyItem implements SlotReferenceHandlerItem {
protected final NetworkBoundItemHelper networkBoundItemHelper;

protected AbstractNetworkBoundEnergyItem(final Properties properties,
Expand Down Expand Up @@ -56,17 +57,22 @@ public InteractionResultHolder<ItemStack> use(final Level level, final Player pl
final ItemStack stack = player.getItemInHand(hand);
if (player instanceof ServerPlayer serverPlayer && level.getServer() != null) {
final SlotReference slotReference = PlatformApi.INSTANCE.createInventorySlotReference(player, hand);
final NetworkBoundItemSession session = networkBoundItemHelper.openSession(
stack,
serverPlayer,
slotReference
);
use(serverPlayer, slotReference, session);
slotReference.resolve(player).ifPresent(s -> use(serverPlayer, s, slotReference));
}
return InteractionResultHolder.consume(stack);
}

public abstract void use(ServerPlayer player, SlotReference slotReference, NetworkBoundItemSession session);
@Override
public void use(final ServerPlayer player, final ItemStack stack, final SlotReference slotReference) {
final NetworkBoundItemSession session = PlatformApi.INSTANCE.getNetworkBoundItemHelper().openSession(
stack,
player,
slotReference
);
use(player, slotReference, session);
}

protected abstract void use(ServerPlayer player, SlotReference slotReference, NetworkBoundItemSession session);

public boolean isBound(final ItemStack stack) {
return networkBoundItemHelper.isBound(stack);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.refinedmods.refinedstorage.platform.api.support.network.bounditem;

import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;

import java.util.List;
import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.refinedmods.refinedstorage.platform.api.support.network.bounditem;
package com.refinedmods.refinedstorage.platform.api.support.slotreference;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.refinedmods.refinedstorage.platform.api.support.network.bounditem;
package com.refinedmods.refinedstorage.platform.api.support.slotreference;

import com.refinedmods.refinedstorage.platform.api.PlatformApi;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.refinedmods.refinedstorage.platform.api.support.slotreference;

import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import org.apiguardian.api.API;

@FunctionalInterface
@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.3")
public interface SlotReferenceHandlerItem {
void use(ServerPlayer player, ItemStack stack, SlotReference slotReference);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.refinedmods.refinedstorage.platform.api.support.network.bounditem;
package com.refinedmods.refinedstorage.platform.api.support.slotreference;

import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@FieldsAndMethodsAreNonnullByDefault
package com.refinedmods.refinedstorage.platform.api.support.slotreference;

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

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,20 @@ protected static void handleInputEvents() {
}
final KeyMapping openWirelessGrid = KeyMappings.INSTANCE.getOpenWirelessGrid();
while (openWirelessGrid != null && openWirelessGrid.consumeClick()) {
PlatformApi.INSTANCE.useNetworkBoundItem(
PlatformApi.INSTANCE.useSlotReferencedItem(
player,
Items.INSTANCE.getWirelessGrid(),
Items.INSTANCE.getCreativeWirelessGrid()
);
}
final KeyMapping openPortableGrid = KeyMappings.INSTANCE.getOpenPortableGrid();
while (openPortableGrid != null && openPortableGrid.consumeClick()) {
PlatformApi.INSTANCE.useSlotReferencedItem(
player,
Items.INSTANCE.getPortableGrid(),
Items.INSTANCE.getCreativePortableGrid()
);
}
}

protected static void registerDiskModels() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@
import com.refinedmods.refinedstorage.platform.common.support.containermenu.SingleAmountData;
import com.refinedmods.refinedstorage.platform.common.support.energy.EnergyLootItemFunction;
import com.refinedmods.refinedstorage.platform.common.support.network.BaseNetworkNodeContainerBlockEntity;
import com.refinedmods.refinedstorage.platform.common.support.network.bounditem.InventorySlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.common.support.network.component.PlatformStorageNetworkComponent;
import com.refinedmods.refinedstorage.platform.common.support.resource.FluidResourceFactory;
import com.refinedmods.refinedstorage.platform.common.support.resource.ResourceContainerData;
import com.refinedmods.refinedstorage.platform.common.support.resource.ResourceTypes;
import com.refinedmods.refinedstorage.platform.common.support.slotreference.InventorySlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.common.upgrade.FortuneUpgradeItem;
import com.refinedmods.refinedstorage.platform.common.upgrade.RangeUpgradeItem;
import com.refinedmods.refinedstorage.platform.common.upgrade.RegulatorUpgradeContainerMenu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
import com.refinedmods.refinedstorage.platform.api.support.network.InWorldNetworkNodeContainer;
import com.refinedmods.refinedstorage.platform.api.support.network.NetworkNodeContainerBlockEntity;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.NetworkBoundItemHelper;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.api.support.registry.PlatformRegistry;
import com.refinedmods.refinedstorage.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceFactory;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceRendering;
import com.refinedmods.refinedstorage.platform.api.support.resource.ResourceType;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.api.upgrade.BuiltinUpgradeDestinations;
import com.refinedmods.refinedstorage.platform.api.upgrade.UpgradeRegistry;
import com.refinedmods.refinedstorage.platform.api.wirelesstransmitter.WirelessTransmitterRangeModifier;
Expand All @@ -68,15 +68,15 @@
import com.refinedmods.refinedstorage.platform.common.support.energy.ItemEnergyStorage;
import com.refinedmods.refinedstorage.platform.common.support.network.ConnectionProviderImpl;
import com.refinedmods.refinedstorage.platform.common.support.network.InWorldNetworkNodeContainerImpl;
import com.refinedmods.refinedstorage.platform.common.support.network.bounditem.CompositeSlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.common.support.network.bounditem.InventorySlotReference;
import com.refinedmods.refinedstorage.platform.common.support.network.bounditem.NetworkBoundItemHelperImpl;
import com.refinedmods.refinedstorage.platform.common.support.packet.c2s.C2SPackets;
import com.refinedmods.refinedstorage.platform.common.support.packet.s2c.S2CPackets;
import com.refinedmods.refinedstorage.platform.common.support.registry.PlatformRegistryImpl;
import com.refinedmods.refinedstorage.platform.common.support.resource.CompositeRecipeModIngredientConverter;
import com.refinedmods.refinedstorage.platform.common.support.resource.FluidResourceFactory;
import com.refinedmods.refinedstorage.platform.common.support.resource.ItemResourceFactory;
import com.refinedmods.refinedstorage.platform.common.support.slotreference.CompositeSlotReferenceProvider;
import com.refinedmods.refinedstorage.platform.common.support.slotreference.InventorySlotReference;
import com.refinedmods.refinedstorage.platform.common.upgrade.BuiltinUpgradeDestinationsImpl;
import com.refinedmods.refinedstorage.platform.common.upgrade.UpgradeRegistryImpl;
import com.refinedmods.refinedstorage.platform.common.util.ServerEventQueue;
Expand Down Expand Up @@ -519,9 +519,9 @@ public SlotReference createInventorySlotReference(final Player player, final Int
}

@Override
public void useNetworkBoundItem(final Player player, final Item... items) {
public void useSlotReferencedItem(final Player player, final Item... items) {
final Set<Item> validItems = new HashSet<>(Arrays.asList(items));
slotReferenceProvider.findForUse(player, items[0], validItems).ifPresent(C2SPackets::sendUseNetworkBoundItem);
slotReferenceProvider.findForUse(player, items[0], validItems).ifPresent(C2SPackets::sendUseSlotReferencedItem);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

import static com.refinedmods.refinedstorage.platform.common.util.IdentifierUtil.MOD_ID;
import static com.refinedmods.refinedstorage.platform.common.util.IdentifierUtil.createTranslation;
import static com.refinedmods.refinedstorage.platform.common.util.IdentifierUtil.createTranslationKey;

public final class ContentNames {
public static final String MOD_TRANSLATION_KEY = "mod." + MOD_ID;
public static final MutableComponent MOD = Component.translatable(MOD_TRANSLATION_KEY);

public static final MutableComponent CABLE = name("cable");
public static final MutableComponent GRID = name("grid");
public static final MutableComponent CRAFTING_GRID = name("crafting_grid");
Expand All @@ -35,6 +37,14 @@ public final class ContentNames {
public static final MutableComponent RELAY = name("relay");
public static final MutableComponent DISK_INTERFACE = name("disk_interface");

public static final String CLEAR_CRAFTING_MATRIX_TO_NETWORK_TRANSLATION_KEY =
createTranslationKey("key", "clear_crafting_grid_matrix_to_network");
public static final String CLEAR_CRAFTING_MATRIX_TO_INVENTORY_TRANSLATION_KEY =
createTranslationKey("key", "clear_crafting_grid_matrix_to_inventory");
public static final String FOCUS_SEARCH_BAR_TRANSLATION_KEY = createTranslationKey("key", "focus_search_bar");
public static final String OPEN_WIRELESS_GRID_TRANSLATION_KEY = createTranslationKey("key", "open_wireless_grid");
public static final String OPEN_PORTABLE_GRID_TRANSLATION_KEY = createTranslationKey("key", "open_portable_grid");

private ContentNames() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public final class KeyMappings {
private KeyMapping clearCraftingGridMatrixToInventory;
@Nullable
private KeyMapping openWirelessGrid;
@Nullable
private KeyMapping openPortableGrid;

private KeyMappings() {
}
Expand Down Expand Up @@ -54,4 +56,13 @@ public KeyMapping getOpenWirelessGrid() {
public void setOpenWirelessGrid(final KeyMapping openWirelessGrid) {
this.openWirelessGrid = openWirelessGrid;
}

@Nullable
public KeyMapping getOpenPortableGrid() {
return openPortableGrid;
}

public void setOpenPortableGrid(final KeyMapping openPortableGrid) {
this.openPortableGrid = openPortableGrid;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.refinedmods.refinedstorage.platform.common.grid;

import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceFactory;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.refinedmods.refinedstorage.platform.common.grid;

import com.refinedmods.refinedstorage.platform.api.grid.Grid;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.common.content.Menus;

import net.minecraft.world.entity.player.Inventory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.refinedmods.refinedstorage.platform.common.grid;

import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReferenceFactory;

import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.refinedmods.refinedstorage.platform.common.grid;

import com.refinedmods.refinedstorage.platform.api.grid.Grid;
import com.refinedmods.refinedstorage.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage.platform.api.support.slotreference.SlotReference;
import com.refinedmods.refinedstorage.platform.common.content.ContentNames;
import com.refinedmods.refinedstorage.platform.common.support.containermenu.ExtendedMenuProvider;

Expand Down
Loading
Loading