Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.20.2-rc2 #18

Merged
merged 2 commits into from
Sep 21, 2023
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
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
------------------------------------------------------
Version 1.9.0
------------------------------------------------------
- Updated to MC 1.20.2

------------------------------------------------------
Version 1.8.0
------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 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.20
yarn_mappings=1.20+build.1
minecraft_version=1.20.2-rc2
yarn_mappings=1.20.2-rc2+build.1
loader_version=0.14.22
#Fabric api
fabric_version=0.83.0+1.20
fabric_version=0.89.0+1.20.2

elmendorf_version = 0.11.0
elmendorf_version = 0.12.0

# Mod Properties
mod_version = 1.8.0
mod_version = 1.9.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; 1.20.1
curseforge_versions = 1.20.2-Snapshot
cf_requirements = fabric-api
modrinth_id = DHQA06r4
release_type = release
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtList;
import net.minecraft.network.encryption.PlayerPublicKey;
import net.minecraft.network.packet.c2s.common.SyncedClientOptions;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
Expand Down Expand Up @@ -58,7 +58,7 @@ public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile


@Inject(method = "<init>", at = @At("RETURN"))
private void init(MinecraftServer server, ServerWorld world, GameProfile profile, CallbackInfo ci) {
private void init(MinecraftServer server, ServerWorld world, GameProfile profile, SyncedClientOptions clientOptions, CallbackInfo ci) {
PalInternals.populate(this, this.palAbilities);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ private void copyAbilitiesAfterRespawn(ServerPlayerEntity oldPlayer, boolean ali
}
}

@Inject(method = "sendAbilitiesUpdate", at = @At(value = "NEW", target = "net/minecraft/network/packet/s2c/play/PlayerAbilitiesS2CPacket"))
@Inject(method = "sendAbilitiesUpdate", at = @At(value = "NEW", target = "(Lnet/minecraft/entity/player/PlayerAbilities;)Lnet/minecraft/network/packet/s2c/play/PlayerAbilitiesS2CPacket;"))
private void checkAbilityConsistency(CallbackInfo ci) {
for (PlayerAbility ability : this.listPalAbilities()) {
AbilityTracker tracker = this.get(ability);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ public FlightEffect(StatusEffectCategory statusEffectType, int color) {
}

@Override
public void onApplied(LivingEntity effected, AttributeContainer abstractEntityAttributeContainer, int amplifier) {
super.onApplied(effected, abstractEntityAttributeContainer, amplifier);
public void onApplied(LivingEntity effected, int amplifier) {
super.onApplied(effected, amplifier);
if (effected instanceof ServerPlayerEntity sp) {
Pal.grantAbility(sp, VanillaAbilities.ALLOW_FLYING, FLIGHT_POTION);
}
}

@Override
public void onRemoved(LivingEntity effected, AttributeContainer abstractEntityAttributeContainer, int amplifier) {
super.onRemoved(effected, abstractEntityAttributeContainer, amplifier);
public void onRemoved(LivingEntity effected) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mojang try not to remove useful API challenge

if (effected instanceof ServerPlayerEntity sp) {
Pal.revokeAbility(sp, VanillaAbilities.ALLOW_FLYING, FLIGHT_POTION);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.github.ladysnake.pal.Pal;
import io.github.ladysnake.pal.VanillaAbilities;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.network.packet.c2s.common.SyncedClientOptions;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.test.GameTest;
import net.minecraft.test.GameTestException;
Expand Down Expand Up @@ -54,6 +55,6 @@ private static void assertTrue(boolean b, String message) {
}

private ServerPlayerEntity createMockPlayer(TestContext ctx) {
return new ServerPlayerEntity(ctx.getWorld().getServer(), ctx.getWorld(), new GameProfile(UUID.randomUUID(), "test-mock-player"));
return new ServerPlayerEntity(ctx.getWorld().getServer(), ctx.getWorld(), new GameProfile(UUID.randomUUID(), "test-mock-player"), SyncedClientOptions.createDefault());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* PlayerAbilityLib
* Copyright (C) 2019-2023 Ladysnake
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; If not, see <https://www.gnu.org/licenses>.
*/
package io.github.ladysnake.paltest.mixin;

import io.github.ladysnake.paltest.FlightEffect;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
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) {
flightEffect.onRemoved((LivingEntity) (Object) this);
}
}
}
3 changes: 3 additions & 0 deletions src/testmod/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"issues": "https://github.com/Ladysnake/Pal/issues",
"discord": "ladysnake.glitch.me/discord"
},
"mixins": [
"mixins.paltest.common.json"
],
"environment": "*",
"entrypoints": {
"main": [
Expand Down
12 changes: 12 additions & 0 deletions src/testmod/resources/mixins.paltest.common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"required": true,
"package": "io.github.ladysnake.paltest.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.7.11-SNAPSHOT",
"mixins": [
"LivingEntityMixin"
],
"injectors": {
"defaultRequire": 1
}
}
Loading