Skip to content

Commit

Permalink
feat: port to minecraft 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Jul 20, 2024
1 parent d85d492 commit 016697e
Show file tree
Hide file tree
Showing 28 changed files with 142 additions and 119 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ These are the most important things to know before contributing (also explained
- Commit messages must adhere to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
- Branch names must be formatted correctly. The format is `{category}/GH-{issue number}/{lowercase-description}`.
Category must match a
category [used in our Commitlint config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum).
category [used in our Commitlint config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum). You can also use `NO-ISSUE` instead of a GitHub issue number.
- We use [Checkstyle](https://checkstyle.sourceforge.io/) in our build workflow to validate coding style. It is
recommended to import the [config/checkstyle/checkstyle.xml](../config/checkstyle/checkstyle.xml)
or [config/intellij-code-style.xml](../config/intellij-code-style.xml) file into your
Expand Down Expand Up @@ -47,7 +47,7 @@ Because we use merge commits when merging a PR, branch names will be part of the
branch names must follow a certain standard.

The format is `{category}/GH-{issue number}/{lowercase-description}` and a branch name can be maximum 50 characters of
length.
length. You can also use `NO-ISSUE` instead of a GitHub issue number.

Category must match a
category [used in our Commitlint config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum).
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ body:
description: |
If your Minecraft version isn't listed here, it means that it's no longer supported. In that case, don't create an issue.
options:
- Minecraft 1.20.4
- Minecraft 1.21
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [ opened, synchronize, reopened ]
jobs:
build:
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.16.7
with:
mutation-testing: false
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.16.7
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.16.7
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.16.7
secrets: inherit
with:
project-name: 'Refined Storage - Trinkets Integration'
Expand Down
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.16.7
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.16.7
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.16.7
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.13.4
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.16.7
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Support for Refined Storage v2.0.0-milestone.4.4.
- The Portable Grid can now also be equipped as a trinket.

## [0.1.0] - 2024-06-18

### Added
Expand Down
48 changes: 0 additions & 48 deletions build.gradle

This file was deleted.

53 changes: 53 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
plugins {
id("refinedarchitect.root")
id("refinedarchitect.fabric")
}

repositories {
maven {
url = uri("https://maven.pkg.github.com/refinedmods/refinedstorage2")
credentials {
username = "anything"
password = "\u0067hp_oGjcDFCn8jeTzIj4Ke9pLoEVtpnZMP4VQgaX"
}
}
maven {
name = "ModMenu"
url = uri("https://maven.terraformersmc.com/")
}
maven {
name = "Cloth Config"
url = uri("https://maven.shedaniel.me/")
}
maven {
name = "Trinkets"
url = uri("https://maven.ladysnake.org/releases")
}
}

refinedarchitect {
modId = "refinedstorage_trinkets_integration"
fabric()
sonarQube("refinedmods_refinedstorage-trinkets-integration", "refinedmods")
publishing {
maven = true
}
}

group = "com.refinedmods.refinedstorage"

base {
archivesName.set("refinedstorage-trinkets-integration")
}

val refinedstorageVersion: String by project
val trinketsVersion: String by project
val cardinalComponentsVersion: String by project

dependencies {
modApi("com.refinedmods.refinedstorage:refinedstorage-platform-fabric:${refinedstorageVersion}")
modApi("dev.emi:trinkets:${trinketsVersion}")
modApi("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${cardinalComponentsVersion}")
modApi("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${cardinalComponentsVersion}")
}

8 changes: 5 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
refinedstorageVersion=2.0.0-milestone.3.13
trinketsVersion=3.8.0
cardinalComponentsVersion=5.4.0
refinedarchitectVersion=0.16.7
refinedstorageVersion=2.0.0-milestone.4.4
# https://www.curseforge.com/minecraft/mc-mods/trinkets/files
trinketsVersion=3.10.0
cardinalComponentsVersion=6.1.0
# Gradle
org.gradle.jvmargs=-Xmx1G
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
22 changes: 22 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://maven.pkg.github.com/refinedmods/refinedarchitect")
credentials {
username = "anything"
password = "\u0067hp_oGjcDFCn8jeTzIj4Ke9pLoEVtpnZMP4VQgaX"
}
}
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
}
val refinedarchitectVersion: String by settings
plugins {
id("refinedarchitect.root").version(refinedarchitectVersion)
id("refinedarchitect.fabric").version(refinedarchitectVersion)
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
package com.refinedmods.refinedstorage.trinkets;

import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage2.platform.api.RefinedStoragePlugin;
import com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil;
import com.refinedmods.refinedstorage.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.RefinedStoragePlugin;

import net.minecraft.resources.ResourceLocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TrinketsRefinedStoragePlugin implements RefinedStoragePlugin {
public static final String ID = "refinedstorage_trinkets_integration";

private static final Logger LOGGER = LoggerFactory.getLogger(TrinketsRefinedStoragePlugin.class);

@Override
public void onPlatformApiAvailable(final PlatformApi platformApi) {
PlatformApi.INSTANCE.getSlotReferenceFactoryRegistry().register(
new ResourceLocation(ID, "trinkets"),
ResourceLocation.fromNamespaceAndPath(ID, "trinkets"),
TrinketsSlotReferenceFactory.INSTANCE
);
PlatformApi.INSTANCE.addSlotReferenceProvider(new TrinketsSlotReferenceProvider());
LOGGER.info(
"Refined Storage - Trinkets Integration has loaded. RS2 ModId: {}",
IdentifierUtil.MOD_ID
);
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
package com.refinedmods.refinedstorage.trinkets;

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

import java.util.Optional;

import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory;
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;
}

record TrinketsSlotReference(String groupName, String slotName, int index) implements SlotReference {
@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<ItemStack> resolve(final Player player) {
return TrinketsApi.getTrinketComponent(player)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package com.refinedmods.refinedstorage.trinkets;

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;
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.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;

class TrinketsSlotReferenceFactory implements SlotReferenceFactory {
public static final SlotReferenceFactory INSTANCE = new TrinketsSlotReferenceFactory();
static final SlotReferenceFactory INSTANCE = new TrinketsSlotReferenceFactory();
private static final StreamCodec<RegistryFriendlyByteBuf, TrinketsSlotReference> STREAM_CODEC =
StreamCodec.composite(
ByteBufCodecs.STRING_UTF8, TrinketsSlotReference::groupName,
ByteBufCodecs.STRING_UTF8, TrinketsSlotReference::slotName,
ByteBufCodecs.INT, TrinketsSlotReference::index,
TrinketsSlotReference::new
);

private TrinketsSlotReferenceFactory() {
}

@Override
public SlotReference create(final FriendlyByteBuf buf) {
return new TrinketsSlotReference(buf.readUtf(), buf.readUtf(), buf.readInt());
@SuppressWarnings({"rawtypes", "unchecked"})
public StreamCodec<RegistryFriendlyByteBuf, SlotReference> getStreamCodec() {
return (StreamCodec) STREAM_CODEC;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.refinedmods.refinedstorage.trinkets;

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

import java.util.Collections;
import java.util.List;
import java.util.Set;

import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference;
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceProvider;
import dev.emi.trinkets.api.TrinketsApi;
import net.minecraft.util.Tuple;
import net.minecraft.world.entity.player.Player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@FieldsAndMethodsAreNonnullByDefault
package com.refinedmods.refinedstorage.trinkets;

import javax.annotation.ParametersAreNonnullByDefault;
import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault;

import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"trinkets.slot.refinedstorage_trinkets_integration.wireless": "Refined Storage"
"trinkets.slot.refinedstorage_trinkets_integration.refinedstorage": "Refined Storage"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"player"
],
"slots": [
"refinedstorage_trinkets_integration/wireless"
"refinedstorage_trinkets_integration/refinedstorage"
]
}
Loading

0 comments on commit 016697e

Please sign in to comment.