diff --git a/build.gradle b/build.gradle index 50916c6..4fe8aec 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ import net.fabricmc.loom.task.RemapJarTask plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' - id 'io.github.ladysnake.chenille' version '0.13.0' + id 'fabric-loom' version '1.8-SNAPSHOT' + id 'io.github.ladysnake.chenille' version '0.14.0' } archivesBaseName = project.archives_base_name @@ -27,17 +27,7 @@ chenille { } repositories { - maven { - name = "Ladysnake Mods" - url = "https://maven.ladysnake.org/releases" - content { - includeGroup("io.github.ladysnake") - includeGroup("org.ladysnake") - includeGroupByRegex("dev\\.emi.*") - includeGroupByRegex("dev\\.onyxstudios.*") - } - } - + chenille.repositories.ladysnake() } dependencies { diff --git a/changelog.md b/changelog.md index 0b47b30..66a69cf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +------------------------------------------------------ +Version 1.11.0 +------------------------------------------------------ +- Updated to MC 1.21.3 + ------------------------------------------------------ Version 1.10.0 ------------------------------------------------------ diff --git a/gradle.properties b/gradle.properties index 6da20c8..5ecc222 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx4G # Fabric Properties # check these on https://fabricmc.net/use -minecraft_version=1.21-pre4 -yarn_mappings=1.21-pre4+build.3 -loader_version=0.15.11 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 +loader_version=0.16.7 #Fabric api -fabric_version=0.100.0+1.21 +fabric_version=0.106.1+1.21.3 elmendorf_version = 0.13.0 # Mod Properties -mod_version = 1.10.0 +mod_version = 1.11.0 maven_group = io.github.ladysnake archives_base_name = pal diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..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 b82aa23..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f5feea6 100755 --- 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/. @@ -84,7 +86,8 @@ done # 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 +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 diff --git a/gradlew.bat b/gradlew.bat index 25da30d..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 ########################################################################## diff --git a/src/main/java/io/github/ladysnake/pal/VanillaAbilities.java b/src/main/java/io/github/ladysnake/pal/VanillaAbilities.java index ef1a533..4ed7f37 100644 --- a/src/main/java/io/github/ladysnake/pal/VanillaAbilities.java +++ b/src/main/java/io/github/ladysnake/pal/VanillaAbilities.java @@ -18,8 +18,8 @@ package io.github.ladysnake.pal; import io.github.ladysnake.pal.impl.VanillaAbilityTracker; -import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerAbilities; +import net.minecraft.registry.tag.DamageTypeTags; import net.minecraft.world.GameMode; /** @@ -29,7 +29,7 @@ public final class VanillaAbilities { /** * If enabled, players become invulnerable* to all damage, like in creative and spectator mode. * - *

