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 new file mode 100644 index 0000000..c476faf --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# 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 diff --git a/LICENSE b/LICENSE index 38d9876..6983092 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ -Copyright 2022 JSJBDEV +Copyright 2024 Acrogenous/JSJBDEV -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 8ccbe4c..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Give Me Hats! -A hat mod for fabric and forge -requires trinkets for fabric -And curios for forge diff --git a/build.gradle b/build.gradle index aa1c0d0..067550f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,15 @@ plugins { - id 'fabric-loom' version '0.11-SNAPSHOT' + id 'fabric-loom' version '1.5-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name 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 @@ -22,7 +22,7 @@ repositories { } maven { name = "Ladysnake Libs" - url = "https://ladysnake.jfrog.io/artifactory/mods" + url = 'https://maven.ladysnake.org/releases' } } @@ -31,10 +31,17 @@ dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation "dev.emi:trinkets:${project.trinkets_version}" + modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}") + modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}") // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation "dev.emi:trinkets:3.3.0" + + // 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 { @@ -46,7 +53,6 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. it.options.release = 17 } @@ -55,11 +61,14 @@ java { // 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.archivesBaseName}"} + rename { "${it}_${project.base.archivesName.get()}"} } } @@ -78,4 +87,4 @@ publishing { // 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 11d8f8d..b26dc7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,19 @@ # 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.18.2 - yarn_mappings=1.18.2+build.1 - loader_version=0.13.3 +# check these on https://fabricmc.net/develop +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.15.7 # Mod Properties - mod_version = 2.0.0 - maven_group = gd.rf.acro - archives_base_name = GiveMeHats +mod_version=3.0.1 +maven_group=gd.rf.acro.givemehats +archives_base_name=givemehats # Dependencies - fabric_version=0.47.8+1.18.2 +fabric_version=0.92.0+1.20.1 +cca_version=5.2.2 +trinkets_version=3.7.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f3d88b1..d64cd49 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 a4b4429..1af9e09 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-6.3-bin.zip +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 index c53aefa..1aa94a4 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions $var, ${var}, ${var:-default}, ${var+SET}, -# ${var#prefix}, ${var%suffix}, and $( cmd ); -# * compound commands having a testable exit status, especially case; -# * various built-in commands including command, set, and ulimit. +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# 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/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# 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"' +# 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 @@ -133,22 +131,29 @@ 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. 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 @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# 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. + +# 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" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/oldDescription.md b/oldDescription.md deleted file mode 100644 index 12ed76a..0000000 --- a/oldDescription.md +++ /dev/null @@ -1,133 +0,0 @@ -  - - - -  - -GIVE ME HATS! - -A hat mod that adds hats that appear in dungeon chests and may drop from some armoured mobs (may be fixed in future, but wasn't that good) - -This mod requires Trinkets, the hats go in the "mask" slot (or the Hat slot from 1.17+) - -  - -Hats: - -Sailor: makes you go faster in a boat - -Slime: makes you bounce on landing - -Bowler: makes you walk faster - -Cowboy: Makes you travel faster on a horse - -Santa: frost walker but more consistent - -Floating: A slow fall hat - -Bunny ears: jump boost - -Deerstalker hat: makes mobs nearby glow when sneaking (Flappy_McChicken) - -cat ears: scares creepers when sneaking (UwU) - -fox ears: freezes animals when sneaking (Fox!) - -electric mouse ears: drops lightning bolts randomly when sneaking IN RAIN  UPDATED: drops a lighting bolt when attacking any mob in rain! (secrettrainer472) - -russian hat: removes status effects if you have more than one - -Dome of the Strider: fire resistance, nice. (Nam Etag fabric discord) - -Woolrus Hat: Dolphins Grace and Nightvision whilst swimming (N/A) - -Space Helmet: Supplies oxygen to the wearer, even underwater! (Psylent) - -leprechaun hat: grants the user some luck after sneaking (only works on fishing though) (TheIrishStud) - -Golem Bucket: on hitting an entity they get thrown upward (Sheepking186) - -Wolf Ears: hitting a sheep shears it (Alphie_U on Twitch) - -Jotaro hat: gives enemies weakness when hit (although I want it to make it so enemies dont have Iframes) (me lol) - -Witches Brim: has a chance to give slowness, mining fatigue or poison on punching an enemy (quite a few people suggested this) - -dwarven helm: gives hast 3 when below y=20 (GasStationGuy but also likely others) - -viking helmet: gives night vision in boats and strength in rain (GasStationGuy but also likely others) - -  - -Top Hat, Tippity-Top Tophat, lil tater, Fez and crown: Aesthetic only....currently - -  - -I need more hat ideas! you can suggest a hat and an ability if necessary here: - -  - -If you want to disable individual hats try disabling them just from the loot tables first, if that doesn't work you can use the second disable option but you will have to write your own data pack entry for trinkets to enable the hats as hats, if I have time I will find a better solution for this - -  - -As of version 1.4 you can edit the weights of the hats in loot chests. This means you can now disable a hat by setting its weight to 0, or make some hats more rare/common and all hats more or less common :D - -  - -As of 1.6.6, you can completely disable hats, 1 means enabled, anything else means disabled: - -enable_bowlerhat=1 -enable_tophat=1 -enable_topesthat=1 -enable_bunnyears=1 -enable_bunnyspacehelmet=1 -enable_catears=1 -enable_cowboyhat=1 -enable_crown=1 -enable_deerstalkerhat=1 -enable_electricmouseears=1 -enable_fez=1 -enable_floatinghat=1 -enable_foxears=1 -enable_irishhat=1 -enable_russianhat=1 -enable_sailorhat=1 -enable_santahat=1 -enable_slimehat=1 -enable_striderhat=1 -enable_taterhat=1 -enable_woolrushat=1 -enable_witchhat=1 -enable_jojohat=1 -enable_wolfears=1 -enable_golembucket=1 - -enable_vikinghat=1 - -enable_dwarvenhat=1 - -  - -  - -  - -You can help translating hat names, if applicable on Github in sources - -CURRENT LANGUAGES: - -English (en_us) - me - -Chinese (zh_cn) - qsefthuopq - -Russian (ru_ru) - OneGameKoTT - -Ukraine (uk_ua) - OneGameKoTT - -  - -Please don't repost this mod anywhere without my explicit permission - -You can buy me a coffee here! diff --git a/settings.gradle b/settings.gradle index 5b60df3..75c4d72 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,10 @@ pluginManagement { - repositories { - jcenter() - 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/main/java/gd/rf/acro/givemehats/GiveMeHats.java b/src/main/java/gd/rf/acro/givemehats/GiveMeHats.java index 4ac1084..2ed33e4 100644 --- a/src/main/java/gd/rf/acro/givemehats/GiveMeHats.java +++ b/src/main/java/gd/rf/acro/givemehats/GiveMeHats.java @@ -4,34 +4,41 @@ import dev.emi.trinkets.api.client.TrinketRendererRegistry; import gd.rf.acro.givemehats.items.*; import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.LivingEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.math.Vec3f; -import net.minecraft.util.registry.Registry; -import org.spongepowered.asm.mixin.Mixins; +import net.minecraft.util.math.RotationAxis; import java.util.ArrayList; import java.util.List; public class GiveMeHats implements ModInitializer { - public static final ItemGroup TAB = FabricItemGroupBuilder.build( - new Identifier("givemehats", "hats_tab"), - () -> new ItemStack(GiveMeHats.BOWLER_HAT_ITEM)); + + public static final ItemGroup TAB = FabricItemGroup.builder() + .icon(() -> new ItemStack(GiveMeHats.BOWLER_HAT_ITEM)) + .displayName(Text.of("GiveMeHats")) + .build(); + + @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. + Registry.register(Registries.ITEM_GROUP, new Identifier("givemehats", "tab"), TAB); ConfigUtils.checkConfigs(); genHatsList(); registerItems(); @@ -42,35 +49,36 @@ public void onInitialize() { } - public static final BowlerHatItem BOWLER_HAT_ITEM = new BowlerHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final BunnyEarsItem BUNNY_EARS_ITEM = new BunnyEarsItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final SantaHatItem SANTAR_HAT_ITEM = new SantaHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final SlimeHatItem SLIME_HAT_ITEM = new SlimeHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final CowboyHatItem COWBOY_HAT_ITEM = new CowboyHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final SailorHatItem SAILOR_HAT_ITEM = new SailorHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final FloatingHatItem FLOATING_HAT_ITEM = new FloatingHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final TopHatItem TOP_HAT_ITEM = new TopHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final TopestHatItem TOPEST_HAT_ITEM = new TopestHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final FezHatItem FEZ_HAT_ITEM = new FezHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final DeerStalkerHatItem DEER_STALKER_HAT_ITEM = new DeerStalkerHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final CatEarsItem CAT_EARS_HAT_ITEM = new CatEarsItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final FoxEarsItem FOX_EARS_HAT_ITEM = new FoxEarsItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final ElectricMouseEarsItem ELECTRIC_MOUSE_EARS_HAT_ITEM = new ElectricMouseEarsItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final CrownItem CROWN_ITEM = new CrownItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final RussianHatItem RUSSIAN_HAT_ITEM = new RussianHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final StriderHatItem STRIDER_HAT_ITEM = new StriderHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final WoolrusHatItem WOOLRUS_HAT_ITEM = new WoolrusHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final TaterHatItem LIL_TATER_HAT_ITEM = new TaterHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final BunnySpaceHelmet BUNNY_SPACE_HELMET = new BunnySpaceHelmet(new Item.Settings().group(GiveMeHats.TAB)); - public static final IrishHatItem IRISH_HAT_ITEM = new IrishHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final GolemBucketItem GOLEM_BUCKET_ITEM = new GolemBucketItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final JojoHatItem JOJO_HAT_ITEM = new JojoHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final WolfEarsItem WOLF_EARS_ITEM = new WolfEarsItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final WitchHatItem WITCH_HAT_ITEM = new WitchHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final VikingHatItem VIKING_HAT_ITEM = new VikingHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final DwarvenHatItem DWARVEN_HAT_ITEM = new DwarvenHatItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final HippieVibesItem HIPPIE_VIBES_ITEM = new HippieVibesItem(new Item.Settings().group(GiveMeHats.TAB)); - public static final HaloItem HALO_ITEM = new HaloItem(new Item.Settings().group(GiveMeHats.TAB)); + + public static final BowlerHatItem BOWLER_HAT_ITEM = new BowlerHatItem(new Item.Settings()); + public static final BunnyEarsItem BUNNY_EARS_ITEM = new BunnyEarsItem(new FabricItemSettings()); + public static final SantaHatItem SANTAR_HAT_ITEM = new SantaHatItem(new Item.Settings()); + public static final SlimeHatItem SLIME_HAT_ITEM = new SlimeHatItem(new Item.Settings()); + public static final CowboyHatItem COWBOY_HAT_ITEM = new CowboyHatItem(new Item.Settings()); + public static final SailorHatItem SAILOR_HAT_ITEM = new SailorHatItem(new Item.Settings()); + public static final FloatingHatItem FLOATING_HAT_ITEM = new FloatingHatItem(new Item.Settings()); + public static final TopHatItem TOP_HAT_ITEM = new TopHatItem(new Item.Settings()); + public static final TopestHatItem TOPEST_HAT_ITEM = new TopestHatItem(new Item.Settings()); + public static final FezHatItem FEZ_HAT_ITEM = new FezHatItem(new Item.Settings()); + public static final DeerStalkerHatItem DEER_STALKER_HAT_ITEM = new DeerStalkerHatItem(new Item.Settings()); + public static final CatEarsItem CAT_EARS_HAT_ITEM = new CatEarsItem(new Item.Settings()); + public static final FoxEarsItem FOX_EARS_HAT_ITEM = new FoxEarsItem(new Item.Settings()); + public static final ElectricMouseEarsItem ELECTRIC_MOUSE_EARS_HAT_ITEM = new ElectricMouseEarsItem(new Item.Settings()); + public static final CrownItem CROWN_ITEM = new CrownItem(new Item.Settings()); + public static final RussianHatItem RUSSIAN_HAT_ITEM = new RussianHatItem(new Item.Settings()); + public static final StriderHatItem STRIDER_HAT_ITEM = new StriderHatItem(new Item.Settings()); + public static final WoolrusHatItem WOOLRUS_HAT_ITEM = new WoolrusHatItem(new Item.Settings()); + public static final TaterHatItem LIL_TATER_HAT_ITEM = new TaterHatItem(new Item.Settings()); + public static final BunnySpaceHelmet BUNNY_SPACE_HELMET = new BunnySpaceHelmet(new Item.Settings()); + public static final IrishHatItem IRISH_HAT_ITEM = new IrishHatItem(new Item.Settings()); + public static final GolemBucketItem GOLEM_BUCKET_ITEM = new GolemBucketItem(new Item.Settings()); + public static final JojoHatItem JOJO_HAT_ITEM = new JojoHatItem(new Item.Settings()); + public static final WolfEarsItem WOLF_EARS_ITEM = new WolfEarsItem(new Item.Settings()); + public static final WitchHatItem WITCH_HAT_ITEM = new WitchHatItem(new Item.Settings()); + public static final VikingHatItem VIKING_HAT_ITEM = new VikingHatItem(new Item.Settings()); + public static final DwarvenHatItem DWARVEN_HAT_ITEM = new DwarvenHatItem(new Item.Settings()); + public static final HippieVibesItem HIPPIE_VIBES_ITEM = new HippieVibesItem(new Item.Settings()); + public static final HaloItem HALO_ITEM = new HaloItem(new Item.Settings()); public static List LOADED_HATS; public static void genHatsList() @@ -149,7 +157,10 @@ private void registerItems() for(Item hat: LOADED_HATS) { - Registry.register(Registry.ITEM, new Identifier("givemehats",cc2uc(hat.getClass().getSimpleName().replace("Item",""))), hat); + Registry.register(Registries.ITEM,new Identifier("givemehats",cc2uc(hat.getClass().getSimpleName().replace("Item",""))),hat); + ItemGroupEvents.modifyEntriesEvent(Registries.ITEM_GROUP.getKey(TAB).get()).register(content -> { + content.add(hat); + }); TrinketRendererRegistry.registerRenderer(hat, (TrinketRenderer) hat); } @@ -163,17 +174,17 @@ public static void translateToFace(MatrixStack matrices, EntityModel ctx = (PlayerEntityModel) model; - matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(ctx.head.roll)); + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(ctx.head.roll)); } - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(headYaw)); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-45.0F)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(headYaw)); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-45.0F)); } else { if (entity.isInSneakingPose() && !model.riding) { matrices.translate(0.0F, 0.25F, 0.0F); } - matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(headYaw)); - matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(headPitch)); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(headYaw)); + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(headPitch)); } matrices.translate(0.0F, -0.25F, -0.3F); } diff --git a/src/main/java/gd/rf/acro/givemehats/items/BowlerHatItem.java b/src/main/java/gd/rf/acro/givemehats/items/BowlerHatItem.java index 797bf8f..8b5fda1 100644 --- a/src/main/java/gd/rf/acro/givemehats/items/BowlerHatItem.java +++ b/src/main/java/gd/rf/acro/givemehats/items/BowlerHatItem.java @@ -12,7 +12,9 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; @@ -20,7 +22,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; +import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.world.World; import java.util.List; @@ -37,7 +39,7 @@ public BowlerHatItem(Item.Settings settings) { @Override public void appendTooltip(ItemStack stack, World world, List tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.bowler_hat")); + tooltip.add(Text.translatable("text.bowler_hat")); } @@ -64,6 +66,7 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.bunny_ears")); + tooltip.add(Text.translatable("text.bunny_ears")); } @@ -53,6 +52,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.bunny_ears")); + tooltip.add(Text.translatable("text.bunny_ears")); } @@ -47,12 +47,13 @@ public void tick(ItemStack stack, SlotReference slot, LivingEntity entity) { } } + @Override - public void render(ItemStack stack, SlotReference slotReference, EntityModel contextModel, MatrixStack matrixStack, VertexConsumerProvider vertexConsumers, int light, LivingEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) { + public void render(ItemStack stack, SlotReference slotReference, net.minecraft.client.render.entity.model.EntityModel contextModel, MatrixStack matrixStack, net.minecraft.client.render.VertexConsumerProvider vertexConsumers, int light, LivingEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) { ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer(); GiveMeHats.translateToFace(matrixStack,contextModel,entity,headYaw,headPitch); matrixStack.scale(-1f,-1f,1f); matrixStack.translate(0,0.7,0.3f); - itemRenderer.renderItem(stack, ModelTransformation.Mode.FIXED,light, OverlayTexture.DEFAULT_UV,matrixStack,vertexConsumers,0); + itemRenderer.renderItem(entity,stack,ModelTransformationMode.FIXED,false,matrixStack,vertexConsumers,entity.getWorld(),light,OverlayTexture.DEFAULT_UV,0); } } diff --git a/src/main/java/gd/rf/acro/givemehats/items/BunnySpaceHelmet.java b/src/main/java/gd/rf/acro/givemehats/items/BunnySpaceHelmet.java index d9ffa16..bc618a3 100644 --- a/src/main/java/gd/rf/acro/givemehats/items/BunnySpaceHelmet.java +++ b/src/main/java/gd/rf/acro/givemehats/items/BunnySpaceHelmet.java @@ -11,11 +11,12 @@ import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.json.ModelTransformation; + import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; +import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.world.World; import java.util.List; @@ -31,7 +32,7 @@ public BunnySpaceHelmet(Settings settings) { @Override public void appendTooltip(ItemStack stack, World world, List tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.space_helmet")); + tooltip.add(Text.translatable("text.space_helmet")); } @Override @@ -49,6 +50,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.cat_ears")); + tooltip.add(Text.translatable("text.cat_ears")); } @@ -61,6 +61,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.cat_ears")); + tooltip.add(Text.translatable("text.cat_ears")); } @@ -61,6 +61,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.cowboy_hat")); + tooltip.add(Text.translatable("text.cowboy_hat")); } @@ -56,6 +56,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.crown")); + tooltip.add(Text.translatable("text.crown")); } @@ -45,6 +45,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.deerstalkerhat")); + tooltip.add(Text.translatable("text.deerstalkerhat")); } @@ -58,6 +58,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.dwarven_hat")); + tooltip.add(Text.translatable("text.dwarven_hat")); } @@ -56,6 +56,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.emousehat")); + tooltip.add(Text.translatable("text.emousehat")); } @@ -54,6 +54,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.emousehat")); + tooltip.add(Text.translatable("text.emousehat")); } @@ -54,6 +54,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.fez")); + tooltip.add(Text.translatable("text.fez")); } @@ -46,6 +46,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.floatinghat")); + tooltip.add(Text.translatable("text.floatinghat")); } @@ -53,6 +53,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.foxears")); + tooltip.add(Text.translatable("text.foxears")); } @@ -59,6 +59,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.foxears")); + tooltip.add(Text.translatable("text.foxears")); } @@ -59,6 +59,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.golembucket")); + tooltip.add(Text.translatable("text.golembucket")); } @@ -50,6 +50,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.halo")); + tooltip.add(Text.translatable("text.halo")); } @@ -44,6 +44,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.hippie_vibes")); + tooltip.add(Text.translatable("text.hippie_vibes")); } @Override @@ -54,6 +54,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.irishhat")); + tooltip.add(Text.translatable("text.irishhat")); } @@ -55,6 +55,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.jojohat")); + tooltip.add(Text.translatable("text.jojohat")); } @@ -48,6 +48,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.taterhat")); + tooltip.add(Text.translatable("text.taterhat")); } @@ -45,6 +45,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.russianhat")); + tooltip.add(Text.translatable("text.russianhat")); } @@ -52,6 +52,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.sailorhat")); + tooltip.add(Text.translatable("text.sailorhat")); } @@ -43,7 +43,7 @@ public void appendTooltip(ItemStack stack, World world, List tooltip, Tool public void tick(ItemStack stack, SlotReference slot, LivingEntity entity) { if(entity.hasVehicle() && entity.getVehicle().getType()==EntityType.BOAT - && entity.world.getBlockState(entity.getBlockPos().down()).getBlock()== Blocks.WATER + && entity.getWorld().getBlockState(entity.getBlockPos().down()).getBlock()== Blocks.WATER && entity.getVehicle().getVelocity().getX()<3 && entity.getVehicle().getVelocity().getZ()<3) { @@ -57,6 +57,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.santahat")); + tooltip.add(Text.translatable("text.santahat")); } @@ -52,6 +52,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.santahat")); + tooltip.add(Text.translatable("text.santahat")); } @@ -52,6 +52,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.slimehat")); + tooltip.add(Text.translatable("text.slimehat")); } @@ -57,6 +57,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.striderhat")); + tooltip.add(Text.translatable("text.striderhat")); } @@ -53,6 +53,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.taterhat")); + tooltip.add(Text.translatable("text.taterhat")); } @@ -45,6 +45,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.tophat")); + tooltip.add(Text.translatable("text.tophat")); } @@ -46,6 +46,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.topesthat")); + tooltip.add(Text.translatable("text.topesthat")); } @@ -48,6 +48,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.viking_hat")); + tooltip.add(Text.translatable("text.viking_hat")); } @@ -43,7 +43,7 @@ public void appendTooltip(ItemStack stack, World world, List tooltip, Tool @Override public void tick(ItemStack stack, SlotReference slot, LivingEntity entity) { - if(entity.world.isRaining() && !entity.hasStatusEffect(StatusEffects.STRENGTH)) + if(entity.getWorld().isRaining() && !entity.hasStatusEffect(StatusEffects.STRENGTH)) { entity.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH,200)); } @@ -59,6 +59,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.witch_hat")); + tooltip.add(Text.translatable("text.witch_hat")); } @@ -51,6 +51,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.wolf_ears")); + tooltip.add(Text.translatable("text.wolf_ears")); } @@ -51,6 +51,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModel tooltip, TooltipContext context) { super.appendTooltip(stack, world, tooltip, context); - tooltip.add(new TranslatableText("text.woolrushat")); + tooltip.add(Text.translatable("text.woolrushat")); } @@ -56,6 +56,6 @@ public void render(ItemStack stack, SlotReference slotReference, EntityModela.isOf(GiveMeHats.GOLEM_BUCKET_ITEM))) { if(RandomUtils.nextInt(0,5)==0) @@ -45,7 +54,7 @@ private void damage(DamageSource source, float amount, CallbackInfoReturnable ci entity.addVelocity(0,1,0); } } - if(component.isEquipped(GiveMeHats.JOJO_HAT_ITEM)) + if(component.isEquipped(a->a.isOf(GiveMeHats.JOJO_HAT_ITEM))) { entity.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS,100)); @@ -53,13 +62,13 @@ private void damage(DamageSource source, float amount, CallbackInfoReturnable ci } - if(component.isEquipped(GiveMeHats.ELECTRIC_MOUSE_EARS_HAT_ITEM) && player.world.isRaining()) + if(component.isEquipped(a->a.isOf(GiveMeHats.ELECTRIC_MOUSE_EARS_HAT_ITEM)) && player.getWorld().isRaining()) { - LightningEntity lightningEntity = new LightningEntity(EntityType.LIGHTNING_BOLT,entity.world); + LightningEntity lightningEntity = new LightningEntity(EntityType.LIGHTNING_BOLT,entity.getWorld()); lightningEntity.teleport(entity.getX(),entity.getY(),entity.getZ()); entity.getEntityWorld().spawnEntity(lightningEntity); } - if(component.isEquipped(GiveMeHats.WOLF_EARS_ITEM)) + if(component.isEquipped(a->a.isOf(GiveMeHats.WOLF_EARS_ITEM))) { if(entity.getType()== EntityType.SHEEP) { @@ -67,23 +76,23 @@ private void damage(DamageSource source, float amount, CallbackInfoReturnable ci sheepEntity.sheared(SoundCategory.PLAYERS); } } - if(component.isEquipped(GiveMeHats.HIPPIE_VIBES_ITEM)) + if(component.isEquipped(a->a.isOf(GiveMeHats.HIPPIE_VIBES_ITEM))) { if(entity.getType()== EntityType.SHEEP) { SheepEntity sheepEntity = (SheepEntity) entity; - sheepEntity.setCustomName(new LiteralText("jeb_")); + sheepEntity.setCustomName(Text.of("jeb_")); } } - if(component.isEquipped(GiveMeHats.HALO_ITEM)) + if(component.isEquipped(a->a.isOf(GiveMeHats.HALO_ITEM))) { if(entity.getGroup().equals(EntityGroup.UNDEAD)) { - entity.damage(DamageSource.player(player),4); + entity.damage(entity.getDamageSources().mobAttack(entity),4); } } - if(component.isEquipped(GiveMeHats.WITCH_HAT_ITEM)) + if(component.isEquipped(a->a.isOf(GiveMeHats.WITCH_HAT_ITEM))) { if(RandomUtils.nextInt(0,5)==0) { diff --git a/src/main/java/gd/rf/acro/givemehats/mixin/LootMixin.java b/src/main/java/gd/rf/acro/givemehats/mixin/LootMixin.java index 382e098..4561c09 100644 --- a/src/main/java/gd/rf/acro/givemehats/mixin/LootMixin.java +++ b/src/main/java/gd/rf/acro/givemehats/mixin/LootMixin.java @@ -13,6 +13,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import org.apache.commons.lang3.RandomUtils; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -21,7 +22,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.Random; @Mixin(LootableContainerBlockEntity.class) public abstract class LootMixin extends LockableContainerBlockEntity { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index dbf6856..89746b0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,38 +1,34 @@ { - "schemaVersion": 1, - "id": "givemehats", - "version": "${version}", - - "name": "Give Me Hats!", - "description": "A hat mod for fabric", - "authors": [ - "Acro" - ], - "contact": { - "homepage": "http://acro.rf.gd", - "sources": "https://github.com/JSJBDEV/GiveMeHats" - }, - - "license": "MIT", - "icon": "assets/givemehats/icon.jpg", - - "environment": "*", - "entrypoints": { - "main": [ - "gd.rf.acro.givemehats.GiveMeHats" - ] - }, - "mixins": [ - "gmh.mixins.json" - ], - - "depends": { - "fabricloader": ">=0.13.3", - "fabric": "*", - "minecraft": "~1.18.2", - "java": ">=17" - }, - "suggests": { - "flamingo": "*" - } -} + "schemaVersion": 1, + "id": "givemehats", + "version": "${version}", + "name": "GiveMehats", + "description": "Hats with effects!", + "authors": [ + "Acrogenous" + ], + "contact": { + "homepage": "https://fabricmc.net/", + "sources": "https://github.com/FabricMC/fabric-example-mod" + }, + "license": "MIT", + "icon": "assets/givemehats/icon.jpg", + "environment": "*", + "entrypoints": { + "main": [ + "gd.rf.acro.givemehats.GiveMeHats" + ] + }, + "mixins": [ + "givemehats.mixins.json" + ], + "depends": { + "fabricloader": ">=0.15.7", + "minecraft": "~1.20.1", + "java": ">=17", + "fabric-api": "*" + }, + "suggests": { + "another-mod": "*" + } +} \ No newline at end of file diff --git a/src/main/resources/givemehats.mixins.json b/src/main/resources/givemehats.mixins.json new file mode 100644 index 0000000..53115fa --- /dev/null +++ b/src/main/resources/givemehats.mixins.json @@ -0,0 +1,12 @@ +{ + "required": true, + "package": "gd.rf.acro.givemehats.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "AttackMixin", + "LootMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/gmh.mixins.json b/src/main/resources/gmh.mixins.json deleted file mode 100644 index 5b7176c..0000000 --- a/src/main/resources/gmh.mixins.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "gd.rf.acro.givemehats.mixin", - "compatibilityLevel": "JAVA_16", - "mixins": [ - "AttackMixin", - "LootMixin" - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -}