Fix client baubles not all being synced

This commit is contained in:
Caedis committed 2025-05-20 12:48:57 -05:00
1 parent ac75ed2328
commit bd227ba047
2 files changed
+22 -22

No files matched your search

@@ -1,5 +1,6 @@
package baubles.common.event;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -8,20 +9,21 @@ import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
public class EventHandlerNetwork {
@SubscribeEvent
public void playerLoggedInEvent (PlayerEvent.PlayerLoggedInEvent event) {
Side side = FMLCommonHandler.instance().getEffectiveSide();
@SubscribeEvent
public void playerLoggedInEvent (PlayerEvent.PlayerLoggedInEvent event) {
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side == Side.SERVER) {
syncBaubles(event.player);
}
}
public static void syncBaubles(EntityPlayer player) {
for (int a = 0; a < 4; a++) {
PlayerHandler.getPlayerBaubles(player).syncSlotToClients(a);
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
for (int i = 0; i < baubles.getSizeInventory(); i++) {
baubles.syncSlotToClients(i);
}
}
}