-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix LegacyTelemetryEventPacket (#253)
- Loading branch information
Showing
6 changed files
with
43 additions
and
5 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
32 changes: 32 additions & 0 deletions
32
...in/java/org/cloudburstmc/protocol/bedrock/codec/v671/serializer/EventSerializer_v671.java
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,32 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v671.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v589.serializer.EventSerializer_v589; | ||
import org.cloudburstmc.protocol.bedrock.data.event.EntityInteractEventData; | ||
import org.cloudburstmc.protocol.bedrock.data.event.EventData; | ||
import org.cloudburstmc.protocol.common.util.VarInts; | ||
|
||
public class EventSerializer_v671 extends EventSerializer_v589 { | ||
public static final EventSerializer_v671 INSTANCE = new EventSerializer_v671(); | ||
|
||
@Override | ||
protected EntityInteractEventData readEntityInteract(ByteBuf buffer, BedrockCodecHelper helper) { | ||
long interactedEntityID = VarInts.readLong(buffer); | ||
int interactionType = VarInts.readInt(buffer); | ||
int interactionEntityType = VarInts.readInt(buffer); | ||
int entityVariant = VarInts.readInt(buffer); | ||
int entityColor = buffer.readUnsignedByte(); | ||
return new EntityInteractEventData(interactedEntityID, interactionType, interactionEntityType, entityVariant, entityColor); | ||
} | ||
|
||
@Override | ||
protected void writeEntityInteract(ByteBuf buffer, BedrockCodecHelper helper, EventData eventData) { | ||
EntityInteractEventData event = (EntityInteractEventData) eventData; | ||
VarInts.writeLong(buffer, event.getInteractedEntityID()); | ||
VarInts.writeInt(buffer, event.getInteractionType()); | ||
VarInts.writeInt(buffer, event.getLegacyEntityTypeId()); | ||
VarInts.writeInt(buffer, event.getVariant()); | ||
buffer.writeByte(event.getPaletteColor()); | ||
} | ||
} |
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