Skip to content

Commit

Permalink
1.20 LETS FUNKING GOO
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Dec 18, 2023
1 parent 34ab0e5 commit 8f178ac
Show file tree
Hide file tree
Showing 45 changed files with 277 additions and 259 deletions.
62 changes: 23 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,72 +1,56 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'io.github.juuxel.loom-quiltflower' version '1.6.0'
id "com.modrinth.minotaur" version "2.+"
id 'org.quiltmc.quilt-mappings-on-loom' version '4.0.0'
id "fabric-loom" version "1.4-SNAPSHOT"
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17

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

repositories {
maven { url "https://api.modrinth.com/maven" } // lazyDFU
maven { url "https://ladysnake.jfrog.io/artifactory/mods" } // CCA
maven { url "https://maven.terraformersmc.com" } // modmenu, trinkets
maven { url "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" }
maven {
url "https://api.modrinth.com/maven"
content { includeGroup "maven.modrinth" }
}
maven { url "https://maven.ladysnake.org/releases" } //CCA
maven { url "https://maven.terraformersmc.com" } //trinkets
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings(loom.layered {
addLayer(quiltMappings.mappings("org.quiltmc:quilt-mappings:${minecraft_version}+build.${quilt_mappings}:v2"))
})
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"

modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api}"
modImplementation "dev.emi:trinkets:${project.trinkets_version}"

modLocalRuntime "com.terraformersmc:modmenu:3.1.0"
modLocalRuntime "maven.modrinth:lazydfu:0.1.2"
modLocalRuntime "maven.modrinth:ferrite-core:4.2.0"
modLocalRuntime "me.djtheredstoner:DevAuth-fabric:1.0.0-beta.2"
// modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-api:${project.cca_version}"
modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}"
modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}"
}

base {
archivesName = project.archives_base_name
}

processResources {
inputs.property "version", project.mod_version
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.mod_version
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}

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

import com.modrinth.minotaur.dependencies.ModDependency
modrinth {
projectId = "IsKsViE2"
versionName = "Artifality " + project.mod_version
changelog = System.getenv("CHANGELOG")
versionNumber = project.mod_version
versionType = "beta"
uploadFile = remapJar
additionalFiles = [remapSourcesJar]
gameVersions = ["1.18.2"]
dependencies = [
new ModDependency("P7dR8mSH", "required"), //Fabric API
new ModDependency("5aaWibi9", "required") //Trinkets
]
}
15 changes: 8 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs = -Xmx1G
org.gradle.jvmargs = -Xmx2G

# Mod Properties
mod_version = 0.6.0
mod_version = 0.6.0+1.20
maven_group = ru.pinkgoosik
archives_base_name = artifality

# Dependencies
minecraft_version = 1.18.2
quilt_mappings = 22
loader_version = 0.13.3
fabric_version = 0.48.0+1.18.2
trinkets_version = 3.3.0
minecraft_version = 1.20.1
yarn_mappings = 1.20.1+build.10
fabric_loader = 0.15.2
fabric_api = 0.91.0+1.20.1
trinkets_version = 3.7.1
cca_version = 5.2.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions 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.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
16 changes: 11 additions & 5 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 Down Expand Up @@ -32,10 +32,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 Down Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -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 execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
21 changes: 5 additions & 16 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Cotton'
url = 'https://server.bbkr.space/artifactory/libs-release/'
}
maven {
name 'Quilt'
url 'https://maven.quiltmc.org/repository/release'
}
mavenCentral()
gradlePluginPortal()
}
repositories {
mavenCentral()
gradlePluginPortal()
maven { url "https://maven.fabricmc.net" }
}
}
38 changes: 20 additions & 18 deletions src/main/java/artifality/ArtifalityMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,34 @@
import artifality.data.ArtifalityLootTables;
import artifality.registry.*;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.enchantment.EnchantmentLevelEntry;
import net.minecraft.item.EnchantedBookItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

