forked from LNatit/bedual
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to fix render bug(untested!!!)
- Loading branch information
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/lnatit/hr10/handler/PlayerDataSyncHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package lnatit.hr10.handler; | ||
|
||
import lnatit.hr10.interfaces.IDuallableEntity; | ||
import lnatit.hr10.network.NetworkReg; | ||
import lnatit.hr10.network.SleepInfoPacket; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.entity.player.ServerPlayerEntity; | ||
import net.minecraft.world.server.ServerWorld; | ||
import net.minecraftforge.event.entity.player.PlayerEvent; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
|
||
import java.util.List; | ||
|
||
import static lnatit.hr10.hr10.MOD_ID; | ||
|
||
@Mod.EventBusSubscriber(modid = MOD_ID) | ||
public class PlayerDataSyncHandler | ||
{ | ||
//TODO untested!!! | ||
@SubscribeEvent | ||
public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) | ||
{ | ||
PlayerEntity player = event.getPlayer(); | ||
|
||
if (player instanceof ServerPlayerEntity) | ||
{ | ||
ServerWorld world = ((ServerPlayerEntity) player).getServerWorld(); | ||
List<ServerPlayerEntity> playerList = world.getPlayers(); | ||
|
||
for (ServerPlayerEntity serverPlayer : playerList) | ||
{ | ||
NetworkReg.serverSendToPlayer(new SleepInfoPacket(((IDuallableEntity) serverPlayer).getSleepSide(), | ||
serverPlayer.getEntityId() | ||
), (ServerPlayerEntity) player); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters