Skip to content

Commit

Permalink
3.4 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyyTV committed Jul 17, 2023
1 parent 7fd6b92 commit b401833
Show file tree
Hide file tree
Showing 192 changed files with 939 additions and 3,720 deletions.
109 changes: 50 additions & 59 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
plugins {
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
apply plugin: 'net.minecraftforge.gradle'

import net.minecraftforge.gradle.common.tasks.SignJar

version = "${mc_version}-${mod_version}"
group = 'jackyy.exchangers'
archivesBaseName = "${mod_name}"
group = "jackyy.${mod_id}"
base {
archivesName = jar_name
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: "${mappings_channel}", version: "${mappings_version}"
mappings channel: mappings_channel, version: mappings_version
copyIdeResources = true
runs {
client {
configureEach {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
property 'forge.enabledGameTestNamespaces', mod_id
if (project.hasProperty('mcUUID')) {
args '--uuid', project.getProperty('mcUUID')
}
Expand All @@ -37,45 +40,17 @@ minecraft {
if (project.hasProperty('mcAccessToken')) {
args '--accessToken', project.getProperty('mcAccessToken')
}
property 'forge.enabledGameTestNamespaces', 'exchangers'
mods {
exchangers {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', 'exchangers'
mods {
exchangers {
source sourceSets.main
}
}
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}
gameTestServer {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', 'exchangers'
mods {
exchangers {
source sourceSets.main
}
}
property 'forge.enabledGameTestNamespaces', mod_id
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
args '--mod', 'exchangers', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
exchangers {
source sourceSets.main
}
}
workingDirectory project.file('run-data')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
Expand Down Expand Up @@ -120,15 +95,31 @@ dependencies {
//runtimeOnly fg.deobf("curse.maven:thermal_expansion-69163:")
}

tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
mc_version: mc_version, mc_version_range: mc_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, jar_name: jar_name,
mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}

jar {
manifest {
attributes([
"Specification-Title": "${mod_name}",
"Specification-Version": "${project.mc_version}-${project.mod_version}",
"Specification-Vendor": "Jackyy",
"Implementation-Title": "${mod_name}",
"Implementation-Version": "${project.mc_version}-${project.mod_version}",
"Implementation-Vendor" :"Jackyy",
"Specification-Title": jar_name,
"Specification-Version": "${mc_version}-${mod_version}",
"Specification-Vendor": mod_authors,
"Implementation-Title": jar_name,
"Implementation-Version": "${mc_version}-${mod_version}",
"Implementation-Vendor": mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
Expand All @@ -138,27 +129,27 @@ tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

jar.finalizedBy('reobfJar')

task signJar(type: SignJar, dependsOn: jar) {
keyStore = project.findProperty('keyStore')
alias = project.findProperty('keyStoreAlias')
storePass = project.findProperty('keyStorePass')
keyPass = project.findProperty('keyStoreKeyPass')
inputFile = jar.archivePath
outputFile = jar.archivePath
inputFile = jar.archiveFile
outputFile = jar.archiveFile
}

build.dependsOn signJar

jar.finalizedBy('reobfJar')

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
archiveClassifier.set("sources")
}

task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
archiveClassifier.set("deobf")
}

artifacts {
Expand Down
17 changes: 15 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
org.gradle.jvmargs=-Xmx4G

mod_id=exchangers
jar_name=Exchangers
mod_name=Exchangers

mc_version=1.19.4
forge_version=45.0.64
mod_version=3.3.2
mc_version_range=[1.19.4,1.20)

forge_version=45.1.14
forge_version_range=[45,)
loader_version_range=[45,)

mappings_channel=official
mappings_version=1.19.4

mod_version=3.4
mod_license=Jacky's Minecraft Mods License
mod_authors=Jackyy, TurkeyDev
mod_description=Block Exchangers.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/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 All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
13 changes: 13 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
6 changes: 0 additions & 6 deletions src/main/java/jackyy/exchangers/Exchangers.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ public Exchangers() {
}

private void commonSetup(final FMLCommonSetupEvent event) {
/*
TODO add Better With Mods integration back when possible
if (ModList.get().isLoaded(Reference.BWM)) {
MinecraftForge.EVENT_BUS.register(new BetterWithModsIntegration());
}
*/
MinecraftForge.EVENT_BUS.register(new CommonEventsHandler());
NetworkHandler.registerMessages();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void renderLevelStageEvent(RenderLevelStageEvent event) {
BlockPos pos = mouseOverBlock.getBlockPos();
BlockState state = world.getBlockState(pos);
ItemStack stack = player.getMainHandItem();
if (!stack.isEmpty() && stack.getItem() instanceof ItemExchangerBase && stack.getTag() != null && !state.isAir()) {
if (!stack.isEmpty() && stack.getItem() instanceof ItemExchangerBase && stack.getTag() != null && !state.isAir() && !(state.getBlock() instanceof LiquidBlock)) {
BlockState exState = NbtUtils.readBlockState(world.holderLookup(Registries.BLOCK), NBTHelper.getTag(stack).getCompound("blockstate"));
float blockHardness = state.getDestroySpeed(world, pos);
if (exState == state) {
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit b401833

Please sign in to comment.