diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..097f9f9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b01da52 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +# 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: [ + 21, # Current Java LTS + ] + runs-on: ubuntu-22.04 + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v2 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'microsoft' + - name: make gradle wrapper executable + run: chmod +x ./gradlew + - name: build + run: ./gradlew build + - name: capture build artifacts + if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java + uses: actions/upload-artifact@v4 + with: + name: Artifacts + path: build/libs/ \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ffee857 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ + +# java + +hs_err_*.log +replay_*.log +*.hprof +*.jfr +/.gradle/ +/.idea/ +/build/ diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/README.md b/README.md index 26fa2f2..a892754 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Just A Baguette -Just A Baguette adds literally one item: A Baguette. Why? Why not!  +Just A Baguette adds literally one item: A Baguette. Why? Why not! ## Download @@ -15,5 +15,5 @@ Please open an issue in Github, and choose [Bug](https://github.com/purejosh/jus Please join our [Discord](https://discord.com/invite/X6AsDnqex6) for any additional assistance. ## License -[MIT-R-NR](https://github.com/purejosh/justabaguette/blob/master/LICENSE.txt) +[MIT-R-NR](https://github.com/purejosh/justabaguette/blob/1.21/LICENSE) diff --git a/build.gradle b/build.gradle index d4eed65..e1f6c45 100644 --- a/build.gradle +++ b/build.gradle @@ -1,57 +1,88 @@ plugins { - id 'fabric-loom' version '1.2-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' + id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +version = project.mod_version +group = project.maven_group -archivesBaseName = 'modid' -version = '1.0.0' -group = 'com.yourname.modid' -actualmodid = 'justabaguette' +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 { - mixin { - defaultRefmapName = actualmodid + ".refmap.json" - } + splitEnvironmentSourceSets() + + mods { + "justabaguette" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } + } dependencies { - minecraft "com.mojang:minecraft:1.20.1" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:0.14.21" + // 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 - modImplementation "net.fabricmc.fabric-api:fabric-api:0.83.1+1.20.1" + // Fabric API. This is technically optional, but you probably want it anyway. + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + } processResources { - inputs.property "version", project.version + inputs.property "version", project.version - filesMatching("fabric.mod.json") { - expand "version": project.version - } + filesMatching("fabric.mod.json") { + expand "version": project.version + } } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { - withSourcesJar() + // 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 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { - from "LICENSE" + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}"} + } } -loom { - mixin { - defaultRefmapName = actualmodid + ".refmap.json" +// configure the maven publication +publishing { + publications { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name + from components.java + } } -} -apply from: 'mcreator.gradle' \ No newline at end of file + // 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 index 6456ddc..31b44f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,17 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true -actualmodid=potatoesAreBetterThanEggs \ No newline at end of file + +# Fabric Properties +# check these on https://fabricmc.net/develop +minecraft_version=1.21 +yarn_mappings=1.21+build.9 +loader_version=0.15.11 + +# Mod Properties +mod_version=v2.0.0-1.21-fabric +maven_group=net.purejosh.justabaguette +archives_base_name=justabaguette + +# Dependencies +fabric_version=0.100.8+1.21 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a7..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8f5ef1a..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cb..f5feea6 100644 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # 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 +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +85,9 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +134,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + 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. @@ -141,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +205,11 @@ 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, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# 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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ 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. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ 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. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle b/settings.gradle index 2875cde..75c4d72 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,9 +1,10 @@ pluginManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() - } + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } } \ No newline at end of file diff --git a/src/client/java/net/purejosh/justabaguette/JustABaguetteClient.java b/src/client/java/net/purejosh/justabaguette/JustABaguetteClient.java new file mode 100644 index 0000000..2ccc7c9 --- /dev/null +++ b/src/client/java/net/purejosh/justabaguette/JustABaguetteClient.java @@ -0,0 +1,10 @@ +package net.purejosh.justabaguette; + +import net.fabricmc.api.ClientModInitializer; + +public class JustABaguetteClient implements ClientModInitializer { + @Override + public void onInitializeClient() { + // 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/purejosh/justabaguette/mixin/client/ExampleClientMixin.java b/src/client/java/net/purejosh/justabaguette/mixin/client/ExampleClientMixin.java new file mode 100644 index 0000000..1275431 --- /dev/null +++ b/src/client/java/net/purejosh/justabaguette/mixin/client/ExampleClientMixin.java @@ -0,0 +1,15 @@ +package net.purejosh.justabaguette.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 init(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/justabaguette.client.mixins.json b/src/client/resources/justabaguette.client.mixins.json new file mode 100644 index 0000000..aef3bc1 --- /dev/null +++ b/src/client/resources/justabaguette.client.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.purejosh.justabaguette.mixin.client", + "compatibilityLevel": "JAVA_21", + "client": [ + "ExampleClientMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file diff --git a/src/main/java/net/purejosh/justabaguette/ClientInit.java b/src/main/java/net/purejosh/justabaguette/ClientInit.java deleted file mode 100644 index 5882654..0000000 --- a/src/main/java/net/purejosh/justabaguette/ClientInit.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* MCreator note: -* -* If you lock base mod element files, you can edit this file and the proxy files -* and they won't get overwritten. If you change your mod package or modid, you -* need to apply these changes to this file MANUALLY. -* -* -* If you do not lock base mod element files in Workspace settings, this file -* will be REGENERATED on each build. -* -*/ -package net.purejosh.justabaguette; - -import net.fabricmc.api.Environment; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.ClientModInitializer; - -@Environment(EnvType.CLIENT) -public class ClientInit implements ClientModInitializer { - @Override - public void onInitializeClient() { - - } -} diff --git a/src/main/java/net/purejosh/justabaguette/JustABaguette.java b/src/main/java/net/purejosh/justabaguette/JustABaguette.java new file mode 100644 index 0000000..a913ce7 --- /dev/null +++ b/src/main/java/net/purejosh/justabaguette/JustABaguette.java @@ -0,0 +1,23 @@ +package net.purejosh.justabaguette; + +import net.fabricmc.api.ModInitializer; +import net.purejosh.justabaguette.item.ModItemGroups; +import net.purejosh.justabaguette.item.ModItems; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class JustABaguette implements ModInitializer { + public static final String MOD_ID = "justabaguette"; + public static final String MOD_NAME = "Just A Baguette"; + public static final Logger LOGGER = LogManager.getLogger(MOD_ID); + + // This code is executed when the mod is loaded. + @Override + public void onInitialize() { + // This is the log line that gets printed when the mod is loaded. + LOGGER.info(JustABaguette.MOD_NAME + " by purejosh has been loaded!"); + // Now, I call the init methods in the registry classes. + ModItems.init(); + ModItemGroups.init(); + } +} \ No newline at end of file diff --git a/src/main/java/net/purejosh/justabaguette/JustabaguetteMod.java b/src/main/java/net/purejosh/justabaguette/JustabaguetteMod.java deleted file mode 100644 index b90c7a3..0000000 --- a/src/main/java/net/purejosh/justabaguette/JustabaguetteMod.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MCreator note: - * - * If you lock base mod element files, you can edit this file and the proxy files - * and they won't get overwritten. If you change your mod package or modid, you - * need to apply these changes to this file MANUALLY. - * - * - * If you do not lock base mod element files in Workspace settings, this file - * will be REGENERATED on each build. - * - */ -package net.purejosh.justabaguette; - -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; - -import net.purejosh.justabaguette.init.JustabaguetteModItems; - -import net.fabricmc.api.ModInitializer; - -public class JustabaguetteMod implements ModInitializer { - public static final Logger LOGGER = LogManager.getLogger(); - public static final String MODID = "justabaguette"; - - @Override - public void onInitialize() { - LOGGER.info("Initializing JustabaguetteMod"); - - JustabaguetteModItems.load(); - - } -} diff --git a/src/main/java/net/purejosh/justabaguette/component/type/ModFoodComponents.java b/src/main/java/net/purejosh/justabaguette/component/type/ModFoodComponents.java new file mode 100644 index 0000000..991f531 --- /dev/null +++ b/src/main/java/net/purejosh/justabaguette/component/type/ModFoodComponents.java @@ -0,0 +1,10 @@ +package net.purejosh.justabaguette.component.type; + +import net.minecraft.component.type.FoodComponent; + +public class ModFoodComponents { + public static final FoodComponent BAGUETTE = new FoodComponent.Builder() + .nutrition(15) + .saturationModifier(0.6f) + .build(); +} \ No newline at end of file diff --git a/src/main/java/net/purejosh/justabaguette/init/JustabaguetteModItems.java b/src/main/java/net/purejosh/justabaguette/init/JustabaguetteModItems.java deleted file mode 100644 index 34542ee..0000000 --- a/src/main/java/net/purejosh/justabaguette/init/JustabaguetteModItems.java +++ /dev/null @@ -1,21 +0,0 @@ - -/* - * MCreator note: This file will be REGENERATED on each build. - */ -package net.purejosh.justabaguette.init; - -import net.purejosh.justabaguette.item.BaguetteItem; -import net.purejosh.justabaguette.JustabaguetteMod; - -import net.minecraft.world.item.Item; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.Registry; - -public class JustabaguetteModItems { - public static Item BAGUETTE; - - public static void load() { - BAGUETTE = Registry.register(BuiltInRegistries.ITEM, new ResourceLocation(JustabaguetteMod.MODID, "baguette"), new BaguetteItem()); - } -} diff --git a/src/main/java/net/purejosh/justabaguette/item/BaguetteItem.java b/src/main/java/net/purejosh/justabaguette/item/BaguetteItem.java deleted file mode 100644 index 23f09b3..0000000 --- a/src/main/java/net/purejosh/justabaguette/item/BaguetteItem.java +++ /dev/null @@ -1,24 +0,0 @@ - -package net.purejosh.justabaguette.item; - -import net.minecraft.world.item.Rarity; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.food.FoodProperties; - -import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; - -public class BaguetteItem extends Item { - public BaguetteItem() { - super(new Item.Properties().stacksTo(64).rarity(Rarity.COMMON).food((new FoodProperties.Builder()).nutrition(15).saturationMod(0.6f) - - .build())); - ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FOOD_AND_DRINKS).register(content -> content.accept(this)); - } - - @Override - public int getUseDuration(ItemStack itemstack) { - return 60; - } -} diff --git a/src/main/java/net/purejosh/justabaguette/item/ModItemGroups.java b/src/main/java/net/purejosh/justabaguette/item/ModItemGroups.java new file mode 100644 index 0000000..e0ab038 --- /dev/null +++ b/src/main/java/net/purejosh/justabaguette/item/ModItemGroups.java @@ -0,0 +1,14 @@ +package net.purejosh.justabaguette.item; + +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.Items; + +public class ModItemGroups { + + public static void init() { + // ModItems sorting + ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register((itemGroup) -> itemGroup.addAfter( + Items.BREAD.getDefaultStack(), ModItems.BAGUETTE.getDefaultStack())); + } +} diff --git a/src/main/java/net/purejosh/justabaguette/item/ModItems.java b/src/main/java/net/purejosh/justabaguette/item/ModItems.java new file mode 100644 index 0000000..31f45c3 --- /dev/null +++ b/src/main/java/net/purejosh/justabaguette/item/ModItems.java @@ -0,0 +1,23 @@ +package net.purejosh.justabaguette.item; + +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; +import net.purejosh.justabaguette.JustABaguette; +import net.purejosh.justabaguette.component.type.ModFoodComponents; + +public class ModItems { + + public static final Item BAGUETTE = register("baguette", new Item(new Item.Settings() + .food(ModFoodComponents.BAGUETTE))); + + // Helper method for registering an item. + public static Item register(String id, Item item) { + return Registry.register(Registries.ITEM, Identifier.of(JustABaguette.MOD_ID, id), item); + } + + // Class initializer called from the entrypoint. + public static void init() { + } +} diff --git a/src/main/java/net/purejosh/justabaguette/mixin/ExampleMixin.java b/src/main/java/net/purejosh/justabaguette/mixin/ExampleMixin.java new file mode 100644 index 0000000..0401e20 --- /dev/null +++ b/src/main/java/net/purejosh/justabaguette/mixin/ExampleMixin.java @@ -0,0 +1,15 @@ +package net.purejosh.justabaguette.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/java/net/purejosh/justabaguette/mixins/JustabaguetteModRepairItemRecipeMixin.java b/src/main/java/net/purejosh/justabaguette/mixins/JustabaguetteModRepairItemRecipeMixin.java deleted file mode 100644 index dd0676a..0000000 --- a/src/main/java/net/purejosh/justabaguette/mixins/JustabaguetteModRepairItemRecipeMixin.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.purejosh.justabaguette.mixins; - -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.Mixin; - -import net.minecraft.world.item.crafting.RepairItemRecipe; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.inventory.CraftingContainer; -import net.minecraft.core.RegistryAccess; - -import java.util.ArrayList; - -import com.google.common.collect.Lists; - -@Mixin(RepairItemRecipe.class) -public abstract class JustabaguetteModRepairItemRecipeMixin { - @Inject(method = "assemble", at = @At("HEAD"), cancellable = true) - public void assemble(CraftingContainer craftingContainer, RegistryAccess registryAccess, CallbackInfoReturnable cir) { - ItemStack itemStack3; - ItemStack itemStack; - ArrayList list = Lists.newArrayList(); - for (int i = 0; i < craftingContainer.getContainerSize(); ++i) { - ItemStack itemStack2; - itemStack = craftingContainer.getItem(i); - if (itemStack.isEmpty()) - continue; - list.add(itemStack); - } - } -} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml deleted file mode 100644 index 4ee6e1b..0000000 --- a/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,24 +0,0 @@ -modLoader="javafml" -loaderVersion="[45,)" -license="Custom license" - -[[mods]] -modId="justabaguette" -version="1.0.0" -displayName="Just A Baguette" -credits="Made by purejosh" -displayURL="https://legacy.curseforge.com/minecraft/mc-mods/just-a-baguette-fabric-forge" -logoFile="logo.png" -authors="purejosh" -description="Adds just one item to the game: A Baguette." - -[[dependencies.justabaguette]] - modId="minecraft" - mandatory=true - versionRange="[1.19.4]" - ordering="NONE" - side="BOTH" - - - - diff --git a/src/main/resources/assets/justabaguette/icon.png b/src/main/resources/assets/justabaguette/icon.png index d050c52..09638f0 100644 Binary files a/src/main/resources/assets/justabaguette/icon.png and b/src/main/resources/assets/justabaguette/icon.png differ diff --git a/src/main/resources/assets/justabaguette/lang/en_us.json b/src/main/resources/assets/justabaguette/lang/en_us.json index 7e18b3d..d23c00a 100644 --- a/src/main/resources/assets/justabaguette/lang/en_us.json +++ b/src/main/resources/assets/justabaguette/lang/en_us.json @@ -1,5 +1,3 @@ { - "advancements.adv_give_baguette_recipe.title": "Adv Give Baguette Recipe", - "advancements.adv_give_baguette_recipe.descr": "Adv Give Baguette Recipe", "item.justabaguette.baguette": "Baguette" } \ No newline at end of file diff --git a/src/main/resources/assets/justabaguette/textures/baguette_icon.png b/src/main/resources/assets/justabaguette/textures/baguette_icon.png deleted file mode 100644 index d050c52..0000000 Binary files a/src/main/resources/assets/justabaguette/textures/baguette_icon.png and /dev/null differ diff --git a/src/main/resources/data/justabaguette/advancement/recipes/food/baguette.json b/src/main/resources/data/justabaguette/advancement/recipes/food/baguette.json new file mode 100644 index 0000000..56672ee --- /dev/null +++ b/src/main/resources/data/justabaguette/advancement/recipes/food/baguette.json @@ -0,0 +1,26 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bread": { + "conditions": { + "items": [ + { + "items": "minecraft:bread" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_bread" + ] + ], + "rewards": { + "recipes": [ + "justabaguette:baguette", + "justabaguette:baguettes" + ] + } +} \ No newline at end of file diff --git a/src/main/resources/data/justabaguette/advancements/adv_give_baguette_recipe.json b/src/main/resources/data/justabaguette/advancements/adv_give_baguette_recipe.json deleted file mode 100644 index 7787e0f..0000000 --- a/src/main/resources/data/justabaguette/advancements/adv_give_baguette_recipe.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "criteria": { - "adv_give_baguette_recipe": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "items": [ - "minecraft:bread" - ], - "count": { - "min": 1, - "max": 64 - } - } - ] - } - } - }, - "rewards": { - "experience": 0, - "recipes": [ - "justabaguette:craft_baguette", - "justabaguette:craft_baguettes" - ] - } -} \ No newline at end of file diff --git a/src/main/resources/data/justabaguette/recipe/baguette.json b/src/main/resources/data/justabaguette/recipe/baguette.json new file mode 100644 index 0000000..d103fb8 --- /dev/null +++ b/src/main/resources/data/justabaguette/recipe/baguette.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + " #", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:bread" + } + }, + "result": { + "id": "justabaguette:baguette", + "count": 1 + } +} diff --git a/src/main/resources/data/justabaguette/recipe/baguettes.json b/src/main/resources/data/justabaguette/recipe/baguettes.json new file mode 100644 index 0000000..caad5c2 --- /dev/null +++ b/src/main/resources/data/justabaguette/recipe/baguettes.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + " #", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:hay_block" + } + }, + "result": { + "id": "justabaguette:baguette", + "count": 3 + } +} diff --git a/src/main/resources/data/justabaguette/recipes/craft_baguette.json b/src/main/resources/data/justabaguette/recipes/craft_baguette.json deleted file mode 100644 index 9c8ac44..0000000 --- a/src/main/resources/data/justabaguette/recipes/craft_baguette.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "pattern": [ - " 2", - " 4 ", - "6 " - ], - "key": { - "2": { - "item": "minecraft:bread" - }, - "4": { - "item": "minecraft:bread" - }, - "6": { - "item": "minecraft:bread" - } - }, - "result": { - "item": "justabaguette:baguette", - "count": 1 - } -} \ No newline at end of file diff --git a/src/main/resources/data/justabaguette/recipes/craft_baguettes.json b/src/main/resources/data/justabaguette/recipes/craft_baguettes.json deleted file mode 100644 index 6bef59d..0000000 --- a/src/main/resources/data/justabaguette/recipes/craft_baguettes.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "pattern": [ - " 2", - " 4 ", - "6 " - ], - "key": { - "2": { - "item": "minecraft:hay_block" - }, - "4": { - "item": "minecraft:hay_block" - }, - "6": { - "item": "minecraft:hay_block" - } - }, - "result": { - "item": "justabaguette:baguette", - "count": 3 - } -} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7f6bed8..1dd96da 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,34 +1,42 @@ { - "schemaVersion": 1, - "id": "justabaguette", - "version": "1.0.1", - "name": "Just A Baguette", - "description": "Adds just one item to the game: A Baguette.", - "authors": [ - "purejosh" - ], - "contact": { - "homepage": "https://legacy.curseforge.com/minecraft/mc-mods/just-a-baguette-fabric-forge", - "sources": "" - }, - "license": "Custom license", - "icon": "assets/justabaguette/icon.png", - "environment": "*", - "entrypoints": { - "main": [ - "net.purejosh.justabaguette.JustabaguetteMod" - ], - "client": [ - "net.purejosh.justabaguette.ClientInit" - ] - }, - "depends": { - "fabricloader": ">=0.14.21", - "fabric": "*", - "minecraft": "~1.20", - "java": ">=17" - }, - "mixins": [ - "justabaguette.mixins.json" - ] + "schemaVersion": 1, + "id": "justabaguette", + "version": "v2.0.0", + "name": "Just A Baguette", + "description": "Adds just one item to the game: A Baguette.", + "authors": [ + "purejosh" + ], + "contact": { + "homepage": "https://www.curseforge.com/minecraft/mc-mods/justabaguette", + "sources": "https://github.com/purejosh/justabaguette", + "issues": "https://github.com/purejosh/justabaguette/issues" + }, + "license": "MIT-R-NR", + "icon": "assets/justabaguette/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "net.purejosh.justabaguette.JustABaguette" + ], + "client": [ + "net.purejosh.justabaguette.JustABaguetteClient" + ] + }, + "mixins": [ + "justabaguette.mixins.json", + { + "config": "justabaguette.client.mixins.json", + "environment": "client" + } + ], + "depends": { + "fabricloader": ">=0.15.11", + "minecraft": "~1.21", + "java": ">=21", + "fabric-api": "*" + }, + "suggests": { + "another-mod": "*" + } } \ No newline at end of file diff --git a/src/main/resources/justabaguette.mixins.json b/src/main/resources/justabaguette.mixins.json index f3d708d..cb53ce0 100644 --- a/src/main/resources/justabaguette.mixins.json +++ b/src/main/resources/justabaguette.mixins.json @@ -1,11 +1,11 @@ { - "required": true, - "minVersion": "0.8", - "package": "net.purejosh.justabaguette.mixins", - "compatibilityLevel": "JAVA_17", - "mixins": [ - "JustabaguetteModRepairItemRecipeMixin" ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "package": "net.purejosh.justabaguette.mixin", + "compatibilityLevel": "JAVA_21", + "mixins": [ + "ExampleMixin" + ], + "injectors": { + "defaultRequire": 1 + } } \ No newline at end of file diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png deleted file mode 100644 index d050c52..0000000 Binary files a/src/main/resources/logo.png and /dev/null differ diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta deleted file mode 100644 index d6ccb78..0000000 --- a/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 15, - "description": "justabaguette resources" - } -} \ No newline at end of file