Skip to content

Commit

Permalink
20w14infinite port.
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiancc committed Oct 7, 2023
1 parent 5bedbcc commit c34065d
Show file tree
Hide file tree
Showing 41 changed files with 757 additions and 1,884 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ classes
*.bat
builds
sources
logs

# Created by https://www.gitignore.io/api/gradle,intellij,eclipse,windows,osx,linux

Expand Down Expand Up @@ -178,3 +177,4 @@ Temporary Items

# Linux trash folder which might appear on any partition or disk
.Trash-*

77 changes: 5 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@

Minecraft mod that adds various food-related HUD improvements formerly provided by [AppleCore](https://github.com/squeek502/AppleCore) (basically, AppleCore without the core).

This fork adds compatibility to Minecraft 20w14infinite.

### Features

* Adds food value information to tooltips:

![](https://i.imgur.com/YksBaUx.png)
![](https://i.imgur.com/furoAAi.png)

* Adds a visualization of saturation and exhaustion to the HUD:

![](https://i.imgur.com/tmImVqo.gif)
![](https://zippy.gfycat.com/ShimmeringYearlyCicada.gif)

* Adds a visualization of potential hunger/saturation restored while holding food:

![](https://i.imgur.com/aHf1QxQ.gif)

* Adds a visualization of potential health restored while holding food:

![](https://i.imgur.com/jUOKFUl.gif)
![](https://zippy.gfycat.com/PowerfulDeafeningHarvestmen.gif)

* Adds hunger/saturation/exhaustion info to the debug overlay (F3)
* Syncs the value of saturation and exhaustion to the client.
Expand All @@ -31,68 +29,3 @@ Minecraft mod that adds various food-related HUD improvements formerly provided
2. Open a command line and execute ```gradlew build```

Note: To give the build a version number, use ```gradlew build -Pversion=<version>``` instead (example: ```gradlew build -Pversion=1.0.0```).

---

### For Mod Developers

> Note: These instructions are Forge-specific. For Fabric, see the instructions in the relevant `-fabric` branch.
If followed, the directions below will make it so that your mod's Maven dependencies won't include AppleSkin at all, and your mod will load fine with or without AppleSkin installed.

To compile against the AppleSkin API, include the following in your `build.gradle`:

```groovy
repositories {
maven { url "https://maven.ryanliptak.com/" }
}
```

and add this to your `dependencies` block:

```groovy
compileOnly fg.deobf("squeek.appleskin:appleskin-forge:<version>:api")
```

where `<version>` is replaced by the appropriate version found here:

https://maven.ryanliptak.com/squeek/appleskin/appleskin-forge

Once you're compiling against the AppleSkin API, you can create an event handler and only register it when `appleskin` is loaded. Here's an example implementation:

In your `@Mod` annotated class:

```java
private void clientInit(final FMLClientSetupEvent event) {
if (ModList.get().isLoaded("appleskin")) {
MinecraftForge.EVENT_BUS.register(new AppleSkinEventHandler());
}
}
```

and the `AppleSkinEventHandler` class:

```java
public class AppleSkinEventHandler
{
@SubscribeEvent
public void onPreTooltipEvent(TooltipOverlayEvent.Pre event) {
// hide the tooltip for regular apples
if (event.itemStack.getItem() == Items.APPLE) {
event.setCanceled(true);
}
}
}
```

(see the `squeek.appleskin.api.event` package for all the possible events that can be registered)

---

Note: if you want to test with the full AppleSkin mod in your development environment, you can also add the following to your `dependencies`:

```groovy
runtimeOnly fg.deobf("squeek.appleskin:appleskin-forge:<version>")
```

while replacing `<version>` as mentioned above.
121 changes: 39 additions & 82 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,112 +1,69 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
plugins {
id 'fabric-loom' version '0.2.6-SNAPSHOT'
id 'maven-publish'
}
apply plugin: 'net.minecraftforge.gradle'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

minecraft {
mappings channel: mappings_channel, version: mappings_version

// default run configurations.
// these can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
mods {
appleskin {
source sourceSets.main
}
}
}
archivesBaseName = project.archives_base_name
group = project.maven_group

server {
workingDirectory project.file('run')
mods {
appleskin {
source sourceSets.main
}
}
}
}
minecraft {
}

group = project.maven_group
archivesBaseName = project.archives_base_name
version = "mc" + project.minecraft_version + "-" + project.mod_version
def semver_version = project.mod_version + "+mc" + project.minecraft_version

sourceSets.main.java.srcDirs += 'java'
sourceSets.main.java.srcDirs += 'apis'
sourceSets.main.resources.srcDirs += 'resources'

dependencies {
minecraft 'net.minecraftforge:forge:'+minecraft_version+'-'+forge_version
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"

modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}

jar {
manifest {
attributes([
"Specification-Title": "appleskin",
"Specification-Vendor": "squeek",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": semver_version,
"Implementation-Vendor" :"squeek",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
processResources {
inputs.property "vars", project.version
from(sourceSets.main.resources.srcDirs) {
include '**/fabric.mod.json'
expand 'version':project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/fabric.mod.json'
}

finalizedBy 'reobfJar'
}

task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from sourceSets.main.allJava
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

task apiJar(type: Jar) {
archiveClassifier.set("api")
from sourceSets.main.output
include "squeek/appleskin/api/**"

finalizedBy 'reobfJar'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar
archives apiJar
jar {
from "LICENSE"
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = archivesBaseName

// add all the jars that should be included when publishing to maven
artifact(jar)
artifact(sourcesJar)
artifact(apiJar)
artifact(jar.archivePath) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}

// select the repositories you want to publish to
repositories {
maven {
url = project.findProperty("maven.url") ?: System.getenv("MAVEN_URL")
credentials {
username=project.findProperty("maven.user") ?: System.getenv("MAVEN_USER")
password=project.findProperty("maven.password") ?: System.getenv("MAVEN_PASSWORD")
}
}
// uncomment to publish to the local maven
// mavenLocal()
}
}
}
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
minecraft_version=1.16.4
forge_version=35.1.4
mappings_version=20201028-1.16.3
mappings_channel=snapshot
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G

# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=20w14infinite
yarn_mappings=20w14infinite+build.4
loader_version=0.7.8+build.187
fabric_version=0.5.7+build.2-20w14infinite

# Mod Properties
maven_group = squeek.appleskin
archives_base_name = appleskin-forge
mod_version = 2.5.1
archives_base_name = appleskin
version = 1.0.8
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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 19 additions & 16 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -126,11 +125,10 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -156,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
i=$((i+1))
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -177,9 +175,14 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading

0 comments on commit c34065d

Please sign in to comment.