mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Fix constant logging when playing on a multiplayer server that doesn't register for receiving pony data packets
# Conflicts: # src/main/java/com/minelittlepony/api/events/Channel.java # src/main/java/com/minelittlepony/client/render/EquineRenderManager.java
This commit is contained in:
parent
2ed7f91786
commit
4de3f3daa2
2 changed files with 8 additions and 8 deletions
|
@ -54,16 +54,16 @@ public class Channel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean broadcastPonyData(PonyData packet) {
|
public static boolean isRegistered() {
|
||||||
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
|
return registered;
|
||||||
throw new RuntimeException("Client packet send called by the server");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!registered) {
|
public static boolean broadcastPonyData(PonyData packet) {
|
||||||
LOGGER.info("Skipping network packet as the server has not consented");
|
if (!isRegistered()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
LOGGER.info("Sending pony data to server for player");
|
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
|
||||||
|
throw new RuntimeException("Client packet send called by the server");
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientPlayNetworking.send(CLIENT_PONY_DATA, MsgPonyData.write(packet, PacketByteBufs.create()));
|
ClientPlayNetworking.send(CLIENT_PONY_DATA, MsgPonyData.write(packet, PacketByteBufs.create()));
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
||||||
@Nullable
|
@Nullable
|
||||||
PlayerEntity clientPlayer = MinecraftClient.getInstance().player;
|
PlayerEntity clientPlayer = MinecraftClient.getInstance().player;
|
||||||
|
|
||||||
if (pony.compareTo(lastTransmittedPony) != 0) {
|
if (Channel.isRegistered() && pony.compareTo(lastTransmittedPony) != 0) {
|
||||||
if (clientPlayer != null && (Objects.equals(player, clientPlayer) || Objects.equals(player.getGameProfile(), clientPlayer.getGameProfile()))) {
|
if (clientPlayer != null && (Objects.equals(player, clientPlayer) || Objects.equals(player.getGameProfile(), clientPlayer.getGameProfile()))) {
|
||||||
if (Channel.broadcastPonyData(pony.metadata())) {
|
if (Channel.broadcastPonyData(pony.metadata())) {
|
||||||
lastTransmittedPony = pony;
|
lastTransmittedPony = pony;
|
||||||
|
|
Loading…
Reference in a new issue