Remove commented printf

This commit is contained in:
Tnze
2021-02-18 13:38:43 +08:00
parent 0daf131f75
commit 750f87e780
6 changed files with 8 additions and 32 deletions

View File

@ -211,8 +211,6 @@ func (c *Client) handlePacket(p pk.Packet) (disconnect bool, err error) {
err = handleNamedSoundEffect(c, p)
case data.Experience:
err = handleSetExperience(c, p)
default:
// fmt.Printf("ignore pack id %X\n", p.ID)
}
return
}
@ -238,7 +236,6 @@ func handleSpawnPlayerPacket(c *Client, p pk.Packet) error {
if err := se.Decode(p); err != nil {
return err
}
fmt.Println(se)
return c.Wd.OnSpawnPlayer(se)
}
@ -271,7 +268,6 @@ func handleEntityMovePacket(c *Client, p pk.Packet) error {
if err := p.Scan(&id); err != nil {
return err
}
fmt.Printf("EntityMove (probs didnt for players): %+v\n", id)
return nil
}
@ -280,7 +276,6 @@ func handleEntityAnimationPacket(c *Client, p pk.Packet) error {
if err := se.Decode(p); err != nil {
return err
}
// fmt.Printf("EntityAnimationClientbound: %+v\n", se)
return nil
}
@ -292,7 +287,6 @@ func handleEntityStatusPacket(c *Client, p pk.Packet) error {
if err := p.Scan(&id, &status); err != nil {
return err
}
// fmt.Printf("EntityStatus: %v, %v\n", id, status)
return nil
}

View File

