Skip to content

Commit

Permalink
Version 1.0.3, fixing server-side display update broadcasting to clie…
Browse files Browse the repository at this point in the history
…nts.
  • Loading branch information
mindstorm38 committed Apr 8, 2022
1 parent 94389bb commit 0587f58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.13.3

# Mod Properties
mod_version = 1.0.2
mod_version = 1.0.3
maven_group = fr.theorozier
archives_base_name = webstreamer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.block.Block;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -63,6 +64,7 @@ public void receive(MinecraftServer server, ServerPlayerEntity player, ServerPla
if (world.getBlockEntity(pos) instanceof DisplayBlockEntity blockEntity) {
blockEntity.readNbt(nbt);
blockEntity.markDirty();
world.updateListeners(pos, blockEntity.getCachedState(), blockEntity.getCachedState(), Block.NOTIFY_ALL);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@ private void fetchPlaylist() {
this.playlistOffset = (int) playlist.mediaSequence();
if (!this.playlistSegments.isEmpty()) {
MediaSegment lastSegment = this.playlistSegments.get(this.playlistSegments.size() - 1);
this.playlistRequestInterval = (long) (lastSegment.duration() * 1000000000.0 * 0.7);
long newInterval = (long) (lastSegment.duration() * 1000000000.0 * 0.7);
if (newInterval != this.playlistRequestInterval) {
WebStreamerMod.LOGGER.debug("New request interval: {}", newInterval);
this.playlistRequestInterval = newInterval;
}
}
// System.out.println("next playlist from " + this.playlistOffset + " to " + this.getLastSegmentIndex());
}
}, exc -> {
// If failing, put timestamp to retry later.
Expand Down Expand Up @@ -376,7 +379,7 @@ private void fetch() throws IOException {
return;
}

WebStreamerMod.LOGGER.debug("Initializing display layer...");
WebStreamerMod.LOGGER.info("Initializing display layer...");

double totalDuration = 0.0;
for (MediaSegment seg : this.playlistSegments) {
Expand Down

0 comments on commit 0587f58

Please sign in to comment.