use of slimeknights.tconstruct.common.network.TinkerNetwork in project TinkersConstruct by SlimeKnights.
the class MaterialRegistry method sendPackets.
/**
* Sends all relevant packets to the given player
*/
private void sendPackets(ServerPlayer player, ISimplePacket[] packets) {
// this event is not fired when connecting to a server
if (player.connection.getConnection().isMemoryConnection()) {
// if the packet is being sent to ourself, skip sending, prevents recreating all material instances in the registry a second time on dedicated servers
// note it will still send the packet if another client connects in LAN
fullyLoaded = true;
MinecraftForge.EVENT_BUS.post(new MaterialsLoadedEvent());
} else {
TinkerNetwork network = TinkerNetwork.getInstance();
PacketTarget target = PacketDistributor.PLAYER.with(() -> player);
for (ISimplePacket packet : packets) {
network.send(target, packet);
}
}
}
Aggregations