Fix server for 1.19.4
This commit is contained in:
@ -410,20 +410,9 @@ func (p *Position) ReadFrom(r io.Reader) (n int64, err error) {
|
|||||||
n += nn
|
n += nn
|
||||||
|
|
||||||
x := int(v >> 38)
|
x := int(v >> 38)
|
||||||
y := int(v & 0xFFF)
|
y := int(v << 52 >> 52)
|
||||||
z := int(v << 26 >> 38)
|
z := int(v << 26 >> 38)
|
||||||
|
|
||||||
// 处理负数
|
|
||||||
if x >= 1<<25 {
|
|
||||||
x -= 1 << 26
|
|
||||||
}
|
|
||||||
if y >= 1<<11 {
|
|
||||||
y -= 1 << 12
|
|
||||||
}
|
|
||||||
if z >= 1<<25 {
|
|
||||||
z -= 1 << 26
|
|
||||||
}
|
|
||||||
|
|
||||||
p.X, p.Y, p.Z = x, y, z
|
p.X, p.Y, p.Z = x, y, z
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -486,7 +475,7 @@ func NBT(v interface{}, optionalTagName ...string) Field {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type nbtField struct {
|
type nbtField struct {
|
||||||
V interface{}
|
V any
|
||||||
FieldName string
|
FieldName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
package registry
|
|
||||||
|
|
||||||
import "github.com/Tnze/go-mc/chat"
|
|
||||||
|
|
||||||
type ChatType struct {
|
|
||||||
Chat chat.Decoration `nbt:"chat"`
|
|
||||||
Narration chat.Decoration `nbt:"narration"`
|
|
||||||
}
|
|
@ -1,9 +1,50 @@
|
|||||||
package registry
|
package registry
|
||||||
|
|
||||||
import "github.com/Tnze/go-mc/nbt"
|
import (
|
||||||
|
"github.com/Tnze/go-mc/chat"
|
||||||
|
"github.com/Tnze/go-mc/nbt"
|
||||||
|
)
|
||||||
|
|
||||||
type NetworkCodec struct {
|
type NetworkCodec struct {
|
||||||
ChatType Registry[ChatType] `nbt:"minecraft:chat_type"`
|
ChatType Registry[ChatType] `nbt:"minecraft:chat_type"`
|
||||||
|
DamageType Registry[DamageType] `nbt:"minecraft:damage_type"`
|
||||||
DimensionType Registry[Dimension] `nbt:"minecraft:dimension_type"`
|
DimensionType Registry[Dimension] `nbt:"minecraft:dimension_type"`
|
||||||
|
TrimMaterial Registry[nbt.RawMessage] `nbt:"minecraft:trim_material"`
|
||||||
|
TrimPattern Registry[nbt.RawMessage] `nbt:"minecraft:trim_pattern"`
|
||||||
WorldGenBiome Registry[nbt.RawMessage] `nbt:"minecraft:worldgen/biome"`
|
WorldGenBiome Registry[nbt.RawMessage] `nbt:"minecraft:worldgen/biome"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChatType struct {
|
||||||
|
Chat chat.Decoration `nbt:"chat"`
|
||||||
|
Narration chat.Decoration `nbt:"narration"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DamageType struct {
|
||||||
|
MessageID string `nbt:"message_id"`
|
||||||
|
Scaling string `nbt:"scaling"`
|
||||||
|
Exhaustion float32 `nbt:"exhaustion"`
|
||||||
|
Effects string `nbt:"effects,omitempty"`
|
||||||
|
DeathMessageType string `nbt:"death_message_type,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Dimension struct {
|
||||||
|
FixedTime int64 `nbt:"fixed_time,omitempty"`
|
||||||
|
HasSkylight bool `nbt:"has_skylight"`
|
||||||
|
HasCeiling bool `nbt:"has_ceiling"`
|
||||||
|
Ultrawarm bool `nbt:"ultrawarm"`
|
||||||
|
Natural bool `nbt:"natural"`
|
||||||
|
CoordinateScale float64 `nbt:"coordinate_scale"`
|
||||||
|
BedWorks bool `nbt:"bed_works"`
|
||||||
|
RespawnAnchorWorks byte `nbt:"respawn_anchor_works"`
|
||||||
|
MinY int32 `nbt:"min_y"`
|
||||||
|
Height int32 `nbt:"height"`
|
||||||
|
LogicalHeight int32 `nbt:"logical_height"`
|
||||||
|
InfiniteBurn string `nbt:"infiniburn"`
|
||||||
|
Effects string `nbt:"effects"`
|
||||||
|
AmbientLight float64 `nbt:"ambient_light"`
|
||||||
|
|
||||||
|
PiglinSafe byte `nbt:"piglin_safe"`
|
||||||
|
HasRaids byte `nbt:"has_raids"`
|
||||||
|
MonsterSpawnLightLevel nbt.RawMessage `nbt:"monster_spawn_light_level"` // Tag_Int or {type:"minecraft:uniform", value:{min_inclusive: Tag_Int, max_inclusive: Tag_Int}}
|
||||||
|
MonsterSpawnBlockLightLimit int32 `nbt:"monster_spawn_block_light_limit"`
|
||||||
|
}
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package registry
|
|
||||||
|
|
||||||
import "github.com/Tnze/go-mc/nbt"
|
|
||||||
|
|
||||||
type Dimension struct {
|
|
||||||
FixedTime int64 `nbt:"fixed_time,omitempty"`
|
|
||||||
HasSkylight bool `nbt:"has_skylight"`
|
|
||||||
HasCeiling bool `nbt:"has_ceiling"`
|
|
||||||
Ultrawarm bool `nbt:"ultrawarm"`
|
|
||||||
Natural bool `nbt:"natural"`
|
|
||||||
CoordinateScale float64 `nbt:"coordinate_scale"`
|
|
||||||
BedWorks bool `nbt:"bed_works"`
|
|
||||||
RespawnAnchorWorks byte `nbt:"respawn_anchor_works"`
|
|
||||||
MinY int32 `nbt:"min_y"`
|
|
||||||
Height int32 `nbt:"height"`
|
|
||||||
LogicalHeight int32 `nbt:"logical_height"`
|
|
||||||
InfiniteBurn string `nbt:"infiniburn"`
|
|
||||||
Effects string `nbt:"effects"`
|
|
||||||
AmbientLight float64 `nbt:"ambient_light"`
|
|
||||||
|
|
||||||
PiglinSafe byte `nbt:"piglin_safe"`
|
|
||||||
HasRaids byte `nbt:"has_raids"`
|
|
||||||
MonsterSpawnLightLevel nbt.RawMessage `nbt:"monster_spawn_light_level"` // Tag_Int or {type:"minecraft:uniform", value:{min_inclusive: Tag_Int, max_inclusive: Tag_Int}}
|
|
||||||
MonsterSpawnBlockLightLimit int32 `nbt:"monster_spawn_block_light_limit"`
|
|
||||||
}
|
|
Reference in New Issue
Block a user