Skip to content

Commit

Permalink
Port
Browse files Browse the repository at this point in the history
  • Loading branch information
anviaan committed Dec 24, 2024
1 parent fbd9fd0 commit 379e797
Show file tree
Hide file tree
Showing 14 changed files with 179 additions and 48 deletions.
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Bug Report
description: File a bug report
labels: ["bug"]
assignees: [PssbleTrngle]

body:
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true

- type: input
id: version-version
attributes:
label: Mod Version
validations:
required: true

- type: dropdown
id: minecraft-version
attributes:
label: Minecraft Version
multiple: false
options:
- "1.19.2"
- "1.19.3"
- "1.19.4"
- "1.20"
- "1.20.1"
- "1.20.2"
- "1.20.3"
- "1.20.4"
- "1.20.5"
- "1.20.6"
- "1.21"
- "1.21.1"
- "1.21.2"
- "1.21.3"
- "1.21.4"
validations:
required: true

- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: Shell
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Feature Request
description: Suggest a feature
labels: ["enhancement", "feature", "feature-request"]
assignees: [PssbleTrngle]

body:
- type: textarea
id: idea
attributes:
label: Describe the feature you have in mind.
placeholder: So I was think about...
validations:
required: true

- type: textarea
id: problem-solving
attributes:
label: Does this solve a particular problem?
placeholder: Yes, it balances...
validations:
required: false
66 changes: 66 additions & 0 deletions .github/workflows/fabric_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: FabricPublish

on: [ workflow_dispatch ]

env:
JAVA_VERSION: 21
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_ID: CJC1Uvdj
CURSEFORGE_ID: 896213

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Check Environment Variables
run: env

- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21'

- name: Make Gradle Wrapper Executable
run: chmod +x gradlew

- name: Set Environment Variables from Gradle
run: ./gradlew printEnv

- name: Build
run: ./gradlew build

- name: Publish (Modrinth & CurseForge)
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ env.MODRINTH_ID }}
modrinth-token: ${{ env.MODRINTH_TOKEN }}

curseforge-id: ${{ env.CURSEFORGE_ID }}
curseforge-token: ${{ env.CURSEFORGE_TOKEN }}

files: |
build/libs/!(*-@(dev|sources|javadoc)).jar
name: ${{ env.RELEASE_NAME }}
version: ${{ env.MOD_VERSION }}
version-type: 'release'
changelog-file: CHANGELOG.md

game-versions: ${{ env.GAME_VERSIONS }}

loaders: |
fabric
quilt
dependencies: |
fabric-api
java: ${{ env.JAVA_VERSION }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Ported to 1.21.2 and upward
26 changes: 12 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id 'fabric-loom' version '1.8-SNAPSHOT'
}

def COMPATIBLE_VERSIONS = ['1.21.2', '1.22']

tasks.register("printEnv") {
doLast {
def envFile = new File(System.getenv("GITHUB_ENV"))
envFile.append("MOD_VERSION=${project.mod_version}\n")
envFile.append("RELEASE_NAME=${project.archives_base_name}-${project.mod_version}\n")
envFile.append("GAME_VERSIONS=${COMPATIBLE_VERSIONS}\n")
}
}

version = project.mod_version
Expand Down Expand Up @@ -57,16 +67,4 @@ jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}

publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

repositories {
}
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.16.7
minecraft_version=1.21.2
yarn_mappings=1.21.2+build.1
loader_version=0.16.9

# Mod Properties
mod_version=2.2
maven_group=net.anvian.record_days_survived
archives_base_name=RecordDaySurvived

# Dependencies
fabric_version=0.102.0+1.21
fabric_version=0.106.1+1.21.2

# Cardinal Components
cca_version=6.1.0
cca_version=6.2.0

# Mod Menu
modmenu_version=11.0.3
modmenu_version=12.0.0-beta.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
16 changes: 8 additions & 8 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

public class RecordDaysSurvivedMod implements ModInitializer {
public static final String MOD_ID = "record_days_survived";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
Expand All @@ -27,16 +23,9 @@ public class RecordDaysSurvivedMod implements ModInitializer {

@Override
public void onInitialize() {
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> RecordCommand.register(dispatcher));

ServerEntityEvents.ENTITY_LOAD.register((entity, world) -> {
if (entity instanceof PlayerEntity) {
ServerCommandSource source = entity.getCommandSource().withEntity(entity);

Objects.requireNonNull(entity.getServer()).getCommandManager().executeWithPrefix(source, "record_day report");
LOGGER.info("Record Days Survived mod initialized!");

}
});
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> RecordCommand.register(dispatcher));

ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> {
int recordDay = newPlayer.getComponent(ModComponents.RECORD_DAY).getRecordDay();
Expand Down Expand Up @@ -69,7 +58,5 @@ public void onInitialize() {
DaysUtil.dayPassed(entity);
}
});

LOGGER.info("Record Days Survived mod initialized!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.anvian.record_days_survived.components.ModComponents;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

Expand All @@ -20,7 +21,7 @@ var record = entity.getComponent(ModComponents.RECORD_DAY);
recordDay = record.getRecordDay();

if (days == 5 || days % 10 == 0) {
entity.sendMessage(Text.translatable("record_notice").append(" ").append(String.valueOf(days)).formatted(Formatting.YELLOW));
((PlayerEntity) entity).sendMessage(Text.translatable("record_notice").append(" ").append(String.valueOf(days)).formatted(Formatting.YELLOW), false);
}

if (days > recordDay) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"record_days_survived.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.11",
"minecraft": ">=1.21",
"fabricloader": ">=0.16.9",
"minecraft": ">=1.21.2",
"java": ">=21",
"fabric-api": "*"
},
Expand Down

0 comments on commit 379e797

Please sign in to comment.