public override void BeforeRender(float dt) { if (meshRefOpaque == null && meshRefOit == null) { return; } if (gearInv == null && eagent?.GearInventory != null) { registerSlotModified(); } if (capi.IsGamePaused) { return; } if (player == null && entity is EntityPlayer) { player = capi.World.PlayerByUid((entity as EntityPlayer).PlayerUID) as IClientPlayer; nameTagRenderHandler = capi.ModLoader.GetModSystem <EntityNameTagRendererRegistry>().GetNameTagRenderer(entity); OnNameChanged(); } isSpectator = player != null && player.WorldData.CurrentGameMode == EnumGameMode.Spectator; if (isSpectator) { return; } if (DisplayChatMessages && messageTextures.Count > 0) { MessageTexture tex = messageTextures.Last(); if (capi.World.ElapsedMilliseconds > tex.receivedTime + 3500 + 100 * (tex.message.Length - 10)) { messageTextures.RemoveAt(messageTextures.Count - 1); tex.tex.Dispose(); /*if (messageTextures.Count > 0) * { * tex = messageTextures[messageTextures.Count - 1]; * long msvisible = tex.receivedTime + 3500 + 100 * (tex.message.Length - 10) - capi.World.ElapsedMilliseconds; * tex.receivedTime += Math.Max(0, 1000 - msvisible); * }*/ } } }
public override void BeforeRender(float dt) { if (!shapeFresh) { TesselateShape(); } lightrgbs = capi.World.BlockAccessor.GetLightRGBs((int)(entity.Pos.X + entity.SelectionBox.X1 - entity.OriginSelectionBox.X1), (int)entity.Pos.Y, (int)(entity.Pos.Z + entity.SelectionBox.Z1 - entity.OriginSelectionBox.Z1)); if (entity.SelectionBox.Y2 > 1) { Vec4f lightrgbs2 = capi.World.BlockAccessor.GetLightRGBs((int)(entity.Pos.X + entity.SelectionBox.X1 - entity.OriginSelectionBox.X1), (int)entity.Pos.Y + 1, (int)(entity.Pos.Z + entity.SelectionBox.Z1 - entity.OriginSelectionBox.Z1)); if (lightrgbs2.W > lightrgbs.W) { lightrgbs = lightrgbs2; } } if (meshRefOpaque == null && meshRefOit == null) { return; } if (gearInv == null && eagent?.GearInventory != null) { registerSlotModified(); shapeFresh = true; } if (capi.IsGamePaused) { return; } if (player == null && entity is EntityPlayer) { player = capi.World.PlayerByUid((entity as EntityPlayer).PlayerUID) as IClientPlayer; nameTagRenderHandler = capi.ModLoader.GetModSystem <EntityNameTagRendererRegistry>().GetNameTagRenderer(entity); OnNameChanged(); } isSpectator = player != null && player.WorldData.CurrentGameMode == EnumGameMode.Spectator; if (isSpectator) { return; } if (DisplayChatMessages && messageTextures.Count > 0) { MessageTexture tex = messageTextures.Last(); if (capi.World.ElapsedMilliseconds > tex.receivedTime + 3500 + 100 * (tex.message.Length - 10)) { messageTextures.RemoveAt(messageTextures.Count - 1); tex.tex.Dispose(); /*if (messageTextures.Count > 0) * { * tex = messageTextures[messageTextures.Count - 1]; * long msvisible = tex.receivedTime + 3500 + 100 * (tex.message.Length - 10) - capi.World.ElapsedMilliseconds; * tex.receivedTime += Math.Max(0, 1000 - msvisible); * }*/ } } if (player != null) { calcSidewaysSwivelForPlayer(dt); } else { calcSidewaysSwivelForEntity(dt); } frostAlphaAccum += dt; if (frostAlphaAccum > 5) { frostAlphaAccum = 0; targetFrostAlpha = getFrostAlpha(); } }
public override void BeforeRender(float dt) { if (meshRefOpaque == null && meshRefOit == null) { return; } if (capi.IsGamePaused) { return; } if (HeadControl && player == null && entity is EntityPlayer) { player = capi.World.PlayerByUid((entity as EntityPlayer).PlayerUID); } isSpectator = player != null && player.WorldData.CurrentGameMode == EnumGameMode.Spectator; if (isSpectator) { return; } curAnimator.FastMode = !DoRenderHeldItem && !capi.Settings.Bool["highQualityAnimations"]; if (DisplayChatMessages && messageTextures.Count > 0) { MessageTexture tex = messageTextures.Last(); if (capi.World.ElapsedMilliseconds > tex.receivedTime + 3500 + 100 * (tex.message.Length - 10)) { messageTextures.RemoveAt(messageTextures.Count - 1); tex.tex.Dispose(); if (messageTextures.Count > 0) { tex = messageTextures[messageTextures.Count - 1]; long msvisible = tex.receivedTime + 3500 + 100 * (tex.message.Length - 10) - capi.World.ElapsedMilliseconds; tex.receivedTime += Math.Max(0, 1000 - msvisible); } } } if (HeadControl) { /*if (player == api.World.Player && api.Render.CameraType == EnumCameraMode.FirstPerson) * { * AttachmentPointAndPose apap = null; * curAnimator.AttachmentPointByCode.TryGetValue("Eyes", out apap); * float[] tmpMat = Mat4f.Create(); * * for (int i = 0; i < 16; i++) tmpMat[i] = ModelMat[i]; * AttachmentPoint ap = apap.AttachPoint; * * float[] mat = apap.Pose.AnimModelMatrix; * Mat4f.Mul(tmpMat, tmpMat, mat); * * Mat4f.Translate(tmpMat, tmpMat, (float)ap.PosX / 16f, (float)ap.PosY / 16f, (float)ap.PosZ / 16f); * Mat4f.RotateX(tmpMat, tmpMat, (float)(ap.RotationX) * GameMath.DEG2RAD); * Mat4f.RotateY(tmpMat, tmpMat, (float)(ap.RotationY) * GameMath.DEG2RAD); * Mat4f.RotateZ(tmpMat, tmpMat, (float)(ap.RotationZ) * GameMath.DEG2RAD); * float[] vec = new float[] { 0,0,0, 0 }; * float[] outvec = Mat4f.MulWithVec4(tmpMat, vec); * * api.Render.CameraOffset.Translation.Set(outvec[0], outvec[1] + 1, outvec[2]); * }*/ float diff = GameMath.AngleRadDistance(bodyYaw, entity.Pos.Yaw); if (Math.Abs(diff) > GameMath.PIHALF * 1.2f) { opposite = true; } if (opposite) { if (Math.Abs(diff) < GameMath.PIHALF * 0.9f) { opposite = false; } else { diff = 0; } } headYaw += (diff - headYaw) * dt * 6; headYaw = GameMath.Clamp(headYaw, -0.75f, 0.75f); curAnimator.HeadYaw = headYaw; curAnimator.HeadPitch = GameMath.Clamp((entity.Pos.Pitch - GameMath.PI) * 0.75f, -1.2f, 1.2f); if (capi.World.Player.CameraMode == EnumCameraMode.Overhead || capi.World.Player.Entity.MountedOn != null) { bodyYaw = entity.Pos.Yaw; } else { float yawDist = GameMath.AngleRadDistance(bodyYaw, entity.Pos.Yaw); if (Math.Abs(yawDist) > 1f - (capi.World.Player.Entity.Controls.TriesToMove ? 0.99f : 0) || rotateTpYawNow) { bodyYaw += GameMath.Clamp(yawDist, -dt * 3, dt * 3); rotateTpYawNow = Math.Abs(yawDist) > 0.01f; } } } else { curAnimator.HeadYaw = entity.Pos.Yaw; curAnimator.HeadPitch = entity.Pos.Pitch; } curAnimator.OnFrame(dt); }