Merge remote-tracking branch '1.16.2/nugget/minecraft-1.16.2'

This commit is contained in:
Tom
2020-09-11 15:38:04 -07:00
4 changed files with 35 additions and 22 deletions

View File

@ -1,6 +1,6 @@
# Go-MC
![Version](https://img.shields.io/badge/Minecraft-1.16.1-blue.svg)
![Protocol](https://img.shields.io/badge/Protocol-736-blue.svg)
![Version](https://img.shields.io/badge/Minecraft-1.16.2-blue.svg)
![Protocol](https://img.shields.io/badge/Protocol-751-blue.svg)
[![GoDoc](https://godoc.org/github.com/Tnze/go-mc?status.svg)](https://godoc.org/github.com/Tnze/go-mc)
[![Go Report Card](https://goreportcard.com/badge/github.com/Tnze/go-mc)](https://goreportcard.com/report/github.com/Tnze/go-mc)
[![Build Status](https://travis-ci.org/Tnze/go-mc.svg?branch=master)](https://travis-ci.org/Tnze/go-mc)

View File

@ -4,9 +4,10 @@ import (
"bytes"
"errors"
"fmt"
"github.com/google/uuid"
"io/ioutil"
"github.com/google/uuid"
"github.com/Tnze/go-mc/bot/world"
"github.com/Tnze/go-mc/bot/world/entity"
"github.com/Tnze/go-mc/chat"
@ -331,6 +332,7 @@ func handleUpdateHealthPacket(c *Client, p pk.Packet) (err error) {
func handleJoinGamePacket(c *Client, p pk.Packet) error {
var (
eid pk.Int
hardcore pk.Boolean
gamemode pk.UnsignedByte
previousGm pk.UnsignedByte
worldCount pk.VarInt
@ -340,14 +342,14 @@ func handleJoinGamePacket(c *Client, p pk.Packet) error {
dimension pk.Int
worldName pk.Identifier
hashedSeed pk.Long
maxPlayers pk.UnsignedByte
maxPlayers pk.VarInt
viewDistance pk.VarInt
rdi pk.Boolean // Reduced Debug Info
ers pk.Boolean // Enable respawn screen
isDebug pk.Boolean
isFlat pk.Boolean
)
err := p.Scan(&eid, &gamemode, &previousGm, &worldCount, &worldNames, &dimension, &worldName,
err := p.Scan(&eid, &hardcore, &gamemode, &previousGm, &worldCount, &worldNames, &dimension, &worldName,
&hashedSeed, &maxPlayers, &rdi, &ers, &isDebug, &isFlat)
if err != nil {
return err
@ -453,17 +455,17 @@ func handleChunkDataPacket(c *Client, p pk.Packet) error {
if !c.settings.ReceiveMap {
return nil
}
var (
X, Z pk.Int
FullChunk pk.Boolean
IgnoreOldData pk.Boolean
PrimaryBitMask pk.VarInt
Heightmaps struct{}
Biomes = biomesData{fullChunk: (*bool)(&FullChunk)}
Data chunkData
BlockEntities blockEntities
)
if err := p.Scan(&X, &Z, &FullChunk, &IgnoreOldData, &PrimaryBitMask, pk.NBT{V: &Heightmaps}, &Biomes, &Data, &BlockEntities); err != nil {
if err := p.Scan(&X, &Z, &FullChunk, &PrimaryBitMask, pk.NBT{V: &Heightmaps}, &Biomes, &Data, &BlockEntities); err != nil {
return err
}
chunk, err := world.DecodeChunkColumn(int32(PrimaryBitMask), Data)
@ -478,19 +480,29 @@ func handleChunkDataPacket(c *Client, p pk.Packet) error {
type biomesData struct {
fullChunk *bool
data [1024]int32
data []pk.VarInt
}
func (b *biomesData) Decode(r pk.DecodeReader) error {
if b.fullChunk == nil || !*b.fullChunk {
return nil
}
for i := range b.data {
err := (*pk.Int)(&b.data[i]).Decode(r)
if err != nil {
var nobd pk.VarInt // Number of Biome Datums
if err := nobd.Decode(r); err != nil {
return err
}
b.data = make([]pk.VarInt, nobd)
for i := 0; i < int(nobd); i++ {
var d pk.VarInt
if err := d.Decode(r); err != nil {
return err
}
b.data[i] = d
}
return nil
}

View File

@ -14,7 +14,7 @@ import (
)
// ProtocolVersion , the protocol version number of minecraft net protocol
const ProtocolVersion = 736
const ProtocolVersion = 751
// JoinServer connect a Minecraft server for playing the game.
func (c *Client) JoinServer(addr string, port int) (err error) {

View File

@ -17,10 +17,9 @@ const (
BossBar
ServerDifficulty
ChatMessageClientbound
MultiBlockChange
TabComplete
TabComplete //0x10
DeclareCommands
DeclareCommands //0x10
WindowConfirmationClientbound
CloseWindowClientbound
WindowItems
@ -35,9 +34,9 @@ const (
UnloadChunk
ChangeGameState
OpenHorseWindow
KeepAliveClientbound
KeepAliveClientbound //0x20
ChunkData
ChunkData //0x20
Effect
Particle
UpdateLight
@ -52,9 +51,9 @@ const (
OpenBook
OpenWindow
OpenSignEditor
CraftRecipeResponse
CraftRecipeResponse //0x30
PlayerAbilitiesClientbound
PlayerAbilitiesClientbound //0x30
CombatEvent
PlayerInfo
FacePlayer
@ -65,6 +64,7 @@ const (
ResourcePackSend
Respawn
EntityHeadLook
MultiBlockChange
SelectAdvancementTab
WorldBorder
Camera
@ -134,10 +134,11 @@ const (
PlayerDigging
EntityAction
SteerVehicle
DisplayedRecipe
RecipeBookData
NameItem
ResourcePackStatus //0x20
NameItem //0x20
ResourcePackStatus
AdvancementTab
SelectTrade
SetBeaconEffect
@ -151,5 +152,5 @@ const (
AnimationServerbound
Spectate
PlayerBlockPlacement
UseItem //0x2E
UseItem //0x2F
)