Skip to content

Commit

Permalink
Update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Sep 10, 2023
1 parent 68959ca commit 56dbc9c
Show file tree
Hide file tree
Showing 30 changed files with 149 additions and 84 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ allprojects {
url = URI("https://maven.ladysnake.org/releases")
content {
includeGroup("io.github.ladysnake")
includeGroup("org.ladysnake")
includeGroupByRegex("dev\\.emi.*")
includeGroupByRegex("dev\\.onyxstudios.*")
}
Expand All @@ -55,7 +56,7 @@ allprojects {
modImplementation(fabricApi.module("fabric-lifecycle-events-v1", fabricApiVersion))

modCompileOnly(fabricApi.module("fabric-gametest-api-v1", fabricApiVersion))
modLocalImplementation("io.github.ladysnake:elmendorf:${props["elmendorf_version"]}")
modLocalImplementation("org.ladysnake:elmendorf:${props["elmendorf_version"]}")

compileOnly("com.google.code.findbugs:jsr305:3.0.2")
compileOnly("com.demonwav.mcdev:annotations:1.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent;
import dev.onyxstudios.cca.api.v3.component.sync.ComponentPacketWriter;
import dev.onyxstudios.cca.api.v3.component.sync.PlayerSyncPredicate;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import org.jetbrains.annotations.ApiStatus;

import javax.annotation.Nullable;
import java.util.List;
Expand Down Expand Up @@ -67,6 +68,7 @@ default Iterable<ServerPlayerEntity> getRecipientsForComponentSync() {
* @since 3.0.0
*/
@Nullable
@ApiStatus.Experimental // TODO change the return value to Packet<ClientCommonPacketListener>
default <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(ComponentKey<? super C> key, ComponentPacketWriter writer, ServerPlayerEntity recipient) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
import dev.onyxstudios.cca.internal.block.CardinalBlockInternals;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand Down Expand Up @@ -125,7 +126,7 @@ public <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(
buf.writeBlockPos(this.getPos());
buf.writeIdentifier(key.getId());
writer.writeSyncPacket(buf, recipient);
return new CustomPayloadS2CPacket(CardinalComponentsBlock.PACKET_ID, buf);
return (CustomPayloadS2CPacket) ServerPlayNetworking.createS2CPacket(CardinalComponentsBlock.PACKET_ID, buf);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@

import dev.onyxstudios.cca.api.v3.block.BlockEntitySyncCallback;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import net.minecraft.server.network.ChunkDataSender;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.chunk.WorldChunk;
import org.apache.commons.lang3.mutable.MutableObject;
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(ThreadedAnvilChunkStorage.class)
public abstract class MixinThreadedAnvilChunkStorage {
@Inject(method = "sendChunkDataPackets", at = @At("RETURN"))
private void sendChunkDataPackets(ServerPlayerEntity player, MutableObject<ChunkDataS2CPacket> mutableObject, WorldChunk chunk, CallbackInfo ci) {
@Mixin(ChunkDataSender.class)
public abstract class MixinChunkDataSender {
@Inject(method = "sendChunkData", at = @At("RETURN"))
private static void sendChunkDataPackets(ServerPlayNetworkHandler handler, ServerWorld world, WorldChunk chunk, CallbackInfo ci) {
for (BlockEntity be : chunk.getBlockEntities().values()) {
BlockEntitySyncCallback.EVENT.invoker().onBlockEntitySync(player, be);
BlockEntitySyncCallback.EVENT.invoker().onBlockEntitySync(handler.player, be);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"common.MixinBlockDataObject",
"common.MixinBlockEntity",
"common.MixinBlockStateArgument",
"common.MixinChunkDataSender",
"common.MixinChunkHolder",
"common.MixinFallingBlockEntity",
"common.MixinServerPlayerEntity",
"common.MixinThreadedAnvilChunkStorage",
"common.MixinWorldChunk"
],
"client": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import dev.onyxstudios.cca.test.base.LoadAwareTestComponent;
import dev.onyxstudios.cca.test.base.TickingTestComponent;
import dev.onyxstudios.cca.test.base.Vita;
import io.github.ladysnake.elmendorf.GameTestUtil;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
Expand All @@ -37,6 +36,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.NotNull;
import org.ladysnake.elmendorf.GameTestUtil;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,20 @@
*/
package dev.onyxstudios.cca.mixin.chunk.common;

import com.mojang.datafixers.DataFixer;
import dev.onyxstudios.cca.api.v3.chunk.ChunkSyncCallback;
import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import net.minecraft.server.network.ChunkDataSender;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.storage.VersionedChunkStorage;
import org.apache.commons.lang3.mutable.MutableObject;
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;

import java.nio.file.Path;

@Mixin(ThreadedAnvilChunkStorage.class)
public abstract class MixinThreadedAnvilChunkStorage extends VersionedChunkStorage {
public MixinThreadedAnvilChunkStorage(Path file, DataFixer dataFixer, boolean bl) {
super(file, dataFixer, bl);
}

@Inject(method = "sendChunkDataPackets", at = @At("RETURN"))
private void sendChunkComponentsPackets(ServerPlayerEntity player, MutableObject<ChunkDataS2CPacket> mutableObject, WorldChunk chunk, CallbackInfo ci) {
ChunkSyncCallback.EVENT.invoker().onChunkSync(player, chunk);
@Mixin(ChunkDataSender.class)
public abstract class MixinChunkDataSender {
@Inject(method = "sendChunkData", at = @At("RETURN"))
private static void sendChunkComponentsPackets(ServerPlayNetworkHandler handler, ServerWorld world, WorldChunk chunk, CallbackInfo ci) {
ChunkSyncCallback.EVENT.invoker().onChunkSync(handler.player, chunk);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
import dev.onyxstudios.cca.internal.chunk.CardinalComponentsChunk;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.registry.Registry;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
Expand Down Expand Up @@ -78,7 +79,7 @@ public <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(
buf.writeInt(pos.z);
buf.writeIdentifier(key.getId());
writer.writeSyncPacket(buf, recipient);
return new CustomPayloadS2CPacket(CardinalComponentsChunk.PACKET_ID, buf);
return (CustomPayloadS2CPacket) ServerPlayNetworking.createS2CPacket(CardinalComponentsChunk.PACKET_ID, buf);
}

@Inject(method = "<init>(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/ProtoChunk;Lnet/minecraft/world/chunk/WorldChunk$EntityLoader;)V", at = @At("RETURN"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"package": "dev.onyxstudios.cca.mixin.chunk",
"mixins": [
"common.MixinChunk",
"common.MixinChunkDataSender",
"common.MixinChunkHolder",
"common.MixinChunkSerializer",
"common.MixinEmptyChunk",
"common.MixinServerWorld",
"common.MixinThreadedAnvilChunkStorage",
"common.MixinWorldChunk",
"common.MixinWrapperProtoChunk"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import dev.onyxstudios.cca.test.base.LoadAwareTestComponent;
import dev.onyxstudios.cca.test.base.TickingTestComponent;
import dev.onyxstudios.cca.test.base.Vita;
import io.github.ladysnake.elmendorf.GameTestUtil;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.test.GameTest;
Expand All @@ -35,6 +34,7 @@
import net.minecraft.world.ChunkSerializer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.WorldChunk;
import org.ladysnake.elmendorf.GameTestUtil;

public class CcaChunkTestSuite implements FabricGameTest {
@GameTest(templateName = EMPTY_STRUCTURE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.Entity;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.world.GameRules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
import dev.onyxstudios.cca.internal.entity.CardinalEntityInternals;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -102,7 +103,7 @@ public <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(
buf.writeInt(this.getId());
buf.writeIdentifier(key.getId());
writer.writeSyncPacket(buf, recipient);
return new CustomPayloadS2CPacket(CardinalComponentsEntity.PACKET_ID, buf);
return (CustomPayloadS2CPacket) ServerPlayNetworking.createS2CPacket(CardinalComponentsEntity.PACKET_ID, buf);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import dev.onyxstudios.cca.api.v3.entity.PlayerSyncCallback;
import net.minecraft.network.ClientConnection;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ConnectedClientData;
import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -41,7 +42,7 @@ public abstract class MixinPlayerManager {
target = "Lnet/minecraft/server/network/ServerPlayerEntity;getStatusEffects()Ljava/util/Collection;"
)
)
private void onPlayerLogIn(ClientConnection connection, ServerPlayerEntity player, CallbackInfo ci) {
private void onPlayerLogIn(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData clientData, CallbackInfo ci) {
PlayerSyncCallback.EVENT.invoker().onPlayerSync(player);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import dev.onyxstudios.cca.test.base.LoadAwareTestComponent;
import dev.onyxstudios.cca.test.base.Vita;
import io.github.ladysnake.elmendorf.GameTestUtil;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.entity.Bucketable;
import net.minecraft.entity.Entity;
Expand All @@ -39,6 +38,7 @@
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import org.ladysnake.elmendorf.GameTestUtil;

public class CcaEntityTestSuite implements FabricGameTest {
@GameTest(templateName = EMPTY_STRUCTURE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import dev.onyxstudios.cca.api.v3.world.WorldSyncCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.util.Identifier;
import net.minecraft.world.WorldProperties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
import dev.onyxstudios.cca.internal.level.CardinalComponentsLevel;
import dev.onyxstudios.cca.internal.level.StaticLevelComponentPlugin;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.entity.boss.dragon.EnderDragonFight;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
Expand Down Expand Up @@ -97,7 +98,7 @@ public <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(
PacketByteBuf buf = PacketByteBufs.create();
buf.writeIdentifier(key.getId());
writer.writeSyncPacket(buf, recipient);
return new CustomPayloadS2CPacket(CardinalComponentsLevel.PACKET_ID, buf);
return (CustomPayloadS2CPacket) ServerPlayNetworking.createS2CPacket(CardinalComponentsLevel.PACKET_ID, buf);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
package dev.onyxstudios.cca.test.level;

import dev.onyxstudios.cca.test.base.TickingTestComponent;
import io.github.ladysnake.elmendorf.GameTestUtil;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.test.GameTest;
import net.minecraft.test.TestContext;
import org.ladysnake.elmendorf.GameTestUtil;

public class CcaLevelTestSuite implements FabricGameTest {
@GameTest(templateName = EMPTY_STRUCTURE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.Identifier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
import dev.onyxstudios.cca.internal.scoreboard.ScoreboardComponentContainerFactory;
import dev.onyxstudios.cca.internal.scoreboard.StaticScoreboardComponentPlugin;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.scoreboard.ServerScoreboard;
import net.minecraft.scoreboard.Team;
Expand Down Expand Up @@ -74,7 +75,7 @@ public <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(
PacketByteBuf buf = PacketByteBufs.create();
buf.writeIdentifier(key.getId());
writer.writeSyncPacket(buf, recipient);
return new CustomPayloadS2CPacket(CardinalComponentsScoreboard.SCOREBOARD_PACKET_ID, buf);
return (CustomPayloadS2CPacket) ServerPlayNetworking.createS2CPacket(CardinalComponentsScoreboard.SCOREBOARD_PACKET_ID, buf);
}

@Inject(method = "<init>", at = @At("RETURN"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
import dev.onyxstudios.cca.internal.scoreboard.CardinalComponentsScoreboard;
import dev.onyxstudios.cca.internal.scoreboard.StaticScoreboardComponentPlugin;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.scoreboard.Team;
import net.minecraft.server.network.ServerPlayerEntity;
Expand Down Expand Up @@ -84,7 +85,7 @@ public <C extends AutoSyncedComponent> CustomPayloadS2CPacket toComponentPacket(
buf.writeString(this.getName());
buf.writeIdentifier(key.getId());
writer.writeSyncPacket(buf, recipient);
return new CustomPayloadS2CPacket(CardinalComponentsScoreboard.TEAM_PACKET_ID, buf);
return (CustomPayloadS2CPacket) ServerPlayNetworking.createS2CPacket(CardinalComponentsScoreboard.TEAM_PACKET_ID, buf);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
package dev.onyxstudios.cca.test.scoreboard;

import dev.onyxstudios.cca.test.base.LoadAwareTestComponent;
import io.github.ladysnake.elmendorf.GameTestUtil;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.test.GameTest;
import net.minecraft.test.TestContext;
import org.ladysnake.elmendorf.GameTestUtil;

public class CcaScoreboardTestSuite implements FabricGameTest {
@GameTest(templateName = EMPTY_STRUCTURE)
Expand Down
Loading

0 comments on commit 56dbc9c

Please sign in to comment.