Skip to content

Commit

Permalink
Merge pull request #1 from AppliedEnergistics/main
Browse files Browse the repository at this point in the history
Rebase
  • Loading branch information
Ridanisaurus authored Jun 30, 2024
2 parents 178db52 + 87edf52 commit 9bb04f9
Show file tree
Hide file tree
Showing 46 changed files with 1,542 additions and 266 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:
shell: bash
- uses: ./.github/actions/gradle-setup
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew printProjectVersion build -x check --max-workers 1
run: ./gradlew printProjectVersion build publish -x check --max-workers 1
- name: Prepare artifact metadata. Note that VERSION is set by the gradle script.
id: prepare_artifact_metadata
run: |
Expand All @@ -38,7 +36,7 @@ jobs:
echo VERSION=${VERSION} >> $GITHUB_OUTPUT
- name: Archive build results
# It is important to archive .gradle as well since gradle stores the incremental build state there
run: tar -I zstd -cf build.tar.zst .gradle build src/generated
run: tar -I zstd -cf build.tar.zst build/libs build/repo
- name: Upload build and gradle folders
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -90,23 +88,24 @@ jobs:
name: Deploy to Github Packages
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- run: git fetch origin --tags
shell: bash
- uses: ./.github/actions/gradle-setup
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Unpack build artifact
run: tar axf build.tar.zst
- name: Validate artifacts exist
run: test -d ./build && test -d ./.gradle
run: test -d ./build
- name: Publish to Github Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publishMavenPublicationToGitHubPackagesRepository --no-daemon --max-workers 1
uses: AppliedEnergistics/maven-publish-action@main
with:
local-repository-path: build/repo
remote-repository-url: https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2/
remote-repository-username: ${{ github.actor }}
remote-repository-password: ${{ github.token }}

deploy-curseforge:
name: Deploy to Curseforge
Expand Down Expand Up @@ -143,23 +142,21 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch origin --tags
shell: bash
- uses: ./.github/actions/gradle-setup
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Unpack build artifact
run: tar axf build.tar.zst
- name: Validate artifacts exist
run: test -d ./build && test -d ./.gradle
run: test -d ./build
- name: Publish to Modmaven
env:
MODMAVEN_USER: ${{ secrets.MODMAVEN_USER }}
MODMAVEN_PASSWORD: ${{ secrets.MODMAVEN_PASSWORD }}
run: ./gradlew publishMavenPublicationToModmavenRepository --no-daemon --max-workers 1
uses: AppliedEnergistics/maven-publish-action@main
with:
local-repository-path: build/repo
remote-repository-url: https://modmaven.dev/artifactory/local-releases/
remote-repository-username: ${{ secrets.MODMAVEN_USER }}
remote-repository-password: ${{ secrets.MODMAVEN_PASSWORD }}

deploy-modrinth:
name: Deploy to Modrinth
Expand Down
30 changes: 14 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ configurations {
}

import appengbuild.*
import com.diffplug.gradle.spotless.JsonExtension

dependencies {
// To be copied into the jar file
Expand Down Expand Up @@ -373,20 +374,8 @@ publishing {
}
repositories {
maven {
credentials {
username System.getenv("GITHUB_ACTOR")
password System.getenv("GITHUB_TOKEN")
}
name = "GitHubPackages"
url = "https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2"
}
maven {
credentials {
username System.getenv("MODMAVEN_USER")
password System.getenv("MODMAVEN_PASSWORD")
}
name = "modmaven"
url = "https://modmaven.dev/artifactory/local-releases/"
name = "Local"
url = file("build/repo").toURI()
}
}
}
Expand All @@ -411,14 +400,23 @@ spotless {
if (it.contains('*;\n')) {
throw new Error('No wildcard imports allowed')
}

it
}
bumpThisNumberIfACustomStepChanges(1)
}

format 'json', {
json {
target 'src/*/resources/**/*.json'
targetExclude 'src/generated/resources/**'
prettier().config(['parser': 'json'])
var biomeConfig = it.new JsonExtension.BiomeJson(null)
try {
biomeConfig.downloadDir(new File(rootDir, ".gradle/biome").absolutePath)
} catch (Exception ignored) {
}
addStep(biomeConfig.createStep())
indentWithSpaces(2)
endWithNewline()
}
}

Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.parallel=true
org.gradle.configuration-cache=true
org.gradle.warning.mode=fail
org.gradle.warning.mode=all

java_version=21

Expand All @@ -10,14 +10,15 @@ java_version=21
minecraft_release=1.21
minecraft_version=1.21
minecraft_version_range=1.21
neoforge_version=21.0.13-beta
# https://projects.neoforged.net/neoforged/neoforge
neoforge_version=21.0.38-beta
neoforge_version_range=[21.0.0-beta,)

#########################################################
# Parchment #
#########################################################
neoForge.parchment.minecraftVersion=1.20.6
neoForge.parchment.mappingsVersion=2024.05.01
neoForge.parchment.minecraftVersion=1.21
neoForge.parchment.mappingsVersion=2024.06.23

#########################################################
# Provided APIs #
Expand Down
6 changes: 3 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ pluginManagement {
id 'com.diffplug.spotless' version '6.25.0'
id 'io.github.goooler.shadow' version '8.1.7'
id 'de.undercouch.download' version '5.6.0'
id 'net.neoforged.moddev' version '0.1.99'
id 'net.neoforged.moddev.repositories' version '0.1.99'
// https://projects.neoforged.net/neoforged/ModDevGradle
id 'net.neoforged.moddev' version '0.1.112'
id 'net.neoforged.moddev.repositories' version '0.1.112'
}
}

