Skip to content

Commit

Permalink
Update to 1.20.2-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox authored and Pyrofab committed Sep 21, 2023
1 parent b76cb3e commit cfbffa8
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 15 deletions.
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) {
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,19 @@
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
}
}

0 comments on commit cfbffa8

Please sign in to comment.