Documentation ¶
Index ¶
- Constants
- type Metadata
- func (m *Metadata) ClearDirty() bool
- func (m *Metadata) Dirty() bool
- func (m *Metadata) Get(index byte) (interface{}, bool)
- func (m *Metadata) GetType(index byte, mtype int32) interface{}
- func (m *Metadata) String() string
- func (m *Metadata) ToProto() *pb.EntityMetadata
- func (m *Metadata) Write(index byte, mtype int32, value interface{})
- type Particle
- type Rotation
- type VillagerData
Constants ¶
const ( // I am not using iota here, as these constants should be exactly what is defined as per the minecraft wiki. // If I used iota, it would be less clear what each individual value was. EntityType_Byte = 0 EntityType_VarInt = 1 EntityType_Float = 2 EntityType_String = 3 EntityType_Chat = 4 EntityType_OptChat = 5 EntityType_Item = 6 EntityType_Bool = 7 EntityType_Rotation = 8 // 3 floats in a row EntityType_Position = 9 EntityType_OptPosition = 10 EntityType_Direction = 11 // (Down = 0, Up = 1, North = 2, South = 3, West = 4, East = 5) EntityType_OptUUID = 12 EntityType_BlockID = 13 // blockstate EntityType_NBT = 14 EntityType_Particle = 15 EntityType_VillagerData = 16 // 3 VarInts: villager type, villager profession, level EntityType_OptVarInt = 17 // used for EID. 0 means absent, 1+ is an actual id EntityType_Pose = 18 // 0: STANDING, 1: FALL_FLYING, 2: SLEEPING, 3: SWIMMING, 4: SPIN_ATTACK, 5: SNEAKING, 6: DYING Direction_Down = 0 Direction_Up = 1 Direction_North = 2 Direction_South = 3 Direction_West = 4 Direction_East = 5 Pose_Standing = 0 Pose_FallFlying = 1 Pose_Sleeping = 2 Pose_Swimming = 3 Pose_SpinAttack = 4 Pose_Sneaking = 5 Pose_Dying = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
This is an entitiy metadata map. It matches one version of the game, and uses types that are equivalent to the newest version. These types are translated as best as possible in the proxy, but you will still run into issues. Therefore, you should use a entity.Metadata, which understands what type of entity you are talking about, and knows how to correctly set the fields for each version.
func (*Metadata) ClearDirty ¶
Sets dirty to false, and returns the previous value
func (*Metadata) Get ¶
Gets the value at a given index.
This will return true if the value is set, and false if it is not set. It is up to the user to figure out of casting is safe, as all fields are set with calls to Write, and the type of any field can be changed at any time. This type will never change the type of values, only the user can change those.
func (*Metadata) GetType ¶
Gets the value at a given index. If the value is not set, then it will insert a default value into the metadata, with the given type, and return that. If the value is already set, no matter what the type is, it will return that other value.
If it writes a value, it will mark the metadata as dirty
func (*Metadata) ToProto ¶
func (m *Metadata) ToProto() *pb.EntityMetadata
type VillagerData ¶
type VillagerData struct {
Type, Profession, Level int32
}
func (VillagerData) String ¶
func (v VillagerData) String() string