Skip to content

Commit

Permalink
fix: maybe fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 25, 2024
1 parent e493f9d commit 396d20a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@ public class BiomeTintListener {
public static void updateTints(PlayerEvent.PlayerLoggedInEvent event) {
if (!event.getEntity().level().isClientSide() && event.getEntity() instanceof ServerPlayer player) {
Registry<Biome> registry = player.level().registryAccess().registryOrThrow(Registries.BIOME);
Map<ResourceLocation, Map<ResourceLocation, Integer>> map = new HashMap<>();
BiomeTints.TINT_REGISTRY.forEach(tint -> {
ResourceLocation loc = BiomeTints.TINT_REGISTRY.getKey(tint);
Map<ResourceLocation, Integer> tints = registry.getDataMap(tint.getDataMap()).entrySet().stream().collect(Collectors.toMap(
entry -> entry.getKey().location(), Map.Entry::getValue
));
map.put(loc, tints);
ZenithNetworking.sendToPlayer(new BiomeTintSyncPacket(loc,
registry.getDataMap(tint.getDataMap()).entrySet().stream().collect(Collectors.toMap(
entry -> entry.getKey().location(), Map.Entry::getValue))
), player);
});
ZenithNetworking.sendToPlayer(new BiomeTintSyncPacket(map), player);
}
}


@SubscribeEvent
/* @SubscribeEvent
public static void clearTints(ClientPlayerNetworkEvent.LoggingOut event) {
BiomeTints.TINT_REGISTRY.forEach(BiomeTint::clear);
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public record BiomeTintSyncPacket(ResourceLocation id, Map<ResourceLocation, Int
public static final ResourceLocation ID = new ResourceLocation(Zenith.MODID, "sync_biome_tints");

public void write(FriendlyByteBuf buf) {
buf.writeResourceLocation(this.id)
buf.writeResourceLocation(this.id);
buf.writeMap(this.tintMap, FriendlyByteBuf::writeResourceLocation, FriendlyByteBuf::writeInt);
}

Expand Down

0 comments on commit 396d20a

Please sign in to comment.