@SuppressWarnings("unused")
public class ArtifalityMod implements ModInitializer {
public static final String MOD_ID = "artifality";
public static final ItemGroup ITEM_GROUP = createItemGroup();
public static final ItemGroup ITEM_GROUP = FabricItemGroup.builder()
.displayName(Text.translatable("itemGroup.artifality.items"))
.entries((ctx, entries) -> {
ArtifalityItems.ITEMS.forEach((id, item) -> entries.add(item.getDefaultStack()));
ArtifalityBlocks.ITEMS.forEach((id, item) -> entries.add(item.getDefaultStack()));
ArtifalityEnchants.ENCHANTMENTS.forEach((id, enchantment) -> {
for(int i = 1; i <= enchantment.getMaxLevel(); i++) {
ItemStack book = new ItemStack(Items.ENCHANTED_BOOK);
EnchantedBookItem.addEnchantment(book, new EnchantmentLevelEntry(enchantment, i));
entries.add(book);
}
});
})
.icon(ArtifalityItems.FOREST_STAFF::getDefaultStack).build();

@Override
public void onInitialize() {
Expand All @@ -25,25 +41,11 @@ public void onInitialize() {
ArtifalityEvents.init();
ArtifalityLootTables.init();
ArtifalityEffects.init();
}

private static ItemGroup createItemGroup() {
return FabricItemGroupBuilder.create(locate("items"))
.appendItems(stacks -> {
ArtifalityItems.ITEMS.forEach((id, item) -> stacks.add(item.getDefaultStack()));
ArtifalityBlocks.ITEMS.forEach((id, item) -> stacks.add(item.getDefaultStack()));
ArtifalityEnchants.ENCHANTMENTS.forEach((id, enchantment) -> {
for(int i = 1; i <= enchantment.getMaxLevel(); i++) {
ItemStack book = new ItemStack(Items.ENCHANTED_BOOK);
EnchantedBookItem.addEnchantment(book, new EnchantmentLevelEntry(enchantment, i));
stacks.add(book);
}
});
})
.icon(ArtifalityItems.FOREST_STAFF::getDefaultStack).build();
Registry.register(Registries.ITEM_GROUP, id("items"), ITEM_GROUP);
}

public static Identifier locate(String path) {
public static Identifier id(String path) {
return new Identifier(MOD_ID, path);
}
}
3 changes: 2 additions & 1 deletion src/main/java/artifality/api/ArtifalityAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.util.Identifier;

public class ArtifalityAPI implements ModInitializer, ClientModInitializer {

Expand All @@ -15,7 +16,7 @@ public void onInitialize() {
@Override
public void onInitializeClient() {
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> TwoModelsItemRegistry.ENTRIES.forEach((id, item) ->
out.accept(new ModelIdentifier(id + "_in_hand#inventory"))
out.accept(new ModelIdentifier(new Identifier(id + "_in_hand"), "inventory"))
));
}
}
4 changes: 2 additions & 2 deletions src/main/java/artifality/api/TwoModelsItemRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import java.util.LinkedHashMap;
import java.util.Map;
Expand All @@ -22,7 +22,7 @@ public class TwoModelsItemRegistry {
*/
public static void register(Item... items) {
for(Item item : items) {
Identifier id = Registry.ITEM.getId(item);
Identifier id = Registries.ITEM.getId(item);
ENTRIES.put(id, item);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/artifality/block/CrateBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.tag.FluidTags;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
Expand Down Expand Up @@ -119,7 +119,7 @@ public void incrementAmplifiers(PlayerEntity player, ArtifactChances extension)
int debugrare = extension.artifality$getRareAmplifier();
int debuglegendary = extension.artifality$getLegendaryAmplifier();

player.sendMessage(new LiteralText("[DEBUG] amplifiers: " + debugcommon + "% " + debugrare + "% " + debuglegendary + "%"), false);
player.sendMessage(Text.literal("[DEBUG] amplifiers: " + debugcommon + "% " + debugrare + "% " + debuglegendary + "%"), false);
}

public void dropArtifact(ArtifactChances extension, World world, BlockPos pos) {
Expand All @@ -146,10 +146,10 @@ public void dropArtifact(ArtifactChances extension, World world, BlockPos pos) {

public void dropEntity(BlockPos pos, ServerWorld world) {
if(world.random.nextInt(5) == 0) {
EntityType.SILVERFISH.spawn(world, null, null, null, pos, SpawnReason.NATURAL, true, false);
EntityType.SILVERFISH.spawn(world, pos, SpawnReason.NATURAL);
}
else if(world.random.nextInt(10) == 0) {
EntityType.CAVE_SPIDER.spawn(world, null, null, null, pos, SpawnReason.NATURAL, true, false);
EntityType.CAVE_SPIDER.spawn(world, pos, SpawnReason.NATURAL);
}
}

Expand Down
Loading

0 comments on commit 8f178ac

Please sign in to comment.