Skip to content

Commit

Permalink
Ported to 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
JayCeeCreates committed Jun 15, 2021
1 parent 9f330d2 commit bf0a042
Show file tree
Hide file tree
Showing 202 changed files with 362 additions and 665 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
16 # Minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://github.com/JayCeeCreates/earlygame/blob/master/LICENSE"><img src="https://img.shields.io/github/license/jayceecreates/earlygame?style=for-the-badge"></a>
<img src="https://img.shields.io/badge/mc%20version-1.16.x-brightgreen?style=for-the-badge">
<img src="https://img.shields.io/badge/mc%20version-1.16--1.17-brightgreen?style=for-the-badge">
<img src="https://img.shields.io/badge/mod%20version-1.0.3-yellow?style=for-the-badge">
<a href="https://fabricmc.net"><img src="https://img.shields.io/badge/modloader-fabric-blue?style=for-the-badge"></a>
</p>
Expand All @@ -16,7 +16,7 @@

## Background

This idea revolves around the fact that as of this writing, no such mods for early game realism are present in the Fabric mod database. Then I thought, "Fine, I'll do it myself." Moreover, it was inspired by two particular Forge mods that have the same premise, namely [No Tree Punching (1.12.2/1.15.2/1.16.5)](https://www.curseforge.com/minecraft/mc-mods/no-tree-punching) and [Natural Progression (1.14.4/1.15.2/1.16.5)](https://www.curseforge.com/minecraft/mc-mods/natural-progressions).
This idea revolves around the fact that as of this writing, no such mods for early game realism are present in the Fabric mod database. Then I thought, "Fine, I'll do it myself." Moreover, it was inspired by two particular Forge mods that have the same premise, namely [No Tree Punching](https://www.curseforge.com/minecraft/mc-mods/no-tree-punching) and [Natural Progression](https://www.curseforge.com/minecraft/mc-mods/natural-progressions).

## Features

Expand Down Expand Up @@ -46,7 +46,10 @@ More details are in the [wiki](https://github.com/JayCeeCreates/earlygame/wiki).

### Required

- **[Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api)** (0.30.0+1.16 and above)
- **[Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api)**
- 1.16: 0.30.0+1.16 and above
- 1.17: 0.34.9+1.17 and above
- **[Cloth Config](https://www.curseforge.com/minecraft/mc-mods/cloth-config)**: required for 1.17

### Optional

Expand All @@ -59,7 +62,7 @@ Incompatibilities and bugs can be reported in the [issues](https://github.com/Ja

## Recommended Mods

- **[Unlit Campfire](https://www.curseforge.com/minecraft/mc-mods/unlit-campfire)**: placing campfires on unlit state by default
- **[Unlit Campfire](https://www.curseforge.com/minecraft/mc-mods/unlit-campfire)**: placing campfires on unlit state by default (1.16)

## Credits

Expand Down
74 changes: 40 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,73 +1,78 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

minecraft {
accessWidener = file("src/main/resources/earlygame.accesswidener")
}

repositories {
maven { url "https://jitpack.io" }
maven {
name = 'Cloth Config'
url = 'https://maven.shedaniel.me/'
}
maven {
name = 'Mod Menu'
url = 'https://maven.terraformersmc.com/releases/'
}
}

dependencies {
//to change the versions see the gradle.properties file
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Auto Config 1u
modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")
include ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")

// Cloth Config
modImplementation ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
include ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

// Mod Menu
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}")
modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}")
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

// configure the maven publication
Expand All @@ -84,10 +89,11 @@ publishing {
}
}

// select the repositories you want to publish to
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// uncomment to publish to the local maven
// mavenLocal()
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}

}
16 changes: 7 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.2
yarn_mappings=1.16.2+build.47
loader_version=0.11.1
minecraft_version=1.17
yarn_mappings=1.17+build.11
loader_version=0.11.3

# Mod Properties
mod_version = 1.16.x-1.0.3
mod_version = 1.17.x-1.0.3
maven_group = jayceecreates.earlygame
archives_base_name = earlygame

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.30.0+1.16
auto_config_version=3.2.0-unstable
cloth_config_version=4.7.0-unstable
mod_menu_version=1.14.6+build.31
fabric_version=0.34.9+1.17
cloth_config_version=5.0.34
mod_menu_version=2.0.0-beta.7
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-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ 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 @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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 Down
22 changes: 4 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/jayceecreates/earlygame/EarlyGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import jayceecreates.earlygame.config.EarlyGameConfig;
import jayceecreates.earlygame.init.*;
import jayceecreates.earlygame.utils.ModConfiguredFeatures;
import jayceecreates.earlygame.world.CopperOreGen;

import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
Expand Down Expand Up @@ -40,13 +39,10 @@ public void onInitialize() {
EventsInit.init();

// world gen
RegistryKey<ConfiguredFeature<?, ?>> copperOreGen = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN, new Identifier("earlygame", "copper_ore_gen"));
RegistryKey<ConfiguredFeature<?, ?>> stickTwigGen = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN, new Identifier("earlygame", "stick_twig_gen"));
RegistryKey<ConfiguredFeature<?, ?>> stoneRockGen = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN, new Identifier("earlygame", "stone_rock_gen"));
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, copperOreGen.getValue(), CopperOreGen.COPPER_ORE_GEN);
RegistryKey<ConfiguredFeature<?, ?>> stickTwigGen = RegistryKey.of(Registry.CONFIGURED_FEATURE_KEY, new Identifier("earlygame", "stick_twig_gen"));
RegistryKey<ConfiguredFeature<?, ?>> stoneRockGen = RegistryKey.of(Registry.CONFIGURED_FEATURE_KEY, new Identifier("earlygame", "stone_rock_gen"));
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, stickTwigGen.getValue(), ModConfiguredFeatures.STICK_TWIG);
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, stoneRockGen.getValue(), ModConfiguredFeatures.ROCK_BLOCK);
if (CONFIG.generateCopper) BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, copperOreGen);
if (CONFIG.generateSticks) BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.VEGETAL_DECORATION, stickTwigGen);
if (CONFIG.generateStones) BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.VEGETAL_DECORATION, stoneRockGen);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jayceecreates/earlygame/EarlyGameClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public void onInitializeClient() {
}

public static void slingshotPredicates(SlingshotItem item) {
FabricModelPredicateProviderRegistry.register(item, new Identifier("pull"),(itemStack, clientWorld, livingEntity) -> {
FabricModelPredicateProviderRegistry.register(item, new Identifier("pull"),(itemStack, clientWorld, livingEntity, seed) -> {
if (livingEntity == null) return 0.0F;
else return livingEntity.getActiveItem() != itemStack ? 0.0F : (float)(itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 15.0F;
});

FabricModelPredicateProviderRegistry.register(item, new Identifier("pulling"), (itemStack, clientWorld, livingEntity) ->
FabricModelPredicateProviderRegistry.register(item, new Identifier("pulling"), (itemStack, clientWorld, livingEntity, seed) ->
livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack ? 1.0F : 0.0F);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package jayceecreates.earlygame.armor;

import jayceecreates.earlygame.init.ItemsInit;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
Expand Down Expand Up @@ -41,7 +41,7 @@ public SoundEvent getEquipSound() {
@Override
public Ingredient getRepairIngredient() {

return Ingredient.ofItems(ItemsInit.COPPER_INGOT);
return Ingredient.ofItems(Items.COPPER_INGOT);
}

@Override
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/jayceecreates/earlygame/block/CopperBlock.java

This file was deleted.

Loading

0 comments on commit bf0a042

Please sign in to comment.