Note: Damage sources that {@link DamageSource#isOutOfWorld() bypass invulnerability} + *

Note: Damage sources with {@link DamageTypeTags#BYPASSES_INVULNERABILITY} * can still damage players with this ability enabled. * * @see PlayerAbilities#invulnerable diff --git a/src/main/java/io/github/ladysnake/pal/impl/PalInternals.java b/src/main/java/io/github/ladysnake/pal/impl/PalInternals.java index 5c87f70..84b9ab5 100644 --- a/src/main/java/io/github/ladysnake/pal/impl/PalInternals.java +++ b/src/main/java/io/github/ladysnake/pal/impl/PalInternals.java @@ -68,7 +68,7 @@ public static void logTamperWarning(PlayerAbility ability, boolean enabled, bool public static void loadConfig() { Path configFile = FabricLoader.getInstance().getConfigDir().resolve("pal.properties"); Properties props = new Properties(); - props.put("alwaysLogTamperWarnings", "true"); + props.put("alwaysLogTamperWarnings", "false"); if (Files.exists(configFile)) { try (Reader reader = Files.newBufferedReader(configFile)) { diff --git a/src/testmod/java/io/github/ladysnake/paltest/AbilityToggleItem.java b/src/testmod/java/io/github/ladysnake/paltest/AbilityToggleItem.java index 3987408..256d386 100644 --- a/src/testmod/java/io/github/ladysnake/paltest/AbilityToggleItem.java +++ b/src/testmod/java/io/github/ladysnake/paltest/AbilityToggleItem.java @@ -22,13 +22,12 @@ import io.github.ladysnake.pal.PlayerAbility; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; import net.minecraft.util.Formatting; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; -import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; /** @@ -45,7 +44,7 @@ public AbilityToggleItem(Settings settings, PlayerAbility abilityId, Identifier } @Override - public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + public ActionResult use(World world, PlayerEntity user, Hand hand) { if (user instanceof ServerPlayerEntity sp) { if (abilitySource.grants(sp, this.ability)) { // check whether the source is granting the ability abilitySource.revokeFrom(sp, this.ability); // if it is, revoke it @@ -62,6 +61,6 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han .append(ability.isEnabledFor(user) ? Text.literal("enabled").styled(s -> s.withColor(Formatting.GREEN)) : Text.literal("disabled").styled(s -> s.withColor(Formatting.RED))) .append(")"), false); } - return TypedActionResult.success(user.getStackInHand(hand)); + return ActionResult.SUCCESS; } } diff --git a/src/testmod/java/io/github/ladysnake/paltest/BadFlightItem.java b/src/testmod/java/io/github/ladysnake/paltest/BadFlightItem.java index 993cd92..f29d5ef 100644 --- a/src/testmod/java/io/github/ladysnake/paltest/BadFlightItem.java +++ b/src/testmod/java/io/github/ladysnake/paltest/BadFlightItem.java @@ -19,10 +19,9 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; /** @@ -41,7 +40,7 @@ public BadFlightItem(Settings settings) { } @Override - public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + public ActionResult use(World world, PlayerEntity user, Hand hand) { if (!world.isClient) { // Direct ability access, issues abound ! user.getAbilities().allowFlying = !user.getAbilities().allowFlying; @@ -49,7 +48,7 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han user.sendAbilitiesUpdate(); user.sendMessage(Text.literal("Flight " + (user.getAbilities().allowFlying ? "enabled" : "disabled")), true); } - return TypedActionResult.success(user.getStackInHand(hand)); + return ActionResult.SUCCESS; } } diff --git a/src/testmod/java/io/github/ladysnake/paltest/PalTest.java b/src/testmod/java/io/github/ladysnake/paltest/PalTest.java index fe0caf5..b2cdfee 100644 --- a/src/testmod/java/io/github/ladysnake/paltest/PalTest.java +++ b/src/testmod/java/io/github/ladysnake/paltest/PalTest.java @@ -25,13 +25,18 @@ import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectCategory; import net.minecraft.item.ArmorItem; -import net.minecraft.item.ArmorMaterials; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.equipment.ArmorMaterials; +import net.minecraft.item.equipment.EquipmentType; import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; -import net.minecraft.registry.Registry; + +import java.util.function.Function; public final class PalTest implements ModInitializer { @@ -43,14 +48,19 @@ public static Identifier id(String path) { public void onInitialize() { PalTestAbilities.init(); this.registerWaxWings(); - Registry.register(Registries.ITEM, id("bad_charm"), new BadFlightItem(new Item.Settings())); - Registry.register(Registries.ITEM, id("flight_charm"), new AbilityToggleItem(new Item.Settings(), VanillaAbilities.ALLOW_FLYING, id("charm_flight"))); - Registry.register(Registries.ITEM, id("kryptonite"), new AbilityToggleItem(new Item.Settings(), PalTestAbilities.LIMIT_FLIGHT, id("kryptonite"))); + registerItem("bad_charm", BadFlightItem::new); + registerItem("flight_charm", settings -> new AbilityToggleItem(settings, VanillaAbilities.ALLOW_FLYING, id("charm_flight"))); + registerItem("kryptonite", settings -> new AbilityToggleItem(settings, PalTestAbilities.LIMIT_FLIGHT, id("kryptonite"))); Registry.register(Registries.STATUS_EFFECT, id("flight"), new FlightEffect(StatusEffectCategory.BENEFICIAL, 0xFFFFFF)); } + private I registerItem(String id, Function factory) { + Identifier id1 = id(id); + return Registry.register(Registries.ITEM, id1, factory.apply(new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, id1)))); + } + private void registerWaxWings() { - Item waxWings = Registry.register(Registries.ITEM, id("wax_wings"), new ArmorItem(ArmorMaterials.LEATHER, ArmorItem.Type.CHESTPLATE, new Item.Settings())); + Item waxWings = registerItem("wax_wings", settings -> new ArmorItem(ArmorMaterials.LEATHER, EquipmentType.CHESTPLATE, settings)); AbilitySource source = Pal.getAbilitySource(id("wax_wings"), AbilitySource.CONSUMABLE); ServerTickEvents.START_SERVER_TICK.register(server -> { for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) { diff --git a/src/testmod/java/io/github/ladysnake/paltest/mixin/LivingEntityMixin.java b/src/testmod/java/io/github/ladysnake/paltest/mixin/LivingEntityMixin.java index 17f85e9..aaf7296 100644 --- a/src/testmod/java/io/github/ladysnake/paltest/mixin/LivingEntityMixin.java +++ b/src/testmod/java/io/github/ladysnake/paltest/mixin/LivingEntityMixin.java @@ -17,19 +17,20 @@ */ package io.github.ladysnake.paltest.mixin; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import io.github.ladysnake.paltest.FlightEffect; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.attribute.AttributeContainer; +import net.minecraft.entity.effect.StatusEffect; 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(LivingEntity.class) public class LivingEntityMixin { - @Inject(method = "onStatusEffectRemoved", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/effect/StatusEffect;onRemoved(Lnet/minecraft/entity/attribute/AttributeContainer;)V")) - private void callOnRemoved(StatusEffectInstance effect, CallbackInfo ci) { - if (effect.getEffectType() instanceof FlightEffect flightEffect) { + @WrapOperation(method = "onStatusEffectsRemoved", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/effect/StatusEffect;onRemoved(Lnet/minecraft/entity/attribute/AttributeContainer;)V")) + private void callOnRemoved(StatusEffect effect, AttributeContainer attributeContainer, Operation original) { + if (effect instanceof FlightEffect flightEffect) { flightEffect.onRemoved((LivingEntity) (Object) this); } }