mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-24 13:27:59 +01:00
Fix constant logging when playing on a multiplayer server that doesn't register for receiving pony data packets
This commit is contained in:
parent
011ceedafe
commit
9064272771
2 changed files with 9 additions and 8 deletions
|
@ -55,18 +55,19 @@ public class Channel {
|
|||
});
|
||||
}
|
||||
|
||||
public static boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public static boolean broadcastPonyData(IPonyData packet, boolean noSkin) {
|
||||
if (!isRegistered()) {
|
||||
return false;
|
||||
}
|
||||
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
|
||||
throw new RuntimeException("Client packet send called by the server");
|
||||
}
|
||||
|
||||
if (!registered) {
|
||||
LOGGER.info("Skipping network packet as the server has not consented");
|
||||
return false;
|
||||
} else {
|
||||
LOGGER.info("Sending pony data to server for player");
|
||||
}
|
||||
|
||||
LOGGER.info("Sending pony data to server for player");
|
||||
ClientPlayNetworking.send(CLIENT_PONY_DATA, new MsgPonyData(packet, noSkin).toBuffer(PacketByteBufs.create()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
@Nullable
|
||||
PlayerEntity clientPlayer = MinecraftClient.getInstance().player;
|
||||
|
||||
if (pony.compareTo(synced.lastTransmittedPony) != 0) {
|
||||
if (Channel.isRegistered() && pony.compareTo(synced.lastTransmittedPony) != 0) {
|
||||
if (clientPlayer != null && (Objects.equals(player, clientPlayer) || Objects.equals(player.getGameProfile(), clientPlayer.getGameProfile()))) {
|
||||
if (Channel.broadcastPonyData(pony.metadata(), pony.defaulted())) {
|
||||
synced.lastTransmittedPony = pony;
|
||||
|
|
Loading…
Reference in a new issue