Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gophertunnel: Initial v1.18.30 support.
- Loading branch information
1 parent
9a828f7
commit 1feb24f
Showing
20 changed files
with
298 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package packet | ||
|
||
import ( | ||
"github.com/sandertv/gophertunnel/minecraft/protocol" | ||
) | ||
|
||
const ( | ||
AgentActionTypeAttack = iota + 1 | ||
AgentActionTypeCollect | ||
AgentActionTypeDestroy | ||
AgentActionTypeDetectRedstone | ||
AgentActionTypeDetectObstacle | ||
AgentActionTypeDrop | ||
AgentActionTypeDropAll | ||
AgentActionTypeInspect | ||
AgentActionTypeInspectData | ||
AgentActionTypeInspectItemCount | ||
AgentActionTypeInspectItemDetail | ||
AgentActionTypeInspectItemSpace | ||
AgentActionTypeInteract | ||
AgentActionTypeMove | ||
AgentActionTypePlaceBlock | ||
AgentActionTypeTill | ||
AgentActionTypeTransferItemTo | ||
AgentActionTypeTurn | ||
) | ||
|
||
// AgentAction is an Education Edition packet sent from the server to the client to return a response to a | ||
// previously requested action. | ||
type AgentAction struct { | ||
// Identifier is a JSON identifier referenced in the initial action. | ||
Identifier string | ||
// Action represents the action type that was requested. It is one of the constants defined above. | ||
Action int32 | ||
// Response is a JSON string containing the response to the action. | ||
Response []byte | ||
} | ||
|
||
// ID ... | ||
func (*AgentAction) ID() uint32 { | ||
return IDAgentAction | ||
} | ||
|
||
// Marshal ... | ||
func (pk *AgentAction) Marshal(w *protocol.Writer) { | ||
w.String(&pk.Identifier) | ||
w.Varint32(&pk.Action) | ||
w.ByteSlice(&pk.Response) | ||
} | ||
|
||
// Unmarshal ... | ||
func (pk *AgentAction) Unmarshal(r *protocol.Reader) { | ||
r.String(&pk.Identifier) | ||
r.Varint32(&pk.Action) | ||
r.ByteSlice(&pk.Response) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package packet | ||
|
||
import ( | ||
"github.com/sandertv/gophertunnel/minecraft/protocol" | ||
) | ||
|
||
// ChangeMobProperty is a packet sent from the server to the client to change one of the properties of a mob client-side. | ||
type ChangeMobProperty struct { | ||
// EntityUniqueID is the unique ID of the entity whose property is being changed. | ||
EntityUniqueID uint64 | ||
// Property is the name of the property being updated. | ||
Property string | ||
// BoolValue is set if the property value is a bool type. If the type is not a bool, this field is ignored. | ||
BoolValue bool | ||
// StringValue is set if the property value is a string type. If the type is not a string, this field is ignored. | ||
StringValue string | ||
// IntValue is set if the property value is an int type. If the type is not an int, this field is ignored. | ||
IntValue int32 | ||
// FloatValue is set if the property value is a float type. If the type is not a float, this field is ignored. | ||
FloatValue float32 | ||
} | ||
|
||
// ID ... | ||
func (*ChangeMobProperty) ID() uint32 { | ||
return IDChangeMobProperty | ||
} | ||
|
||
// Marshal ... | ||
func (pk *ChangeMobProperty) Marshal(w *protocol.Writer) { | ||
w.Uint64(&pk.EntityUniqueID) | ||
w.String(&pk.Property) | ||
w.Bool(&pk.BoolValue) | ||
w.String(&pk.StringValue) | ||
w.Varint32(&pk.IntValue) | ||
w.Float32(&pk.FloatValue) | ||
} | ||
|
||
// Unmarshal ... | ||
func (pk *ChangeMobProperty) Unmarshal(r *protocol.Reader) { | ||
r.Uint64(&pk.EntityUniqueID) | ||
r.String(&pk.Property) | ||
r.Bool(&pk.BoolValue) | ||
r.String(&pk.StringValue) | ||
r.Varint32(&pk.IntValue) | ||
r.Float32(&pk.FloatValue) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package packet | ||
|
||
import ( | ||
"github.com/sandertv/gophertunnel/minecraft/protocol" | ||
) | ||
|
||
// DimensionData is a packet sent from the server to the client containing information about data-driven dimensions | ||
// that the server may have registered. | ||
type DimensionData struct { | ||
// Definitions contain a list of data-driven dimension definitions registered on the server. | ||
Definitions []protocol.DimensionDefinition | ||
} | ||
|
||
// ID ... | ||
func (*DimensionData) ID() uint32 { | ||
return IDDimensionData | ||
} | ||
|
||
// Marshal ... | ||
func (pk *DimensionData) Marshal(w *protocol.Writer) { | ||
definitionsLen := uint32(len(pk.Definitions)) | ||
w.Varuint32(&definitionsLen) | ||
for _, definition := range pk.Definitions { | ||
protocol.DimensionDef(w, &definition) | ||
} | ||
} | ||
|
||
// Unmarshal ... | ||
func (pk *DimensionData) Unmarshal(r *protocol.Reader) { | ||
var definitionsLen uint32 | ||
r.Varuint32(&definitionsLen) | ||
|
||
pk.Definitions = make([]protocol.DimensionDefinition, definitionsLen) | ||
for i := uint32(0); i < definitionsLen; i++ { | ||
protocol.DimensionDef(r, &pk.Definitions[i]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I just so have a hunch this is because of the spectator game mode addition. Clients need to know the game mode of the player to know if they should display them or not.