[CLEANUP] YEET old networking system
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
package com.hypherionmc.craterlib.core.network;
|
||||
|
||||
import com.hypherionmc.craterlib.core.platform.ClientPlatform;
|
||||
import com.hypherionmc.craterlib.core.platform.CommonPlatform;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface CraterNetworkHandler {
|
||||
|
||||
<T extends CraterPacket<T>> void registerPacket(Class<T> clazz, Supplier<T> supplier, PacketDirection packetDirection);
|
||||
|
||||
Packet<?> toServerBound(CraterPacket<?> packet);
|
||||
|
||||
Packet<?> toClientBound(CraterPacket<?> packet);
|
||||
|
||||
default void sendToServer(CraterPacket<?> packet) {
|
||||
ClientPlatform.INSTANCE.getClientConnection().send(this.toServerBound(packet));
|
||||
}
|
||||
|
||||
default void sendTo(CraterPacket<?> packet, ServerPlayer player) {
|
||||
player.connection.send(this.toClientBound(packet));
|
||||
}
|
||||
|
||||
default void sendToAll(CraterPacket<?> packet) {
|
||||
CommonPlatform.INSTANCE.getMCServer().toMojang().getPlayerList().broadcastAll(this.toClientBound(packet));
|
||||
}
|
||||
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
package com.hypherionmc.craterlib.core.network;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface CraterPacket<T extends CraterPacket<T>> {
|
||||
|
||||
void write(final FriendlyByteBuf buf);
|
||||
|
||||
void read(final FriendlyByteBuf buf);
|
||||
|
||||
default void handle(Player player, Object minecraft) {
|
||||
this.createHandler().handle((T) this, player, minecraft);
|
||||
}
|
||||
|
||||
PacketHandler<T> createHandler();
|
||||
|
||||
abstract class PacketHandler<T extends CraterPacket<T>> {
|
||||
public abstract void handle(T packet, Player player, Object minecraft);
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.hypherionmc.craterlib.core.network;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public enum PacketDirection {
|
||||
TO_SERVER,
|
||||
TO_CLIENT
|
||||
}
|
Reference in New Issue
Block a user