Skip to content

Commit

Permalink
Update to 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Oct 26, 2024
1 parent e39db0c commit 792d7c9
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 44 deletions.
16 changes: 3 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
------------------------------------------------------
Version 1.11.0
------------------------------------------------------
- Updated to MC 1.21.3

------------------------------------------------------
Version 1.10.0
------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/ladysnake/pal/VanillaAbilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -29,7 +29,7 @@ public final class VanillaAbilities {
/**
* If enabled, players become invulnerable* to all damage, like in creative and spectator mode.
*
* <p> Note: Damage sources that {@link DamageSource#isOutOfWorld() bypass invulnerability}
* <p> Note: Damage sources with {@link DamageTypeTags#BYPASSES_INVULNERABILITY}
* can still damage players with this ability enabled.
*
* @see PlayerAbilities#invulnerable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -45,7 +44,7 @@ public AbilityToggleItem(Settings settings, PlayerAbility abilityId, Identifier
}

@Override
public TypedActionResult<ItemStack> 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
Expand All @@ -62,6 +61,6 @@ public TypedActionResult<ItemStack> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -41,15 +40,15 @@ public BadFlightItem(Settings settings) {
}

@Override
public TypedActionResult<ItemStack> 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;
user.getAbilities().flying &= user.getAbilities().allowFlying;
user.sendAbilitiesUpdate();
user.sendMessage(Text.literal("Flight " + (user.getAbilities().allowFlying ? "enabled" : "disabled")), true);
}
return TypedActionResult.success(user.getStackInHand(hand));
return ActionResult.SUCCESS;
}

}
22 changes: 16 additions & 6 deletions src/testmod/java/io/github/ladysnake/paltest/PalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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 extends Item> I registerItem(String id, Function<Item.Settings, I> 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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Void> original) {
if (effect instanceof FlightEffect flightEffect) {
flightEffect.onRemoved((LivingEntity) (Object) this);
}
}
Expand Down

0 comments on commit 792d7c9

Please sign in to comment.