Expand All @@ -20,7 +21,6 @@ dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
rulesMode = RulesMode.FAIL_ON_PROJECT_RULES
repositories {
mavenLocal()
maven {
url "https://maven.shedaniel.me/"
content {
Expand Down
1 change: 1 addition & 0 deletions src/buildtools/java/Crowdin.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class Crowdin {
LANG_MAPPING.put("ro_ro", "ro");
LANG_MAPPING.put("ru_ru", "ru");
LANG_MAPPING.put("de_de", "de");
LANG_MAPPING.put("tr_tr", "tr");
LANG_MAPPING.put("uk_ua", "uk");
LANG_MAPPING.put("zh_cn", "zh-CN");
LANG_MAPPING.put("zh_tw", "zh-TW");
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/appeng/api/ids/AEComponents.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private AEComponents() {
* @see appeng.items.tools.MemoryCardItem
*/
public static final DataComponentType<List<GenericStack>> EXPORTED_CONFIG_INV = register("exported_config_inv",
builder -> builder.persistent(GenericStack.NULLABLE_LIST_CODEC)
builder -> builder.persistent(GenericStack.FAULT_TOLERANT_NULLABLE_LIST_CODEC)
.networkSynchronized(GenericStack.STREAM_CODEC.apply(ByteBufCodecs.list())));

/**
Expand Down Expand Up @@ -301,15 +301,15 @@ private AEComponents() {
* Content of a storage cell.
*/
public static final DataComponentType<List<GenericStack>> STORAGE_CELL_INV = register("storage_cell_inv",
builder -> builder.persistent(GenericStack.CODEC.listOf())
builder -> builder.persistent(GenericStack.FAULT_TOLERANT_LIST_CODEC)
.networkSynchronized(GenericStack.STREAM_CODEC.apply(ByteBufCodecs.list())));

/**
* Defines partitioning for a storage cell.
*/
public static final DataComponentType<List<GenericStack>> STORAGE_CELL_CONFIG_INV = register(
"storage_cell_config_inv",
builder -> builder.persistent(GenericStack.NULLABLE_LIST_CODEC)
builder -> builder.persistent(GenericStack.FAULT_TOLERANT_NULLABLE_LIST_CODEC)
.networkSynchronized(GenericStack.STREAM_CODEC.apply(ByteBufCodecs.list())));

/**
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/appeng/api/stacks/AEFluidKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ public int hashCode() {
}

public static AEFluidKey fromTag(HolderLookup.Provider registries, CompoundTag tag) {
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
try {
return CODEC.decode(registries.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow().getFirst();
return CODEC.decode(ops, tag).getOrThrow().getFirst();
} catch (Exception e) {
AELog.debug("Tried to load an invalid fluid key from NBT: %s", tag, e);
return null;
Expand All @@ -121,8 +122,8 @@ public static AEFluidKey fromTag(HolderLookup.Provider registries, CompoundTag t

@Override
public CompoundTag toTag(HolderLookup.Provider registries) {
return (CompoundTag) CODEC.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this)
.getOrThrow();
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
return (CompoundTag) CODEC.encodeStart(ops, this).getOrThrow();
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/appeng/api/stacks/AEItemKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ public Item getItem() {

@Nullable
public static AEItemKey fromTag(HolderLookup.Provider registries, CompoundTag tag) {
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
try {
return CODEC.decode(registries.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow().getFirst();
return CODEC.decode(ops, tag).getOrThrow().getFirst();
} catch (Exception e) {
AELog.debug("Tried to load an invalid item key from NBT: %s", tag, e);
return null;
Expand All @@ -160,7 +161,8 @@ public static AEItemKey fromTag(HolderLookup.Provider registries, CompoundTag ta

@Override
public CompoundTag toTag(HolderLookup.Provider registries) {
return (CompoundTag) CODEC.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this)
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
return (CompoundTag) CODEC.encodeStart(ops, this)
.getOrThrow();
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/appeng/api/stacks/AEKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ public static AEKey readKey(RegistryFriendlyByteBuf buffer) {

@Nullable
public static AEKey fromTagGeneric(HolderLookup.Provider registries, CompoundTag tag) {
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
try {
return CODEC.decode(registries.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow()
.getFirst();
return CODEC.decode(ops, tag).getOrThrow().getFirst();
} catch (Exception e) {
LOG.warn("Cannot deserialize generic key from {}: {}", tag, e);
return null;
Expand All @@ -161,7 +161,8 @@ public static AEKey fromTagGeneric(HolderLookup.Provider registries, CompoundTag
* knowing the actual type beforehand.
*/
public final CompoundTag toTagGeneric(HolderLookup.Provider registries) {
return (CompoundTag) CODEC.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this)
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
return (CompoundTag) CODEC.encodeStart(ops, this)
.getOrThrow();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/appeng/api/stacks/AEKeyType.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ public int getAmountPerByte() {
*/
@Nullable
public AEKey loadKeyFromTag(HolderLookup.Provider registries, CompoundTag tag) {
var ops = registries.createSerializationContext(NbtOps.INSTANCE);
try {
return codec().codec().decode(registries.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow()
.getFirst();
return codec().codec().decode(ops, tag).getOrThrow().getFirst();
} catch (Exception e) {
AELog.debug("Tried to load an invalid item key from NBT: %s", tag, e);
return null;
Expand Down
Loading

0 comments on commit 9bb04f9

Please sign in to comment.