@ -118,7 +118,6 @@ const (
)
func (m Movement) Possible(nav *Nav, x, y, z int, from V3, previous Movement) bool {
// fmt.Printf("%s.Possible(%d,%d,%d)\n", m, x, y, z)
switch m {
case Waypoint, TraverseNorth, TraverseSouth, TraverseEast, TraverseWest:
if !SteppableBlock(nav.World.GetBlockStatus(x, y, z)) {

View File

@ -87,7 +87,6 @@ func (t Tile) PathNeighbors() []astar.Pather {
x, y, z := m.Offset()
pos := V3{X: t.Pos.X + x, Y: t.Pos.Y + y, Z: t.Pos.Z + z}
possible := m.Possible(t.Nav, pos.X, pos.Y, pos.Z, t.Pos, t.Movement)
// fmt.Printf("%v-%v: Trying (%v) %v: possible=%v\n", t.Movement, t.Pos, pos, m, possible)
if possible {
bStateID := t.Nav.World.GetBlockStatus(pos.X, pos.Y, pos.Z)
possibles = append(possibles, Tile{
@ -100,7 +99,6 @@ func (t Tile) PathNeighbors() []astar.Pather {
}
}
// fmt.Printf("%v.Neighbours(): %+v\n", t.Pos, possibles)
return possibles
}
@ -206,6 +204,5 @@ func (t Tile) IsComplete(d Point) bool {
yLowerCutoff -= 0.5
}
// fmt.Println(t.HalfBlock, d.Y, d.Y >= yLowerCutoff, d.Y <= 0.08)
return (d.X*d.X+d.Z*d.Z) < (0.18*0.18) && d.Y >= yLowerCutoff && d.Y <= 0.08
}

View File

@ -3,7 +3,6 @@
package phy
import (
"fmt"
"math"
"github.com/Tnze/go-mc/bot/path"
@ -60,8 +59,6 @@ type State struct {
}
func (s *State) ServerPositionUpdate(player player.Pos, w World) error {
fmt.Printf("TELEPORT (y=%0.2f, velY=%0.3f): %0.2f, %0.2f, %0.2f\n", s.Pos.Y, s.Vel.Y, player.X-s.Pos.X, player.Y-s.Pos.Y, player.Z-s.Pos.Z)
s.Pos = path.Point{X: player.X, Y: player.Y, Z: player.Z}
s.Yaw, s.Pitch = float64(player.Yaw), float64(player.Pitch)
s.Vel = path.Point{}
@ -186,7 +183,6 @@ func (s *State) applyLookInputs(input path.Inputs) {
}
func (s *State) applyPosInputs(input path.Inputs, acceleration, inertia float64) {
// fmt.Println(input.Jump, s.lastJump, s.onGround)
if input.Jump && s.lastJump+minJumpTicks < s.tick && s.onGround {
s.lastJump = s.tick
s.Vel.Y = 0.42
@ -206,15 +202,10 @@ func (s *State) applyPosInputs(input path.Inputs, acceleration, inertia float64)
}
func (s *State) tickPosition(w World) {
// fmt.Printf("TICK POSITION: %0.2f, %0.2f, %0.2f - (%0.2f, %0.2f, %0.2f)\n", s.Pos.X, s.Pos.Y, s.Pos.Z, s.Vel.X, s.Vel.Y, s.Vel.Z)
player, newVel := s.computeCollisionYXZ(s.BB(), s.BB().Offset(s.Vel.X, s.Vel.Y, s.Vel.Z), s.Vel, w)
//fmt.Printf("offset = %0.2f, %0.2f, %0.2f\n", player.X.Min-s.Pos.X, player.Y.Min-s.Pos.Y, player.Z.Min-s.Pos.Z)
//fmt.Printf("onGround = %v, s.Vel.Y = %0.3f, newVel.Y = %0.3f\n", s.onGround, s.Vel.Y, newVel.Y)
if s.onGround || (s.Vel.Y != newVel.Y && s.Vel.Y < 0) {
bb := s.BB()
//fmt.Printf("Player pos = %0.2f, %0.2f, %0.2f\n", bb.X.Min, bb.Y.Min, bb.Z.Min)
surroundings := s.surroundings(bb.Offset(s.Vel.X, stepHeight, s.Vel.Z), w)
outVel := s.Vel
@ -231,7 +222,6 @@ func (s *State) tickPosition(w World) {
outVel.Z = b.ZOffset(bb, outVel.Z)
}
bb = bb.Offset(0, 0, outVel.Z)
//fmt.Printf("Post-collision = %0.2f, %0.2f, %0.2f\n", bb.X.Min, bb.Y.Min, bb.Z.Min)
outVel.Y *= -1
// Lower the player back down to be on the ground.
@ -239,11 +229,10 @@ func (s *State) tickPosition(w World) {
outVel.Y = b.YOffset(bb, outVel.Y)
}
bb = bb.Offset(0, outVel.Y, 0)
//fmt.Printf("Post-lower = %0.2f, %0.2f, %0.2f\n", bb.X.Min, bb.Y.Min, bb.Z.Min)
oldMove := newVel.X*newVel.X + newVel.Z*newVel.Z
newMove := outVel.X*outVel.X + outVel.Z*outVel.Z
// fmt.Printf("oldMove/newmove = %v, (%0.2f >= %0.6f) = %v\n", oldMove >= newMove, outVel.Y, 0.000002-stepHeight, outVel.Y <= (0.000002-stepHeight))
if oldMove >= newMove || outVel.Y <= (0.000002-stepHeight) {
// fmt.Println("nope")
} else {
@ -269,7 +258,6 @@ func modYaw(new, old float64) float64 {
} else if delta < -180 {
delta += 360
}
// fmt.Printf("(%.2f - %.2f) = %.2f\n", new, old, delta)
return delta
}

View File

@ -63,7 +63,6 @@ func (w *World) OnSpawnLivingEntity(pkt ptypes.SpawnLivingEntity) error {
return fmt.Errorf("unknown entity ID %v", pkt.Type)
}
// fmt.Printf("SpawnLivingEntity %q\n", base.Name)
w.Entities[int32(pkt.ID)] = &entity.Entity{
ID: int32(pkt.ID),
Base: base,
@ -87,7 +86,6 @@ func (w *World) OnSpawnPlayer(pkt ptypes.SpawnPlayer) error {
w.entityLock.Lock()
defer w.entityLock.Unlock()
// fmt.Printf("SpawnPlayer %v\n", pkt)
w.Entities[int32(pkt.ID)] = &entity.Entity{
ID: int32(pkt.ID),
Base: &e.Player,

View File

@ -20,11 +20,11 @@ func (i Info) HotbarIdx(place int) int {
}
var ByType = map[int]Info{
-1: Info{Name: "inventory", Start: 9, End: 44, Slots: 46},
0: Info{Name: "generic_9x1", Start: 1 * 9, End: 1*9 + 35, Slots: 1*9 + 36},
1: Info{Name: "generic_9x2", Start: 2 * 9, End: 2*9 + 35, Slots: 2*9 + 36},
2: Info{Name: "generic_9x3", Start: 3 * 9, End: 3*9 + 35, Slots: 3*9 + 36},
3: Info{Name: "generic_9x4", Start: 4 * 9, End: 4*9 + 35, Slots: 4*9 + 36},
4: Info{Name: "generic_9x5", Start: 5 * 9, End: 5*9 + 35, Slots: 5*9 + 36},
5: Info{Name: "generic_9x6", Start: 6 * 9, End: 6*9 + 35, Slots: 6*9 + 36},
-1: {Name: "inventory", Start: 9, End: 44, Slots: 46},
0: {Name: "generic_9x1", Start: 1 * 9, End: 1*9 + 35, Slots: 1*9 + 36},
1: {Name: "generic_9x2", Start: 2 * 9, End: 2*9 + 35, Slots: 2*9 + 36},
2: {Name: "generic_9x3", Start: 3 * 9, End: 3*9 + 35, Slots: 3*9 + 36},
3: {Name: "generic_9x4", Start: 4 * 9, End: 4*9 + 35, Slots: 4*9 + 36},
4: {Name: "generic_9x5", Start: 5 * 9, End: 5*9 + 35, Slots: 5*9 + 36},
5: {Name: "generic_9x6", Start: 6 * 9, End: 6*9 + 35, Slots: 6*9 + 36},
}