Skip to content

Commit

Permalink
Merge pull request #9 from nanite/feature/new-commands
Browse files Browse the repository at this point in the history
Feature/new commands
  • Loading branch information
Sunekaer authored Jan 14, 2024
2 parents 46b0220 + c7b2216 commit ded3b5e
Show file tree
Hide file tree
Showing 41 changed files with 1,232 additions and 489 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ name: Build & Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
build:
if: |
!contains(github.event.head_commit.message, '[ciskip]')
uses: nanite/workflows/.github/workflows/standard-arch-release.yml@v1
uses: nanite/workflows/.github/workflows/standard-modmuss.yml@v1.1
with:
java-version: 17
changelog-file: "./CHANGELOG.md"
release-to-github: false
secrets:
nanite-token: ${{ secrets.NANITE_DEPLOY }}
curse-token: ${{ secrets.CURSE_DEPLOY }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## 2.3.9
## 77.0.0

### Fixed

- An issue causing the kill commands to not always kill all the entities and throw an error message instead.
- Mod has been rewritten and new commands had been added
79 changes: 72 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
}

architectury {
Expand All @@ -9,17 +10,29 @@ architectury {

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "maven-publish"

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.19.2+build.28:v2"
}

publishing {
repositories {
if (providers.environmentVariable("NANITE_TOKEN").isPresent()) {
maven {
url "https://maven.nanite.dev/releases"
credentials {
username = "nanite"
password = providers.environmentVariable("NANITE_TOKEN").get()
}
}
}
}
}
}

Expand All @@ -28,10 +41,9 @@ allprojects {
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"

ext.ENV = System.getenv()

archivesBaseName = rootProject.archives_base_name
version = "${rootProject.mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${rootProject.minecraft_version}"
version = rootProject.mod_version
group = rootProject.maven_group

repositories {
Expand All @@ -48,4 +60,57 @@ allprojects {
}
}

task curseforgePublish
publishMods {
dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null
changelog = file("./CHANGELOG.md").text
version = "${mod_version}"
type = STABLE

def fabricOptions = publishOptions {
file = project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[FABRIC][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("fabric")
}

def forgeOptions = publishOptions {
file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[FORGE][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("forge")
}

def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSE_TOKEN")
projectId = "${curseforge_id}"
minecraftVersions.add("${minecraft_version}")
}

def modrinthOptions = modrinthOptions {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "${modrinth_id}"
minecraftVersions.add("${minecraft_version}")
}

curseforge("curseforgeFabric") {
from(curseForgeOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

curseforge("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
}

if (providers.environmentVariable("MODRINTH_TOKEN").getOrNull() != null) {
modrinth("modrinthFabric") {
from(modrinthOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

modrinth("modrinthForge") {
from(modrinthOptions, forgeOptions)
}
}
}
14 changes: 1 addition & 13 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,8 @@ dependencies {
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
artifactId = "${rootProject.archivesBaseName}-${project.name}"
from components.java
}
}

repositories {
if (ENV.NANITE_TOKEN) {
maven {
url "https://maven.nanite.dev/releases"
credentials {
username = "nanite"
password = "${ENV.NANITE_TOKEN}"
}
}
}
}
}
11 changes: 5 additions & 6 deletions common/src/main/java/com/sunekaer/toolkit/Toolkit.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.sunekaer.toolkit;

import com.mojang.brigadier.arguments.ArgumentType;
import com.sunekaer.toolkit.commands.CommandClear;
import com.sunekaer.toolkit.commands.level.ClearCommand;
import com.sunekaer.toolkit.commands.TKCommand;
import com.sunekaer.toolkit.event.PlayerEvents;
import com.sunekaer.toolkit.jobs.ServerTickJobRunner;
import com.sunekaer.toolkit.network.Handler;
import dev.architectury.event.events.common.CommandRegistrationEvent;
import dev.architectury.event.events.common.LifecycleEvent;
import dev.architectury.event.events.common.PlayerEvent;
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
import dev.architectury.event.events.common.TickEvent;
import net.minecraft.server.MinecraftServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -33,7 +32,7 @@ public static void init() {
Handler.init();
LifecycleEvent.SERVER_STOPPING.register(Toolkit::onServerStopping);
LifecycleEvent.SETUP.register(Toolkit::setup);

TickEvent.SERVER_POST.register((server) -> ServerTickJobRunner.get().onTick(server));
}

// Poor mans basic config system :cry:
Expand Down Expand Up @@ -82,7 +81,7 @@ private static void setup() {
}

private static void onServerStopping(MinecraftServer minecraftServer) {
CommandClear.EXECUTOR.shutdownNow();
ClearCommand.EXECUTOR.shutdownNow();
}

public static class DefaultedValue<T> implements Supplier<T> {
Expand Down
12 changes: 12 additions & 0 deletions common/src/main/java/com/sunekaer/toolkit/ToolkitPlatform.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package com.sunekaer.toolkit;

import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.jetbrains.annotations.Nullable;

import java.nio.file.Path;
import java.util.List;

public class ToolkitPlatform {
@ExpectPlatform
Expand All @@ -21,4 +28,9 @@ public static TagKey<Block> getOresTag() {
public static Path getGamePath() {
throw new AssertionError();
}

@ExpectPlatform
public static List<ItemStack> getInventoryFromBlockEntity(Level level, BlockPos pos, @Nullable Direction direction) {
throw new AssertionError();
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit ded3b5e

Please sign in to comment.