Skip to content

Commit

Permalink
Ported to 1.21.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal-Spider committed Dec 15, 2024
1 parent e735195 commit 30e7fe2
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 54 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Crystal Nest Semantic Versioning](https://crystalne

- Nothing new.

## [v7.0.0] - 2024/12/15

- Ported to 1.21.3.

## [v7.0.0] - 2024/09/11

- Ported to 1.21.1.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Torch hit! banner](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/torch-hit/banner.gif)

---
![Minecraft](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.21.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21-1.svg "1.21.1")](https://modrinth.com/mod/torch-hit/versions?g=1.21.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.21](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21.svg "1.21")](https://modrinth.com/mod/torch-hit/versions?g=1.21)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.2](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-1.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.18.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-18-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.18.2)
![Minecraft](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.21.3](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21-3.svg "1.21.3")](https://modrinth.com/mod/torch-hit/versions?g=1.21.3)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.21.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21-1.svg "1.21.1")](https://modrinth.com/mod/torch-hit/versions?g=1.21.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.21](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21.svg "1.21")](https://modrinth.com/mod/torch-hit/versions?g=1.21)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.2](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-1.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.18.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-18-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.18.2)

![Loader](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/loader.svg)[![NeoForge](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/neoforge.svg)](https://modrinth.com/mod/torch-hit/versions?l=neoforge)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![Forge](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/forge.svg)](https://modrinth.com/mod/torch-hit/versions?l=forge)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![Fabric](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/fabric.svg)](https://modrinth.com/mod/torch-hit/versions?l=fabric)

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "org.sonarqube" version "4.4.1.3373"
id "com.hypherionmc.modutils.modpublisher" version "2.1.4" apply false
id "net.neoforged.moddev" version "0.1.110" apply false
id "fabric-loom" version "1.7-SNAPSHOT" apply false
id "net.neoforged.moddev" version "2.0.49-beta" apply false
id "fabric-loom" version "1.8-SNAPSHOT" apply false
}

sonar {
Expand Down
18 changes: 8 additions & 10 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

base {
archivesName = "$mod_id_kebab-$name"
version = "$minecraft_compat_version-$mod_version"
version = "$minecraft_version-$mod_version"
}

java {
Expand Down Expand Up @@ -64,7 +64,7 @@ if (name != "fabric") {
["apiElements", "runtimeElements", "sourcesElements", "javadocElements"].each { variant ->
configurations."$variant".outgoing {
capability("$group:${base.archivesName.get()}:$version")
capability("$group:$mod_id-${project.name}-$minecraft_compat_version:$version")
capability("$group:$mod_id-${project.name}-$minecraft_version:$version")
capability("$group:$mod_id:$version")
}
publishing.publications.configureEach {
Expand All @@ -90,7 +90,7 @@ jar {
"Implementation-Title" : mod_title,
"Implementation-Vendor" : mod_authors,
"Implementation-Version" : project.version,
"Implementation-URL" : "https://github.com/$github_user/$mod_id_kebab/tree/$minecraft_compat_version",
"Implementation-URL" : "https://github.com/$github_user/$mod_id_kebab/tree/$minecraft_version",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Timestamp" : System.currentTimeMillis(),
"Built-On-Java" : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
Expand All @@ -114,8 +114,6 @@ processResources {
"github_user" : github_user,
"curseforge_id" : curseforge_id,
"minecraft_version" : minecraft_version,
"minecraft_version_range" : minecraft_version_range,
minecraft_compat_version : minecraft_compat_version,
"fabric_version" : fabric_version,
"fabric_loader_version" : fabric_loader_version,
"neoforge_version" : neoforge_version,
Expand Down Expand Up @@ -161,9 +159,9 @@ publishing {
version = project.version
from components.java
pom {
name = "[$loader - $minecraft_compat_version] $mod_title v$mod_version"
name = "[$loader - $minecraft_version] $mod_title v$mod_version"
description = "$description"
url = "https://github.com/$github_user/$mod_id_kebab/tree/$minecraft_compat_version"
url = "https://github.com/$github_user/$mod_id_kebab/tree/$minecraft_version"
issueManagement {
system = "github"
url = "https://github.com/$github_user/$mod_id_kebab/issues"
Expand Down Expand Up @@ -205,15 +203,15 @@ publisher {
if (!noPublish) {
setLoaders(loader)
}
setGameVersions([minecraft_version, minecraft_compat_version])
setDisplayName("[$loader - $minecraft_compat_version] $mod_title v$mod_version")
setGameVersions(minecraft_version)
setDisplayName("[$loader - $minecraft_version] $mod_title v$mod_version")
setJavaVersions([JavaVersion.VERSION_21]) // Remember to update this to match java_version gradle property.
setCurseEnvironment("server") // "server", "client" or "both".
github {
repo = "$github_user/$mod_id_kebab"
tag = "v${project.version}"
displayName("v${project.version}")
target = minecraft_compat_version
target = minecraft_version
createTag = true
createRelease = true
updateRelease = true
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ neoForge {
neoFormVersion = neo_form_version
def at = file("src/main/resources/META-INF/accesstransformer.cfg")
if (at.exists()) {
accessTransformers.add(at.absolutePath)
accessTransformers.from(at.absolutePath)
}
parchment {
minecraftVersion = minecraft_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import it.crystalnest.torch_hit.compat.SoulFired;
import it.crystalnest.torch_hit.config.ModConfig;
import it.crystalnest.torch_hit.platform.Services;
import net.minecraft.core.component.DataComponents;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
Expand All @@ -15,8 +16,6 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.TieredItem;
import net.minecraft.world.item.Tiers;
import org.jetbrains.annotations.Nullable;

/**
Expand Down Expand Up @@ -65,12 +64,20 @@ private static void attack(LivingEntity attacker, Entity target, ItemStack item,
* @param directHit whether the hit is direct ({@code true}) or indirect ({@code false}).
* @param seconds fire duration.
*/
@SuppressWarnings("DataFlowIssue")
private static void consumeItem(LivingEntity attacker, ItemStack item, boolean directHit, int seconds) {
if (!(attacker instanceof Player player && player.isCreative())) {
if (((isCandle(item) && ModConfig.getConsumeCandle()) || (isTorch(item) && ModConfig.getConsumeTorch())) && (directHit || ModConfig.getConsumeWithIndirectHits()) && (ModConfig.getConsumeWithoutFire() || seconds > 0)) {
item.shrink(1);
} else if (attacker.getMainHandItem().getItem() instanceof TieredItem tieredItem && tieredItem.getTier() == Tiers.WOOD && ModConfig.getIndirectHitToolDamage() > 0) {
attacker.getMainHandItem().hurtAndBreak((tieredItem.getTier().getUses() * ModConfig.getIndirectHitToolDamage() + 99) / 100, attacker, EquipmentSlot.MAINHAND);
} else if (
ModConfig.getIndirectHitToolDamage() > 0 &&
attacker.getMainHandItem().has(DataComponents.TOOL) &&
attacker.getMainHandItem().has(DataComponents.REPAIRABLE) &&
attacker.getMainHandItem().has(DataComponents.MAX_DAMAGE) &&
attacker.getMainHandItem().get(DataComponents.REPAIRABLE).items().unwrapKey().isPresent() &&
attacker.getMainHandItem().get(DataComponents.REPAIRABLE).items().unwrapKey().get().toString().equals(ItemTags.WOODEN_TOOL_MATERIALS.toString())
) {
attacker.getMainHandItem().hurtAndBreak((attacker.getMainHandItem().get(DataComponents.MAX_DAMAGE) * ModConfig.getIndirectHitToolDamage() + 99) / 100, attacker, EquipmentSlot.MAINHAND);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"contact": {
"homepage": "https://modrinth.com/mod/${mod_id_kebab}",
"issues": "https://github.com/${github_user}/${mod_id_kebab}/issues",
"sources": "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_compat_version}"
"sources": "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_version}"
},
"license": "${license}",
"icon": "${mod_id_kebab}.png",
Expand Down
23 changes: 11 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@ description = Attack with torches!
credits =
github_user = crystal-nest
curseforge_id = 629434
minecraft_version = 1.21
minecraft_version_range = [1.21,)
minecraft_compat_version = 1.21.1
minecraft_version = 1.21.3
# https://parchmentmc.org/docs/getting-started#choose-a-version
parchment_version = 2024.06.23
parchment_minecraft = 1.21.3
parchment_version = 2024.12.07
# https://projects.neoforged.net/neoforged/neoform
neo_form_version = 1.21-20240613.152323
neo_form_version = 1.21.3-20241023.131943

# Fabric
fabric_version = 0.100.6+1.21
fabric_loader_version = 0.15.11
fabric_version = 0.110.0+1.21.3
fabric_loader_version = 0.16.9

# NeoForge
neoforge_version = 21.0.59-beta
neoforge_loader_version_range = [21.0,)
neoforge_version = 21.3.50-beta
neoforge_loader_version_range = [21.3,)

# Dependencies
cobweb_version = 1.0.0
fcap_version = 21.0.1
soul_fire_d_version = 5.0.0
cobweb_version = 1.3.0
fcap_version = 21.3.3
soul_fire_d_version = 5.1.0

# Gradle
org.gradle.jvmargs = -Xmx4G
Expand Down
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-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 10 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -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 All @@ -32,10 +34,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions $var, ${var}, ${var:-default}, ${var+SET},
# ${var#prefix}, ${var%suffix}, and $( cmd );
# * compound commands having a testable exit status, especially case;
# * various built-in commands including command, set, and ulimit.
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand All @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
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
22 changes: 12 additions & 10 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 Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ neoForge {
version = neoforge_version
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.add(at.absolutePath)
accessTransformers.from(at.absolutePath)
}
parchment {
minecraftVersion = minecraft_version
Expand Down
8 changes: 4 additions & 4 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ issueTrackerURL="https://github.com/${github_user}/${mod_id_kebab}/issues" #opti
version = "${mod_version}" #mandatory
displayName = "${mod_title}" #mandatory
updateJSONURL = "https://api.modrinth.com/updates/${mod_id_kebab}/forge_updates.json" #optional (see https://docs.neoforged.net/docs/misc/updatechecker/)
displayURL = "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_compat_version}" #optional (displayed in the mod UI)
displayURL = "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_version}" #optional (displayed in the mod UI)
logoFile = "banner.png" #optional
credits = "${credits}" #optional
authors = "${mod_authors}" #optional
Expand All @@ -25,20 +25,20 @@ issueTrackerURL="https://github.com/${github_user}/${mod_id_kebab}/issues" #opti
[[dependencies.${mod_id}]]
modId = "minecraft"
type = "required"
versionRange = "${minecraft_version_range}"
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"
[[dependencies.${mod_id}]]
modId = "cobweb"
type = "required"
versionRange = "[${cobweb_version},)"
ordering = "NONE"
ordering = "AFTER"
side = "BOTH"
[[dependencies.${mod_id}]]
modId = "soul_fire_d"
type = "optional"
versionRange = "[${soul_fire_d_version},)"
ordering = "BEFORE"
ordering = "AFTER"
side = "BOTH"

# Features are specific properties of the game environment, that you may want to declare you require. This example declares
Expand Down

0 comments on commit 30e7fe2

Please sign in to comment.