Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import net.fabricmc.loom.task.RemapJarTask

plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'io.github.ladysnake.chenille' version '0.14.0'
}

Expand Down
14 changes: 7 additions & 7 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.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
loader_version=0.16.10
#Fabric api
fabric_version=0.106.1+1.21.3
fabric_version=0.119.1+1.21.5

elmendorf_version = 0.13.0
elmendorf_version = 0.15.0

# Mod Properties
mod_version = 1.11.0
mod_version = 1.12.0
maven_group = io.github.ladysnake
archives_base_name = pal

Expand All @@ -22,7 +22,7 @@ display_name = PlayerAbilityLib
license_header = LGPL
gpl_version = 3
curseforge_id = 359522
curseforge_versions = 1.20.6
curseforge_versions = 1.21.5
cf_requirements = fabric-api
modrinth_id = DHQA06r4
release_type = release
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.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/ladysnake/pal/AbilitySource.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/ladysnake/pal/AbilityTracker.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/ladysnake/pal/Pal.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/ladysnake/pal/PlayerAbility.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -19,7 +19,6 @@

import io.github.ladysnake.pal.impl.PalInternals;
import io.github.ladysnake.pal.impl.VanillaAbilityTracker;
import net.fabricmc.fabric.api.util.NbtType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
Expand Down Expand Up @@ -115,9 +114,9 @@ public void save(NbtCompound tag) {

@Override
public void load(NbtCompound tag) {
NbtList list = tag.getList("ability_sources", NbtType.STRING);
NbtList list = tag.getListOrEmpty("ability_sources");
for (int i = 0; i < list.size(); i++) {
AbilitySource source = PalInternals.getSource(Identifier.tryParse(list.getString(i)));
AbilitySource source = list.getString(i).map(x -> PalInternals.getSource(Identifier.tryParse(x))).orElse(null);
if (source != null) {
this.addSource(source);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -24,7 +24,6 @@
import io.github.ladysnake.pal.impl.PalInternals;
import io.github.ladysnake.pal.impl.PlayerAbilityView;
import io.github.ladysnake.pal.impl.VanillaAbilityTracker;
import net.fabricmc.fabric.api.util.NbtType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
Expand Down Expand Up @@ -120,15 +119,16 @@ private void writeAbilitiesToTag(NbtCompound tag, CallbackInfo ci) {
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;readCustomDataFromNbt(Lnet/minecraft/nbt/NbtCompound;)V", shift = At.Shift.AFTER)
)
private void readAbilitiesFromTag(NbtCompound tag, CallbackInfo ci) {
for (NbtElement t : tag.getList("playerabilitylib:abilities", NbtType.COMPOUND)) {
NbtCompound abilityTag = ((NbtCompound) t);
if (abilityTag.contains("ability_id", NbtElement.STRING_TYPE)) {
String abilityId = abilityTag.getString("ability_id");
AbilityTracker tracker = this.palAbilities.get(PalInternals.getAbility(Identifier.tryParse(abilityId)));
if (tracker != null) {
tracker.load(abilityTag);
} else {
PalInternals.LOGGER.warn("Encountered unknown ability {} while deserializing data for {}", abilityId, this);
for (NbtElement t : tag.getListOrEmpty("playerabilitylib:abilities")) {
if (t instanceof NbtCompound abilityTag) {
if (abilityTag.contains("ability_id")) {
String abilityId = abilityTag.getString("ability_id", "");
AbilityTracker tracker = this.palAbilities.get(PalInternals.getAbility(Identifier.tryParse(abilityId)));
if (tracker != null) {
tracker.load(abilityTag);
} else {
PalInternals.LOGGER.warn("Encountered unknown ability {} while deserializing data for {}", abilityId, this);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -21,7 +21,6 @@
import io.github.ladysnake.pal.Pal;
import io.github.ladysnake.pal.VanillaAbilities;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.AttributeContainer;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.server.network.ServerPlayerEntity;
Expand Down
5 changes: 2 additions & 3 deletions src/testmod/java/io/github/ladysnake/paltest/PalTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -24,7 +24,6 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.equipment.ArmorMaterials;
Expand Down Expand Up @@ -60,7 +59,7 @@ private <I extends Item> I registerItem(String id, Function<Item.Settings, I> fa
}

private void registerWaxWings() {
Item waxWings = registerItem("wax_wings", settings -> new ArmorItem(ArmorMaterials.LEATHER, EquipmentType.CHESTPLATE, settings));
Item waxWings = registerItem("wax_wings", settings -> new Item(settings.armor(ArmorMaterials.LEATHER, EquipmentType.CHESTPLATE)));
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
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
12 changes: 6 additions & 6 deletions src/testmod/java/io/github/ladysnake/paltest/PalTestSuite.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -21,20 +21,20 @@
import io.github.ladysnake.pal.AbilitySource;
import io.github.ladysnake.pal.Pal;
import io.github.ladysnake.pal.VanillaAbilities;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.fabricmc.fabric.api.gametest.v1.GameTest;
import net.minecraft.network.packet.c2s.common.SyncedClientOptions;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.test.GameTest;
import net.minecraft.test.GameTestException;
import net.minecraft.test.TestContext;
import net.minecraft.text.Text;

import java.util.UUID;

public final class PalTestSuite implements FabricGameTest {
public final class PalTestSuite {
private static final AbilitySource TEST_SOURCE = Pal.getAbilitySource(PalTest.id("test_source"));
private static final AbilitySource TEST_SOURCE_2 = Pal.getAbilitySource(PalTest.id("test_source_2"));

@GameTest(templateName = EMPTY_STRUCTURE)
@GameTest()
public void grantingWorks(TestContext ctx) {
ServerPlayerEntity mockPlayer = createMockPlayer(ctx);
assertTrue(mockPlayer.getAbilities().allowModifyWorld, "Unexpected init state");
Expand All @@ -51,7 +51,7 @@ public void grantingWorks(TestContext ctx) {
}

private static void assertTrue(boolean b, String message) {
if (!b) throw new GameTestException(message);
if (!b) throw new GameTestException(Text.literal(message), 0);
}

private ServerPlayerEntity createMockPlayer(TestContext ctx) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2024 Ladysnake
* Copyright (C) 2019-2025 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down