diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5adf394 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +# 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: [ + 17, # Current Java LTS & minimum supported by Minecraft + 21, # Current Java LTS + ] + # and run on both Linux and Windows + os: [ubuntu-22.04, windows-2022] + runs-on: ${{ matrix.os }} + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'microsoft' + - 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 == '21' }} # Only upload artifacts built from latest java on one OS + uses: actions/upload-artifact@v3 + with: + name: Artifacts + path: build/libs/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9154f4c..c476faf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,40 @@ -# ---> Java -# Compiled class file -*.class +# gradle -# Log file -*.log +.gradle/ +build/ +out/ +classes/ -# BlueJ files -*.ctxt +# eclipse -# Mobile Tools for Java (J2ME) -.mtj.tmp/ +*.launch -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar +# idea -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -replay_pid* +.idea/ +*.iml +*.ipr +*.iws +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ + +# java + +hs_err_*.log +replay_*.log +*.hprof +*.jfr diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..9c5701c --- /dev/null +++ b/build.gradle @@ -0,0 +1,95 @@ +plugins { + id 'fabric-loom' version '1.5-SNAPSHOT' + id 'maven-publish' +} + +version = project.mod_version +group = project.maven_group + +base { + archivesName = project.archives_base_name +} + +repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. +} + +loom { + splitEnvironmentSourceSets() + + mods { + "kelsoncraft-test" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } + +} + +fabricApi { + configureDataGeneration() +} + +dependencies { + // 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}" + + // Uncomment the following line to enable the deprecated Fabric API modules. + // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. + + // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.release = 17 +} + +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() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +jar { + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}"} + } +} + +// configure the maven publication +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // 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. + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..1a7cdb5 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,17 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G +org.gradle.parallel=true + +# Fabric Properties +# check these on https://fabricmc.net/develop +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.15.5 + +# Mod Properties +mod_version=1.0.0 +maven_group=net.kelsoncraft.test +archives_base_name=kelsoncraft-test + +# Dependencies +fabric_version=0.91.0+1.20.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..d64cd49 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1af9e09 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..1aa94a4 --- /dev/null +++ b/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# 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». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# 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 +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# 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 + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +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=SC2039,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=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + 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. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +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% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +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. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +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. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +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! +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 + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..75c4d72 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} \ No newline at end of file diff --git a/src/client/java/net/kelsoncraft/test/KelsonCraftTestClient.java b/src/client/java/net/kelsoncraft/test/KelsonCraftTestClient.java new file mode 100644 index 0000000..3ed48bb --- /dev/null +++ b/src/client/java/net/kelsoncraft/test/KelsonCraftTestClient.java @@ -0,0 +1,39 @@ +package net.kelsoncraft.test; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.event.player.UseItemCallback; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.mixin.client.rendering.EntityRenderersMixin; +import net.kelsoncraft.test.item.CustomItems; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.LightningEntityRenderer; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LightningEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.predicate.entity.LightningBoltPredicate; +import net.minecraft.text.Text; +import net.minecraft.util.TypedActionResult; + +public class KelsonCraftTestClient implements ClientModInitializer { + @Override + public void onInitializeClient() { + + // Code below came from https://www.reddit.com/r/fabricmc/comments/qyt3jg/comment/hls4vep/ + // This works, but it doesn't show the lightning strike. + + // This runs whenever a player right clicks with the ruby, which is set in the if statement + UseItemCallback.EVENT.register((player, world, unused) ->{ + ItemStack mainHandItem = player.getMainHandStack(); // Get the item the player is holding in their main hand. + if(player.getMainHandStack().getName().equals(Text.translatable("item.kelsoncraft-test.ruby"))){ // Check if item is a ruby. + LightningEntity lightning = new LightningEntity(EntityType.LIGHTNING_BOLT, world); // Create the lightning bolt. + world.spawnEntity(lightning); // Spawn the lightning entity + + + // This might be a way to make the lightning render in, I'm not sure how to use the EntityRendererFactory.Context() + //LightningEntityRenderer lightning1 = new LightningEntityRenderer(new EntityRendererFactory.Context()); + } + return TypedActionResult.success(mainHandItem, true); // Return success and swing hand to show item use. + }); + // This entrypoint is suitable for setting up client-specific logic, such as rendering. + } +} \ No newline at end of file diff --git a/src/client/java/net/kelsoncraft/test/mixin/client/ExampleClientMixin.java b/src/client/java/net/kelsoncraft/test/mixin/client/ExampleClientMixin.java new file mode 100644 index 0000000..daf5e70 --- /dev/null +++ b/src/client/java/net/kelsoncraft/test/mixin/client/ExampleClientMixin.java @@ -0,0 +1,15 @@ +package net.kelsoncraft.test.mixin.client; + +import net.minecraft.client.MinecraftClient; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftClient.class) +public class ExampleClientMixin { + @Inject(at = @At("HEAD"), method = "run") + private void run(CallbackInfo info) { + // This code is injected into the start of MinecraftClient.run()V + } +} \ No newline at end of file diff --git a/src/client/resources/kelsoncraft-test.client.mixins.json b/src/client/resources/kelsoncraft-test.client.mixins.json new file mode 100644 index 0000000..597c234 --- /dev/null +++ b/src/client/resources/kelsoncraft-test.client.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.kelsoncraft.test.mixin.client", + "compatibilityLevel": "JAVA_17", + "client": [ + "ExampleClientMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file diff --git a/src/main/java/net/kelsoncraft/test/EntitySpawnTest.java b/src/main/java/net/kelsoncraft/test/EntitySpawnTest.java new file mode 100644 index 0000000..4fe4333 --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/EntitySpawnTest.java @@ -0,0 +1,39 @@ +package net.kelsoncraft.test; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.fabricmc.fabric.api.event.player.UseItemCallback; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LightningEntity; +import net.minecraft.entity.passive.ChickenEntity; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.server.command.SummonCommand; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +public class EntitySpawnTest { + + public void MobTest(World world){ + // I'm not sure how to get the current world the player is in. + //World world = ; + // I have no idea what this will do lol, I think possibly I have finally figured it out. + // I'm not sure how to spawn these mobs like this though. + ChickenEntity chicken = new ChickenEntity(EntityType.CHICKEN, world); + + // Looks like I could use the SummonCommand code as a reference to what I'm trying to do. + // Doing the above is not right at all for spawning, but possibly modifying the mob. + + // I can use the summon command like below somehow: + //SummonCommand.summon(); + } + +// public void SummonTest(ServerCommandSource source, EntityType entityType, Vec3d pos, NbtCompound nbt) throws CommandSyntaxException { + + // I think I have the base for this summon command that I'm playing with, now however to use it I have no idea. + public static void SummonTest(ServerCommandSource source, RegistryEntry.Reference> entityType, Vec3d pos, NbtCompound nbt) throws CommandSyntaxException { + SummonCommand.summon(source, entityType, pos, nbt, false); + } +} diff --git a/src/main/java/net/kelsoncraft/test/KelsonCraftTest.java b/src/main/java/net/kelsoncraft/test/KelsonCraftTest.java new file mode 100644 index 0000000..da82199 --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/KelsonCraftTest.java @@ -0,0 +1,92 @@ +package net.kelsoncraft.test; + +import net.fabricmc.api.ModInitializer; + +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.fabricmc.fabric.api.registry.FuelRegistry; +import net.kelsoncraft.test.block.CustomBlocks; +import net.kelsoncraft.test.item.CustomItems; +import net.kelsoncraft.test.item.CustomItemGroups; +import net.minecraft.text.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import static net.minecraft.server.command.CommandManager.*; + +public class KelsonCraftTest implements ModInitializer { + // This logger is used to write text to the console and the log file. + // It is considered best practice to use your mod id as the logger's name. + // That way, it's clear which mod wrote info, warnings, and errors. + public static final String MOD_ID = "kelsoncraft-test"; + public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); + + + // This crashed it for some reason, so I had to move it into the onInitialize. + // The method like below that they were using in the wiki didn't work, so I had to change it to what I did under this code. + //public static final CustomItem CUSTOM_ITEM = new CustomItem(new FabricItemSettings()); + + + + // Try to use something like this to make particles, not sure how that would work. + //ParticleTypes.DRIPPING_LAVA + + // Try to create a basic portable crafting command + + // Try to modify the value of the EnderChestInventory from 27 to something higher (Possibly with a mixin). + + // Try to create a BossBar at the top of the screen, either with a command or something else. + // BossBar ServerBossBar + + // I have no idea how this would work. + //DamageSources dmgsource = new DamageSources(); + + // I wonder how to set status effects with this: StatusEffects + + // Could I do anything with this?: HostileEntity + + // Try and use this to modify the hunger somehow: HungerManager + // This might be fun to modify, to change the attack cool downs if this is the code: ItemCooldownManager + // This shows the players walk speed, if they can fly and all that: PlayerAbilities + + // Looks like this is the equivalent of me doing if (sender instanceof Player) in Spigot. + // if (entity instanceof ServerPlayerEntity) + + // The minecart code mostly seems to be in: AbstractMinecartEntity + + // I wonder if I can spawn a mob with a command using this: EntityType + // LightningEntity + + + @Override + public void onInitialize() { + // This code runs as soon as Minecraft is in a mod-load-ready state. + // However, some things (like resources) may still be uninitialized. + // Proceed with mild caution. + + // Initialize the item + // This works, but it's better to do what I'm doing above with CUSTOM_ITEM. + //Registry.register(Registries.ITEM, new Identifier("kelsoncraft-test", "custom_item"), new CustomItem(new FabricItemSettings().maxCount(16))); + + // Basic command test, just shows "Called /test with no arguments" + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal("test") + .executes(context -> { + // For versions below 1.19, replace "Text.literal" with "new LiteralText". + // For versions below 1.20, remode "() ->" directly. + context.getSource().sendFeedback(() -> Text.literal("Called /test with no arguments"), false); + + + return 1; + }))); + + // This is a way to use the item as fuel + FuelRegistry.INSTANCE.add(CustomItems.CUSTOM_ITEM, 300); + + // Register items + CustomItemGroups.registerItemGroups(); + CustomItems.RegisterCustomItems(); + + // Register blocks + CustomBlocks.registerModBlocks(); + + LOGGER.info("Hello Fabric world!"); + } +} \ No newline at end of file diff --git a/src/main/java/net/kelsoncraft/test/KelsonCraftTestDataGenerator.java b/src/main/java/net/kelsoncraft/test/KelsonCraftTestDataGenerator.java new file mode 100644 index 0000000..c35f199 --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/KelsonCraftTestDataGenerator.java @@ -0,0 +1,11 @@ +package net.kelsoncraft.test; + +import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; +import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; + +public class KelsonCraftTestDataGenerator implements DataGeneratorEntrypoint { + @Override + public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { + + } +} diff --git a/src/main/java/net/kelsoncraft/test/block/CustomBlocks.java b/src/main/java/net/kelsoncraft/test/block/CustomBlocks.java new file mode 100644 index 0000000..7af560c --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/block/CustomBlocks.java @@ -0,0 +1,48 @@ +package net.kelsoncraft.test.block; + +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.kelsoncraft.test.KelsonCraftTest; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.block.ExperienceDroppingBlock; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.intprovider.UniformIntProvider; + +public class CustomBlocks { + + public static final Block RUBY_BLOCK = registerBlock("ruby_block", + new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.AMETHYST_BLOCK))); + // Custom can be created with something like this: + // new Block(FabricBlockSettings.create())); + + public static final Block RAW_RUBY_BLOCK = registerBlock("raw_ruby_block", + new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.AMETHYST_BLOCK))); + public static final Block RUBY_ORE = registerBlock("ruby_ore", + new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.STONE).strength(2f), UniformIntProvider.create(2, 5))); + public static final Block DEEPSLATE_RUBY_ORE = registerBlock("deepslate_ruby_ore", + new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.DEEPSLATE).strength(4f), UniformIntProvider.create(2, 5))); + public static final Block NETHER_RUBY_ORE = registerBlock("nether_ruby_ore", + new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.NETHERRACK).strength(1.5f), UniformIntProvider.create(2, 5))); + public static final Block END_STONE_RUBY_ORE = registerBlock("end_stone_ruby_ore", + new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.END_STONE).strength(4f), UniformIntProvider.create(4, 7))); + + private static Block registerBlock(String name, Block block){ + registerBlockItem(name, block); + return Registry.register(Registries.BLOCK, new Identifier(KelsonCraftTest.MOD_ID, name), block); + } + + private static Item registerBlockItem(String name, Block block){ + return Registry.register(Registries.ITEM, new Identifier(KelsonCraftTest.MOD_ID, name), + new BlockItem(block, new FabricItemSettings())); + } + + public static void registerModBlocks(){ + KelsonCraftTest.LOGGER.info("Registering custom blocks for " + KelsonCraftTest.MOD_ID); + } +} diff --git a/src/main/java/net/kelsoncraft/test/item/CustomItemGroups.java b/src/main/java/net/kelsoncraft/test/item/CustomItemGroups.java new file mode 100644 index 0000000..117a430 --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/item/CustomItemGroups.java @@ -0,0 +1,41 @@ +package net.kelsoncraft.test.item; + +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.kelsoncraft.test.KelsonCraftTest; +import net.kelsoncraft.test.block.CustomBlocks; +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; + +public class CustomItemGroups { + + // This adds the items to a custom item group in the creative menu. + public static final ItemGroup CUSTOM_GROUP = Registry.register(Registries.ITEM_GROUP, + new Identifier(KelsonCraftTest.MOD_ID, "custom_items"), + FabricItemGroup.builder().displayName(Text.translatable("itemgroup.custom")) + .icon(() -> new ItemStack(CustomItems.RUBY)).entries((displayContext, entries) -> { + // Custom items + entries.add(CustomItems.RUBY); + entries.add(CustomItems.RAW_RUBY); + entries.add(CustomItems.CUSTOM_ITEM); + + // Custom blocks + entries.add(CustomBlocks.RUBY_BLOCK); + entries.add(CustomBlocks.RAW_RUBY_BLOCK); + entries.add(CustomBlocks.RUBY_ORE); + entries.add(CustomBlocks.DEEPSLATE_RUBY_ORE); + entries.add(CustomBlocks.NETHER_RUBY_ORE); + entries.add(CustomBlocks.END_STONE_RUBY_ORE); + + // Vanilla items can be added to this group also + //entries.add(Items.DIAMOND); + }).build()); + + public static void registerItemGroups(){ + KelsonCraftTest.LOGGER.info("Registering item groups for " + KelsonCraftTest.MOD_ID); + } +} diff --git a/src/main/java/net/kelsoncraft/test/item/CustomItems.java b/src/main/java/net/kelsoncraft/test/item/CustomItems.java new file mode 100644 index 0000000..1bfd907 --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/item/CustomItems.java @@ -0,0 +1,60 @@ +package net.kelsoncraft.test.item; + +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.kelsoncraft.test.KelsonCraftTest; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.Hand; +import net.minecraft.util.Identifier; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; + +public class CustomItems extends Item { + + public CustomItems(Settings settings) { + super(settings); + } + + public static final Item RUBY = registerItem("ruby", new Item(new FabricItemSettings())); + public static final Item RAW_RUBY = registerItem("raw_ruby", new Item(new FabricItemSettings())); + public static final Item CUSTOM_ITEM = registerItem("custom_item", new Item(new FabricItemSettings())); + + private static void addItemsToIngredientItemGroup(FabricItemGroupEntries entries){ + entries.add(RUBY); + entries.add(RAW_RUBY); + entries.add(CUSTOM_ITEM); + } + + private static Item registerItem(String name, Item item){ + return Registry.register(Registries.ITEM, new Identifier(KelsonCraftTest.MOD_ID, name), item); + //new CustomItem(new FabricItemSettings())); + } + + public static void RegisterCustomItems() { + KelsonCraftTest.LOGGER.info("Registering mod items for " + KelsonCraftTest.MOD_ID); + + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(CustomItems::addItemsToIngredientItemGroup); + } + +/* + * Old method of adding items. + public static final CustomItem CUSTOM_ITEM = + Registry.register(Registries.ITEM, new Identifier(KelsonCraftTest.MOD_ID, "custom_item"), + new CustomItem(new FabricItemSettings())); +*/ + + // This doesn't work with the way I changed the items around + @Override + public TypedActionResult use(World world, PlayerEntity playerEntity, Hand hand) { + // Plays amethyst step sound when clicked. + playerEntity.playSound(SoundEvents.BLOCK_AMETHYST_CLUSTER_STEP, 1.0F, 1.0F); + return TypedActionResult.success(playerEntity.getStackInHand(hand)); + } +} diff --git a/src/main/java/net/kelsoncraft/test/mixin/ExampleMixin.java b/src/main/java/net/kelsoncraft/test/mixin/ExampleMixin.java new file mode 100644 index 0000000..d23973c --- /dev/null +++ b/src/main/java/net/kelsoncraft/test/mixin/ExampleMixin.java @@ -0,0 +1,15 @@ +package net.kelsoncraft.test.mixin; + +import net.minecraft.server.MinecraftServer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftServer.class) +public class ExampleMixin { + @Inject(at = @At("HEAD"), method = "loadWorld") + private void init(CallbackInfo info) { + // This code is injected into the start of MinecraftServer.loadWorld()V + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/blockstates/deepslate_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/blockstates/deepslate_ruby_ore.json new file mode 100644 index 0000000..04f7887 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/blockstates/deepslate_ruby_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "kelsoncraft-test:block/deepslate_ruby_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/blockstates/end_stone_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/blockstates/end_stone_ruby_ore.json new file mode 100644 index 0000000..d3aaee5 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/blockstates/end_stone_ruby_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "kelsoncraft-test:block/end_stone_ruby_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/blockstates/nether_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/blockstates/nether_ruby_ore.json new file mode 100644 index 0000000..0eb8e26 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/blockstates/nether_ruby_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "kelsoncraft-test:block/nether_ruby_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/blockstates/raw_ruby_block.json b/src/main/resources/assets/kelsoncraft-test/blockstates/raw_ruby_block.json new file mode 100644 index 0000000..87dd5b9 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/blockstates/raw_ruby_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "kelsoncraft-test:block/raw_ruby_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/blockstates/ruby_block.json b/src/main/resources/assets/kelsoncraft-test/blockstates/ruby_block.json new file mode 100644 index 0000000..43390e2 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/blockstates/ruby_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "kelsoncraft-test:block/ruby_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/blockstates/ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/blockstates/ruby_ore.json new file mode 100644 index 0000000..9d654ce --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/blockstates/ruby_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "kelsoncraft-test:block/ruby_ore" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/icon.png b/src/main/resources/assets/kelsoncraft-test/icon.png new file mode 100644 index 0000000..047b91f Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/icon.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/lang/en_us.json b/src/main/resources/assets/kelsoncraft-test/lang/en_us.json new file mode 100644 index 0000000..07f6cdc --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/lang/en_us.json @@ -0,0 +1,14 @@ +{ + "item.kelsoncraft-test.ruby": "Ruby", + "item.kelsoncraft-test.raw_ruby": "Raw Ruby", + "item.kelsoncraft-test.custom_item": "Custom item", + + "block.kelsoncraft-test.ruby_block": "Ruby Block", + "block.kelsoncraft-test.raw_ruby_block": "Raw Ruby Block", + "block.kelsoncraft-test.ruby_ore": "Ruby Ore", + "block.kelsoncraft-test.deepslate_ruby_ore": "Deepslate Ruby Ore", + "block.kelsoncraft-test.nether_ruby_ore": "Nether Ruby Ore", + "block.kelsoncraft-test.end_stone_ruby_ore": "End Stone Ruby Ore", + + "itemgroup.custom": "Custom Items" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/block/deepslate_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/block/deepslate_ruby_ore.json new file mode 100644 index 0000000..1752c14 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/block/deepslate_ruby_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "kelsoncraft-test:block/deepslate_ruby_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/block/end_stone_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/block/end_stone_ruby_ore.json new file mode 100644 index 0000000..4efea8d --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/block/end_stone_ruby_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "kelsoncraft-test:block/end_stone_ruby_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/block/nether_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/block/nether_ruby_ore.json new file mode 100644 index 0000000..99271c5 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/block/nether_ruby_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "kelsoncraft-test:block/nether_ruby_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/block/raw_ruby_block.json b/src/main/resources/assets/kelsoncraft-test/models/block/raw_ruby_block.json new file mode 100644 index 0000000..0cf24d5 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/block/raw_ruby_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "kelsoncraft-test:block/raw_ruby_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/block/ruby_block.json b/src/main/resources/assets/kelsoncraft-test/models/block/ruby_block.json new file mode 100644 index 0000000..b3bbdd7 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/block/ruby_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "kelsoncraft-test:block/ruby_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/block/ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/block/ruby_ore.json new file mode 100644 index 0000000..9a70424 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/block/ruby_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "kelsoncraft-test:block/ruby_ore" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/custom_item.json b/src/main/resources/assets/kelsoncraft-test/models/item/custom_item.json new file mode 100644 index 0000000..0c7519b --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/custom_item.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "kelsoncraft-test:item/custom_item" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/deepslate_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/item/deepslate_ruby_ore.json new file mode 100644 index 0000000..d4ef4c8 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/deepslate_ruby_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "kelsoncraft-test:block/deepslate_ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/end_stone_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/item/end_stone_ruby_ore.json new file mode 100644 index 0000000..35119b0 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/end_stone_ruby_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "kelsoncraft-test:block/end_stone_ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/nether_ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/item/nether_ruby_ore.json new file mode 100644 index 0000000..152a496 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/nether_ruby_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "kelsoncraft-test:block/nether_ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/raw_ruby.json b/src/main/resources/assets/kelsoncraft-test/models/item/raw_ruby.json new file mode 100644 index 0000000..0efcf13 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/raw_ruby.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "kelsoncraft-test:item/raw_ruby" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/raw_ruby_block.json b/src/main/resources/assets/kelsoncraft-test/models/item/raw_ruby_block.json new file mode 100644 index 0000000..b1c888c --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/raw_ruby_block.json @@ -0,0 +1,3 @@ +{ + "parent": "kelsoncraft-test:block/raw_ruby_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/ruby.json b/src/main/resources/assets/kelsoncraft-test/models/item/ruby.json new file mode 100644 index 0000000..3417966 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/ruby.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "kelsoncraft-test:item/ruby" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/ruby_block.json b/src/main/resources/assets/kelsoncraft-test/models/item/ruby_block.json new file mode 100644 index 0000000..f9f8da0 --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/ruby_block.json @@ -0,0 +1,3 @@ +{ + "parent": "kelsoncraft-test:block/ruby_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/models/item/ruby_ore.json b/src/main/resources/assets/kelsoncraft-test/models/item/ruby_ore.json new file mode 100644 index 0000000..e59a72c --- /dev/null +++ b/src/main/resources/assets/kelsoncraft-test/models/item/ruby_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "kelsoncraft-test:block/ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/assets/kelsoncraft-test/textures/block/deepslate_ruby_ore.png b/src/main/resources/assets/kelsoncraft-test/textures/block/deepslate_ruby_ore.png new file mode 100644 index 0000000..509da6e Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/block/deepslate_ruby_ore.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/block/end_stone_ruby_ore.png b/src/main/resources/assets/kelsoncraft-test/textures/block/end_stone_ruby_ore.png new file mode 100644 index 0000000..955c621 Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/block/end_stone_ruby_ore.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/block/nether_ruby_ore.png b/src/main/resources/assets/kelsoncraft-test/textures/block/nether_ruby_ore.png new file mode 100644 index 0000000..dd45679 Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/block/nether_ruby_ore.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/block/raw_ruby_block.png b/src/main/resources/assets/kelsoncraft-test/textures/block/raw_ruby_block.png new file mode 100644 index 0000000..24cf0e7 Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/block/raw_ruby_block.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/block/ruby_block.png b/src/main/resources/assets/kelsoncraft-test/textures/block/ruby_block.png new file mode 100644 index 0000000..33e98ed Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/block/ruby_block.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/block/ruby_ore.png b/src/main/resources/assets/kelsoncraft-test/textures/block/ruby_ore.png new file mode 100644 index 0000000..fbcff31 Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/block/ruby_ore.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/item/custom_item.png b/src/main/resources/assets/kelsoncraft-test/textures/item/custom_item.png new file mode 100644 index 0000000..3db5a89 Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/item/custom_item.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/item/raw_ruby.png b/src/main/resources/assets/kelsoncraft-test/textures/item/raw_ruby.png new file mode 100644 index 0000000..e3ca5fe Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/item/raw_ruby.png differ diff --git a/src/main/resources/assets/kelsoncraft-test/textures/item/ruby.png b/src/main/resources/assets/kelsoncraft-test/textures/item/ruby.png new file mode 100644 index 0000000..0d7c407 Binary files /dev/null and b/src/main/resources/assets/kelsoncraft-test/textures/item/ruby.png differ diff --git a/src/main/resources/data/fabric/tags/blocks/needs_tool_level_4.json b/src/main/resources/data/fabric/tags/blocks/needs_tool_level_4.json new file mode 100644 index 0000000..cbea5b3 --- /dev/null +++ b/src/main/resources/data/fabric/tags/blocks/needs_tool_level_4.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "kelsoncraft-test:end_stone_ruby_ore" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/deepslate_ruby_ore.json b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/deepslate_ruby_ore.json new file mode 100644 index 0000000..30c9d34 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/deepslate_ruby_ore.json @@ -0,0 +1,59 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "kelsoncraft-test:deepslate_ruby_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 5.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops", + "function": "minecraft:apply_bonus" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "kelsoncraft-test:raw_ruby" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "kelsoncraft-test:blocks/ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/end_stone_ruby_ore.json b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/end_stone_ruby_ore.json new file mode 100644 index 0000000..720ea94 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/end_stone_ruby_ore.json @@ -0,0 +1,59 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "kelsoncraft-test:end_stone_ruby_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 5.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops", + "function": "minecraft:apply_bonus" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "kelsoncraft-test:raw_ruby" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "kelsoncraft-test:blocks/ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/nether_ruby_ore.json b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/nether_ruby_ore.json new file mode 100644 index 0000000..c2a9c80 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/nether_ruby_ore.json @@ -0,0 +1,59 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "kelsoncraft-test:nether_ruby_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 5.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops", + "function": "minecraft:apply_bonus" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "kelsoncraft-test:raw_ruby" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "kelsoncraft-test:blocks/ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/raw_ruby_block.json b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/raw_ruby_block.json new file mode 100644 index 0000000..f7fea89 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/raw_ruby_block.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "kelsoncraft-test:raw_ruby_block" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/ruby_block.json b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/ruby_block.json new file mode 100644 index 0000000..55073e5 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/ruby_block.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "kelsoncraft-test:ruby_block" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/ruby_ore.json b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/ruby_ore.json new file mode 100644 index 0000000..88c6f3a --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/loot_tables/blocks/ruby_ore.json @@ -0,0 +1,59 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ], + "name": "kelsoncraft-test:ruby_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 5.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops", + "function": "minecraft:apply_bonus" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "kelsoncraft-test:raw_ruby" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "kelsoncraft-test:blocks/ruby_ore" +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/recipes/ruby_block_from_ruby.json b/src/main/resources/data/kelsoncraft-test/recipes/ruby_block_from_ruby.json new file mode 100644 index 0000000..53f8d4f --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/recipes/ruby_block_from_ruby.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "###", + "###", + "###" + ], + "key": { + "#": { + "item": "kelsoncraft-test:ruby" + } + }, + "result": { + "item": "kelsoncraft-test:ruby_block" + } +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_blasting_raw_ruby.json b/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_blasting_raw_ruby.json new file mode 100644 index 0000000..1051aca --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_blasting_raw_ruby.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:blasting", + "category": "misc", + "cookingtime": 100, + "experience": 0.7, + "group": "ruby", + "ingredient": { + "item": "kelsoncraft-test:raw_ruby" + }, + "result": "kelsoncraft-test:ruby" +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_ruby_block.json b/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_ruby_block.json new file mode 100644 index 0000000..c785fa1 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_ruby_block.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "building", + "ingredients": [ + { + "item": "kelsoncraft-test:ruby_block" + } + ], + "result": { + "item": "kelsoncraft-test:ruby", + "count": 9 + } +} \ No newline at end of file diff --git a/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_smelting_raw_ruby.json b/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_smelting_raw_ruby.json new file mode 100644 index 0000000..522bce1 --- /dev/null +++ b/src/main/resources/data/kelsoncraft-test/recipes/ruby_from_smelting_raw_ruby.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:smelting", + "category": "misc", + "cookingtime": 200, + "experience": 0.7, + "group": "ruby", + "ingredient": { + "item": "kelsoncraft-test:raw_ruby" + }, + "result": "kelsoncraft-test:ruby" +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json new file mode 100644 index 0000000..e14f1ee --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/hoe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/hoe.json new file mode 100644 index 0000000..6ac05aa --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/hoe.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json new file mode 100644 index 0000000..1a57b6b --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "kelsoncraft-test:ruby_block", + "kelsoncraft-test:raw_ruby_block", + "kelsoncraft-test:ruby_ore", + "kelsoncraft-test:deepslate_ruby_ore", + "kelsoncraft-test:nether_ruby_ore", + "kelsoncraft-test:end_stone_ruby_ore" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/shovel.json b/src/main/resources/data/minecraft/tags/blocks/mineable/shovel.json new file mode 100644 index 0000000..6ac05aa --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/shovel.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/needs_diamond_tool.json b/src/main/resources/data/minecraft/tags/blocks/needs_diamond_tool.json new file mode 100644 index 0000000..b12320e --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/needs_diamond_tool.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "kelsoncraft-test:deepslate_ruby_ore" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json b/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json new file mode 100644 index 0000000..5e642ee --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/needs_iron_tool.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "kelsoncraft-test:ruby_block", + "kelsoncraft-test:raw_ruby_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json b/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json new file mode 100644 index 0000000..6ac05aa --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + + ] +} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..70080d4 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,44 @@ +{ + "schemaVersion": 1, + "id": "kelsoncraft-test", + "version": "${version}", + "name": "KelsonCraft test", + "description": "This is a test mod made by kelson8!", + "authors": [ + "kelson8" + ], + "contact": { + "homepage": "https://fabricmc.net/", + "sources": "https://github.com/FabricMC/fabric-example-mod" + }, + "license": "MIT", + "icon": "assets/kelsoncraft-test/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "net.kelsoncraft.test.KelsonCraftTest" + ], + "client": [ + "net.kelsoncraft.test.KelsonCraftTestClient" + ], + "fabric-datagen": [ + "net.kelsoncraft.test.KelsonCraftTestDataGenerator" + ] + }, + "mixins": [ + "kelsoncraft-test.mixins.json", + { + "config": "kelsoncraft-test.client.mixins.json", + "environment": "client" + } + ], + "depends": { + "fabricloader": ">=0.15.5", + "minecraft": "~1.20.1", + "java": ">=17", + "fabric-api": "*" + }, + "suggests": { + "another-mod": "*" + } +} \ No newline at end of file diff --git a/src/main/resources/kelsoncraft-test.mixins.json b/src/main/resources/kelsoncraft-test.mixins.json new file mode 100644 index 0000000..40d505d --- /dev/null +++ b/src/main/resources/kelsoncraft-test.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.kelsoncraft.test.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "ExampleMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file