Skip to content

Commit

Permalink
Just make everything use arch api networking
Browse files Browse the repository at this point in the history
zbx1425 committed Dec 27, 2024
1 parent 43f5580 commit 925e401
Showing 23 changed files with 97 additions and 420 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ authors=Falkreon, acikek
contributors=Trudle, Tomate0613, afamiliarquiet, FoundationGames, TheEpicBlock, hama
license=MIT
# Mod Version
baseVersion=1.8.2-rc.4
baseVersion=1.8.2-rc.5
# Branch Metadata
branch=1.21
tagBranch=1.21
Original file line number Diff line number Diff line change
@@ -77,12 +77,5 @@ public static void onServerStopping(ServerStoppingEvent event) {
ScatteredShards.LOGGER.error("Failed to close sync dispatcher", e);
}
}

@SubscribeEvent
public static void onPlayerJoinServer(PlayerEvent.PlayerLoggedInEvent event) {
if (event.getEntity() instanceof ServerPlayerEntity serverPlayer) {
ScatteredShardsNetworking.onPlayerJoinServer(serverPlayer.getServer(), serverPlayer);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -2,9 +2,6 @@

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.InventoryProvider;
@@ -566,16 +563,16 @@ public final NetworkSide getNetworkSide() {
* @return the packet sender
* @since 3.3.0
*/
public final PacketSender getPacketSender() {
if (getNetworkSide() == NetworkSide.SERVER) {
return ServerPlayNetworking.getSender((ServerPlayerEntity) playerInventory.player);
} else {
return getClientPacketSender();
}
}

@Environment(EnvType.CLIENT)
private PacketSender getClientPacketSender() {
return ClientPlayNetworking.getSender();
}
// public final PacketSender getPacketSender() {
// if (getNetworkSide() == NetworkSide.SERVER) {
// return ServerPlayNetworking.getSender((ServerPlayerEntity) playerInventory.player);
// } else {
// return getClientPacketSender();
// }
// }
//
// @Environment(EnvType.CLIENT)
// private PacketSender getClientPacketSender() {
// return ClientPlayNetworking.getSender();
// }
}
Original file line number Diff line number Diff line change
@@ -4,8 +4,6 @@
import com.mojang.serialization.Decoder;
import com.mojang.serialization.Encoder;
import com.mojang.serialization.Lifecycle;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtOps;
@@ -87,7 +85,7 @@ public <D> void send(Identifier message, Encoder<D> encoder, D data) {
var ops = getRegistryOps(description.getWorld().getRegistryManager());
NbtElement encoded = encoder.encodeStart(ops, data).getOrThrow();
ScreenMessage packet = new ScreenMessage(description.syncId, message, encoded);
description.getPacketSender().sendPacket(packet);
// description.getPacketSender().sendPacket(packet);
}

public static void init() {
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.cottonmc.cotton.gui.impl.client;

import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import dev.architectury.networking.NetworkManager;

import io.github.cottonmc.cotton.gui.impl.Proxy;
import io.github.cottonmc.cotton.gui.impl.ScreenNetworkingImpl;

This file was deleted.

111 changes: 0 additions & 111 deletions src/main/java/net/fabricmc/fabric/api/networking/v1/PacketSender.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit 925e401

Please sign in to comment.