fix waterlogged water
This commit is contained in:
parent
e1eec55baf
commit
dab34bcf58
2
go.mod
2
go.mod
|
@ -27,7 +27,7 @@ require (
|
|||
|
||||
//replace github.com/df-mc/dragonfly => ./dragonfly
|
||||
|
||||
replace github.com/sandertv/gophertunnel => github.com/olebeck/gophertunnel v1.24.8-4
|
||||
replace github.com/sandertv/gophertunnel => github.com/olebeck/gophertunnel v1.24.8-5
|
||||
|
||||
replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.8.3-2
|
||||
|
||||
|
|
2
go.sum
2
go.sum
|
@ -47,6 +47,8 @@ github.com/olebeck/dragonfly v0.8.3-2 h1:SEhAX9JuEnTjRmG63tSZp8+8rJviJr1kVshFn8p
|
|||
github.com/olebeck/dragonfly v0.8.3-2/go.mod h1:ObfYlB77fxGLqU2CLquvk8ibAEMYoixiXfs7pxrOGCI=
|
||||
github.com/olebeck/gophertunnel v1.24.8-4 h1:V0Giy93JYDzR6NhtXOw/UcWpY85Jt/czp7xcAfJz22Y=
|
||||
github.com/olebeck/gophertunnel v1.24.8-4/go.mod h1:dMOw79FHxr2azEqiGH20AwdljisAN1kqwu5SjPBnZ5k=
|
||||
github.com/olebeck/gophertunnel v1.24.8-5 h1:hOxMUYbrPq6KlAkSgb506iURRj3l4e/4Ze/qQeSffds=
|
||||
github.com/olebeck/gophertunnel v1.24.8-5/go.mod h1:dMOw79FHxr2azEqiGH20AwdljisAN1kqwu5SjPBnZ5k=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package subcommands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"strings"
|
||||
|
||||
"github.com/bedrock-tool/bedrocktool/utils"
|
||||
|
||||
"github.com/google/subcommands"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type DebugProxyCMD struct {
|
||||
Address string
|
||||
filter string
|
||||
}
|
||||
|
||||
func (*DebugProxyCMD) Name() string { return "debug-proxy" }
|
||||
func (*DebugProxyCMD) Synopsis() string { return "verbose debug packets" }
|
||||
|
||||
func (c *DebugProxyCMD) SetFlags(f *flag.FlagSet) {
|
||||
f.StringVar(&c.Address, "address", "", "remote server address")
|
||||
f.StringVar(&c.filter, "filter", "", "packets to not show")
|
||||
}
|
||||
|
||||
func (c *DebugProxyCMD) Usage() string {
|
||||
return c.Name() + ": " + c.Synopsis() + "\n" + utils.SERVER_ADDRESS_HELP
|
||||
}
|
||||
|
||||
func (c *DebugProxyCMD) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
address, _, err := utils.ServerInput(c.Address)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return 1
|
||||
}
|
||||
|
||||
utils.G_debug = true
|
||||
|
||||
filters := strings.Split(c.filter, ",")
|
||||
if len(filters) > 0 {
|
||||
for _, v := range filters {
|
||||
if string(v[0]) == "*" {
|
||||
v = v[1:]
|
||||
}
|
||||
v = strings.TrimPrefix(v, "packet.")
|
||||
v = "packet." + v
|
||||
utils.ExtraVerbose = append(utils.ExtraVerbose, v)
|
||||
}
|
||||
}
|
||||
|
||||
proxy := utils.NewProxy(logrus.StandardLogger())
|
||||
if err := proxy.Run(ctx, address); err != nil {
|
||||
logrus.Error(err)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
utils.RegisterCommand(&DebugProxyCMD{})
|
||||
}
|
|
@ -22,8 +22,10 @@ func blockColorAt(c *chunk.Chunk, x uint8, y int16, z uint8) (blockColor color.R
|
|||
if found {
|
||||
if _, ok := b.(block.Water); ok {
|
||||
y2 := c.HeightMap().At(x, z)
|
||||
blockColor = blockColorAt(c, x, y2, z)
|
||||
depth := y - y2
|
||||
if depth > 0 {
|
||||
blockColor = blockColorAt(c, x, y2, z)
|
||||
}
|
||||
|
||||
bw := (&block.Water{}).Color()
|
||||
bw.A = uint8(utils.Clamp(int(150+depth*7), 255))
|
||||
|
|
|
@ -215,11 +215,9 @@ func (m *MapUI) Redraw() {
|
|||
}
|
||||
|
||||
func (m *MapUI) SetChunk(pos protocol.ChunkPos, ch *chunk.Chunk) {
|
||||
var img *image.RGBA
|
||||
var img *image.RGBA = black_16x16
|
||||
if ch != nil {
|
||||
img = Chunk2Img(ch)
|
||||
} else {
|
||||
img = black_16x16
|
||||
}
|
||||
m.image_lock.Lock() // dont send while adding a chunk
|
||||
m.chunks_images[pos] = img
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
|
||||
_ "github.com/df-mc/dragonfly/server/block" // to load blocks
|
||||
//_ "net/http/pprof"
|
||||
)
|
||||
|
||||
type TPlayerPos struct {
|
||||
|
@ -121,6 +122,12 @@ func (c *WorldCMD) Usage() string {
|
|||
}
|
||||
|
||||
func (c *WorldCMD) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||
/*
|
||||
go func() {
|
||||
http.ListenAndServe(":8000", nil)
|
||||
}()
|
||||
*/
|
||||
|
||||
server_address, hostname, err := utils.ServerInput(c.Address)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
|
@ -165,6 +172,11 @@ func (w *WorldState) toggleVoid(cmdline []string) bool {
|
|||
}
|
||||
|
||||
func (w *WorldState) ProcessLevelChunk(pk *packet.LevelChunk) {
|
||||
_, exists := w.chunks[pk.Position]
|
||||
if exists {
|
||||
return
|
||||
}
|
||||
|
||||
ch, blockNBTs, err := chunk.NetworkDecode(6692, pk.RawPayload, int(pk.SubChunkCount), w.Dim.Range(), w.ispre118)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
|
@ -176,15 +188,12 @@ func (w *WorldState) ProcessLevelChunk(pk *packet.LevelChunk) {
|
|||
}] = blockNBTs
|
||||
}
|
||||
|
||||
existing := w.chunks[pk.Position]
|
||||
if existing == nil {
|
||||
w.chunks[pk.Position] = ch
|
||||
w.ui.SetChunk(pk.Position, nil)
|
||||
}
|
||||
w.chunks[pk.Position] = ch
|
||||
|
||||
if pk.SubChunkRequestMode == protocol.SubChunkRequestModeLegacy {
|
||||
w.ui.SetChunk(pk.Position, ch)
|
||||
} else {
|
||||
w.ui.SetChunk(pk.Position, nil)
|
||||
// request all the subchunks
|
||||
|
||||
max := w.Dim.Range().Height() / 16
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
var Pool = packet.NewPool()
|
||||
|
||||
var muted_packets = []string{
|
||||
var MutedPackets = []string{
|
||||
"packet.UpdateBlock",
|
||||
"packet.MoveActorAbsolute",
|
||||
"packet.SetActorMotion",
|
||||
|
@ -41,6 +41,8 @@ var muted_packets = []string{
|
|||
"packet.InventoryTransaction",
|
||||
}
|
||||
|
||||
var ExtraVerbose []string
|
||||
|
||||
func PacketLogger(header packet.Header, payload []byte, src, dst net.Addr) {
|
||||
var pk packet.Packet
|
||||
if pkFunc, ok := Pool[header.PacketID]; ok {
|
||||
|
@ -51,13 +53,15 @@ func PacketLogger(header packet.Header, payload []byte, src, dst net.Addr) {
|
|||
pk.Unmarshal(protocol.NewReader(bytes.NewBuffer(payload), 0))
|
||||
|
||||
pk_name := reflect.TypeOf(pk).String()[1:]
|
||||
if slices.Contains(muted_packets, pk_name) {
|
||||
if slices.Contains(MutedPackets, pk_name) {
|
||||
return
|
||||
}
|
||||
|
||||
switch pk := pk.(type) {
|
||||
case *packet.Disconnect:
|
||||
logrus.Infof("Disconnect: %s", pk.Message)
|
||||
case *packet.Event:
|
||||
logrus.Infof("Event %d %+v", pk.EventType, pk.EventData)
|
||||
}
|
||||
|
||||
dir := color.GreenString("S") + "->" + color.CyanString("C")
|
||||
|
@ -67,4 +71,8 @@ func PacketLogger(header packet.Header, payload []byte, src, dst net.Addr) {
|
|||
}
|
||||
|
||||
logrus.Debugf("%s 0x%02x, %s", dir, pk.ID(), pk_name)
|
||||
|
||||
if slices.Contains(ExtraVerbose, pk_name) {
|
||||
logrus.Debugf("%+v\n", pk)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue