Replace all interface{} to any
This commit is contained in:
@ -38,7 +38,7 @@ func (p Packet) Scan(fields ...FieldDecoder) error {
|
||||
}
|
||||
|
||||
var bufPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
New: func() any {
|
||||
return new(bytes.Buffer)
|
||||
},
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ func ExamplePacket_Scan_joinGame() {
|
||||
PreGamemode pk.Byte
|
||||
WorldNames = []pk.Identifier{} // This cannot replace with "var DimensionNames []pk.Identifier" because "nil" has no type information
|
||||
DimensionCodec struct {
|
||||
DimensionType interface{} `nbt:"minecraft:dimension_type"`
|
||||
WorldgenBiome interface{} `nbt:"minecraft:worldgen/biome"`
|
||||
DimensionType any `nbt:"minecraft:dimension_type"`
|
||||
WorldgenBiome any `nbt:"minecraft:worldgen/biome"`
|
||||
}
|
||||
Dimension interface{}
|
||||
Dimension any
|
||||
WorldName pk.Identifier
|
||||
HashedSeed pk.Long
|
||||
MaxPlayers pk.VarInt
|
||||
@ -181,7 +181,7 @@ func ExampleMarshal_setSlot() {
|
||||
Present bool
|
||||
ItemID int
|
||||
ItemCount byte
|
||||
NBT interface{}
|
||||
NBT any
|
||||
}{
|
||||
{WindowID: 0, Slot: 5, Present: false},
|
||||
{WindowID: 0, Slot: 5, Present: true, ItemID: 0x01, ItemCount: 1, NBT: pk.Byte(0)},
|
||||
|
@ -467,7 +467,7 @@ func (d *Double) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
}
|
||||
|
||||
// NBT encode a value as Named Binary Tag
|
||||
func NBT(v interface{}, optionalTagName ...string) Field {
|
||||
func NBT(v any, optionalTagName ...string) Field {
|
||||
if len(optionalTagName) > 0 {
|
||||
return nbtField{V: v, FieldName: optionalTagName[0]}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ var (
|
||||
//
|
||||
// Note that Ary DO read or write the Len. You aren't need to do so by your self.
|
||||
type Ary[LEN VarInt | VarLong | Byte | UnsignedByte | Short | UnsignedShort | Int | Long] struct {
|
||||
Ary interface{} // Slice or Pointer of Slice of FieldEncoder, FieldDecoder or both (Field)
|
||||
Ary any // Slice or Pointer of Slice of FieldEncoder, FieldDecoder or both (Field)
|
||||
}
|
||||
|
||||
func (a Ary[LEN]) WriteTo(w io.Writer) (n int64, err error) {
|
||||
|
@ -90,7 +90,7 @@ func (r *RCONConn) ReadPacket() (RequestID, Type int32, Payload string, err erro
|
||||
func (r *RCONConn) WritePacket(RequestID, Type int32, Payload string) error {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
for _, v := range []interface{}{
|
||||
for _, v := range []any{
|
||||
int32(4 + 4 + len(Payload) + 2), // Length
|
||||
RequestID, // Request ID
|
||||
Type, // Type
|
||||
|
Reference in New Issue
Block a user