Search in sources :

Example 1 with PlayerShipRefrenceMessage

use of ValkyrienWarfareBase.Network.PlayerShipRefrenceMessage in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EventsClient method onClientTickEvent.

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onClientTickEvent(ClientTickEvent event) {
    if (mc.theWorld != null) {
        if (!mc.isGamePaused()) {
            WorldPhysObjectManager manager = ValkyrienWarfareMod.physicsManager.getManagerForWorld(mc.theWorld);
            if (event.phase == Phase.END) {
                for (PhysicsWrapperEntity wrapper : manager.physicsEntities) {
                    wrapper.wrapping.onPostTickClient();
                }
                EntityDraggable.tickAddedVelocityForWorld(mc.theWorld);
            }
        }
        if (event.phase == Phase.END) {
            Object o = Minecraft.getMinecraft().thePlayer;
            EntityDraggable draggable = (EntityDraggable) o;
            if (draggable.worldBelowFeet != null) {
                PlayerShipRefrenceMessage playerPosMessage = new PlayerShipRefrenceMessage(Minecraft.getMinecraft().thePlayer, draggable.worldBelowFeet);
                ValkyrienWarfareMod.physWrapperNetwork.sendToServer(playerPosMessage);
            }
        }
    }
}
Also used : WorldPhysObjectManager(ValkyrienWarfareBase.PhysicsManagement.WorldPhysObjectManager) EntityDraggable(ValkyrienWarfareBase.Interaction.EntityDraggable) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) PlayerShipRefrenceMessage(ValkyrienWarfareBase.Network.PlayerShipRefrenceMessage) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityDraggable (ValkyrienWarfareBase.Interaction.EntityDraggable)1 PlayerShipRefrenceMessage (ValkyrienWarfareBase.Network.PlayerShipRefrenceMessage)1 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 WorldPhysObjectManager (ValkyrienWarfareBase.PhysicsManagement.WorldPhysObjectManager)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1