public override void Tick(double delta) { if (!game.World.HasBlocks) { return; } StepSize = Hacks.FullBlockStep && Hacks.Enabled && Hacks.CanAnyHacks && Hacks.CanSpeed ? 1 : 0.5f; OldVelocity = Velocity; float xMoving = 0, zMoving = 0; interp.AdvanceState(); bool wasOnGround = onGround; HandleInput(ref xMoving, ref zMoving); if (!Hacks.Floating && Hacks.CanBePushed) { physics.DoEntityPush(); } // Immediate stop in noclip mode if (!Hacks.NoclipSlide && (Hacks.Noclip && xMoving == 0 && zMoving == 0)) { Velocity = Vector3.Zero; } physics.UpdateVelocityState(); physics.PhysicsTick(GetHeadingVelocity(zMoving, xMoving)); interp.next.Pos = Position; Position = interp.prev.Pos; anim.UpdateAnimState(interp.prev.Pos, interp.next.Pos, delta); tilt.UpdateAnimState(delta); CheckSkin(); sound.Tick(wasOnGround); }
public override void Tick(double delta) { if (!game.World.HasBlocks) { return; } StepSize = Hacks.FullBlockStep && Hacks.Enabled && Hacks.CanAnyHacks && Hacks.CanSpeed ? 1 : 0.5f; OldVelocity = Velocity; float xMoving = 0, zMoving = 0; interp.AdvanceState(); bool wasOnGround = onGround; HandleInput(ref xMoving, ref zMoving); Hacks.Floating = Hacks.Noclip || Hacks.Flying; if (!Hacks.Floating && Hacks.CanBePushed) { physics.DoEntityPush(); } // Immediate stop in noclip mode if (!Hacks.NoclipSlide && (Hacks.Noclip && xMoving == 0 && zMoving == 0)) { Velocity = Vector3.Zero; } physics.UpdateVelocityState(); Vector3 headingVelocity = Utils.RotateY(xMoving, 0, zMoving, HeadYRadians); physics.PhysicsTick(headingVelocity); // Fixes high jump, when holding down a movement key, jump, fly, then let go of fly key if (Hacks.Floating) { Velocity.Y = 0.0f; } interp.next.Pos = Position; Position = interp.prev.Pos; anim.UpdateAnimState(interp.prev.Pos, interp.next.Pos, delta); tilt.UpdateAnimState(delta); CheckSkin(); sound.Tick(wasOnGround); }
public override void Tick(double delta) { if (!game.World.HasBlocks) { return; } OldVelocity = Velocity; interp.AdvanceState(); physics.UpdateVelocityState(); bool sprite = BlockInfo.Draw[ItemId] == DrawType.Sprite; physics.PhysicsTick(Vector3.Zero); interp.next.Pos = Position; Position = interp.prev.Pos; //if (sprite) { // interp.prevRotY = RotY; interp.nextRotY = game.LocalPlayer.HeadY - 45f; //} anim.UpdateAnimState(interp.prev.Pos, interp.next.Pos, delta); SurvivalGameMode surv = null; if (game.Mode.GetType() == typeof(SurvivalGameMode)) { surv = (SurvivalGameMode)game.Mode; } for (int id = 0; id < EntityList.MaxCount; id++) { Entity other = game.Entities.List[id]; if (other != game.LocalPlayer) { continue; } if (other == null || other == this) { continue; } //if (!other.Model.Pushes) continue; bool yIntersects = this.Position.Y <= (other.Position.Y + other.Size.Y) && other.Position.Y <= (this.Position.Y + this.Size.Y); if (!yIntersects) { continue; } float dX = other.Position.X - this.Position.X; float dZ = other.Position.Z - this.Position.Z; float dist = dX * dX + dZ * dZ; if (dist > 1.5f) { continue; // TODO: range needs to be lower? } if (surv == null) { int changeInv = 0; changeInv = game.Inventory.SelectedIndex; game.Inventory[changeInv] = this.ItemId; int entId = game.Entities.GetEntityID(this); game.Entities.RemoveEntity((byte)entId); break; } else { //surv.AddToHotbar(ItemId, ItemCount); game.SurvInv.TryAddItem(ItemCount, ItemId); int entId = game.Entities.GetEntityID(this); game.Entities.RemoveEntity((byte)entId); break; } } }