diff --git a/CHANGELOG.md b/CHANGELOG.md index c065417c9..01426a92b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Removed + +- The Trinkets integration has been removed and will be moved to an addon mod. + ## [2.0.0-milestone.3.11] - 2024-06-16 ### Removed diff --git a/gradle.properties b/gradle.properties index a130241d3..1e6a9cb58 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,3 @@ noIndiumVersion=1.1.0+1.20.4 -trinketsVersion=3.8.0 -cardinalComponentsVersion=5.4.0 # Gradle org.gradle.jvmargs=-Xmx1G diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java index 82f97c96d..3ecce5d2d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java @@ -197,7 +197,7 @@ protected final void initializePlatformApi() { registerNetworkComponents(); registerWirelessTransmitterRangeModifiers(); registerPermissions(); - registerSlotReferenceProviders(); + registerSlotReferenceProvider(); } private void registerStorageTypes() { @@ -787,7 +787,7 @@ protected final void registerRecipeSerializers(final RegistryCallback ServerEventQueue.runQueuedActions()); } - @Override - protected void registerSlotReferenceProviders() { - super.registerSlotReferenceProviders(); - TrinketsSlotReferenceProvider.create().ifPresent(slotReferenceProvider -> { - PlatformApi.INSTANCE.getSlotReferenceFactoryRegistry().register( - createIdentifier("trinkets"), - TrinketsSlotReferenceFactory.INSTANCE - ); - PlatformApi.INSTANCE.addSlotReferenceProvider(slotReferenceProvider); - }); - } - private void registerWrenchingEvent() { UseBlockCallback.EVENT.register((player, level, hand, hitResult) -> { final BlockState state = level.getBlockState(hitResult.getBlockPos()); diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReference.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReference.java deleted file mode 100644 index dfdf8fe4e..000000000 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReference.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.network.bounditem; - -import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; -import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory; - -import java.util.Optional; - -import dev.emi.trinkets.api.TrinketsApi; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; - -class TrinketsSlotReference implements SlotReference { - private final String groupName; - private final String slotName; - private final int index; - - TrinketsSlotReference(final String groupName, final String slotName, final int index) { - this.groupName = groupName; - this.slotName = slotName; - this.index = index; - } - - @Override - public boolean isDisabledSlot(final int playerSlotIndex) { - return false; - } - - @Override - public void writeToBuffer(final FriendlyByteBuf buf) { - buf.writeUtf(groupName); - buf.writeUtf(slotName); - buf.writeInt(index); - } - - @Override - public Optional resolve(final Player player) { - return TrinketsApi.getTrinketComponent(player) - .map(trinkets -> trinkets.getInventory().get(groupName)) - .map(groupMap -> groupMap.get(slotName)) - .map(trinketInventory -> trinketInventory.getItem(index)); - } - - @Override - public SlotReferenceFactory getFactory() { - return TrinketsSlotReferenceFactory.INSTANCE; - } -} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReferenceFactory.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReferenceFactory.java deleted file mode 100644 index 074058223..000000000 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReferenceFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.network.bounditem; - -import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; -import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory; - -import net.minecraft.network.FriendlyByteBuf; - -public class TrinketsSlotReferenceFactory implements SlotReferenceFactory { - public static final SlotReferenceFactory INSTANCE = new TrinketsSlotReferenceFactory(); - - private TrinketsSlotReferenceFactory() { - } - - @Override - public SlotReference create(final FriendlyByteBuf buf) { - return new TrinketsSlotReference(buf.readUtf(), buf.readUtf(), buf.readInt()); - } -} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReferenceProvider.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReferenceProvider.java deleted file mode 100644 index 8e8f27cac..000000000 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/TrinketsSlotReferenceProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.refinedmods.refinedstorage2.platform.fabric.support.network.bounditem; - -import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; -import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceProvider; - -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.Set; - -import dev.emi.trinkets.api.TrinketsApi; -import net.minecraft.util.Tuple; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; - -public class TrinketsSlotReferenceProvider implements SlotReferenceProvider { - @Override - public List find(final Player player, final Set validItems) { - return TrinketsApi.getTrinketComponent(player) - .map(trinkets -> trinkets.getEquipped(s -> validItems.contains(s.getItem()))) - .orElse(Collections.emptyList()) - .stream() - .map(Tuple::getA) - .map(trinketsSlotReference -> (SlotReference) new TrinketsSlotReference( - trinketsSlotReference.inventory().getSlotType().getGroup(), - trinketsSlotReference.inventory().getSlotType().getName(), - trinketsSlotReference.index() - )) - .toList(); - } - - public static Optional create() { - if (!isTrinketsLoaded()) { - return Optional.empty(); - } - return Optional.of(new TrinketsSlotReferenceProvider()); - } - - private static boolean isTrinketsLoaded() { - try { - Class.forName("dev.emi.trinkets.api.TrinketsApi"); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } -} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/package-info.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/package-info.java deleted file mode 100644 index 557bcaf20..000000000 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/support/network/bounditem/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@ParametersAreNonnullByDefault -@FieldsAndMethodsAreNonnullByDefault -package com.refinedmods.refinedstorage2.platform.fabric.support.network.bounditem; - -import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage2-platform-fabric/src/main/resources/assets/refinedstorage2/textures/slot/trinkets.png b/refinedstorage2-platform-fabric/src/main/resources/assets/refinedstorage2/textures/slot/trinkets.png deleted file mode 100644 index 2d0f73a53..000000000 Binary files a/refinedstorage2-platform-fabric/src/main/resources/assets/refinedstorage2/textures/slot/trinkets.png and /dev/null differ diff --git a/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/entities/refinedstorage2.json b/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/entities/refinedstorage2.json deleted file mode 100644 index 5a8371927..000000000 --- a/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/entities/refinedstorage2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "entities": [ - "player" - ], - "slots": [ - "refinedstorage2/wireless" - ] -} \ No newline at end of file diff --git a/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/slots/refinedstorage2/wireless.json b/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/slots/refinedstorage2/wireless.json deleted file mode 100644 index 7a92fe4a5..000000000 --- a/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/slots/refinedstorage2/wireless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "order": 5, - "amount": 2, - "icon": "refinedstorage2:slot/trinkets" -} \ No newline at end of file diff --git a/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/tags/items/refinedstorage2/wireless.json b/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/tags/items/refinedstorage2/wireless.json deleted file mode 100644 index 778353b57..000000000 --- a/refinedstorage2-platform-fabric/src/main/resources/data/trinkets/tags/items/refinedstorage2/wireless.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "replace": false, - "values": [ - "refinedstorage2:wireless_grid", - "refinedstorage2:creative_wireless_grid" - ] -} \ No newline at end of file