Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minecraft Education Edition Support #39

Closed
wants to merge 86 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2ab3bcb
Copy v361 to protocol v363 for MCEE support
May 8, 2020
d1b1316
Reference v361 serializers to reduce duplication
May 9, 2020
3d77ab7
Implement bedrock-v363 StartGamePacket
May 11, 2020
154aae1
Implement bedrock-v363 PlayerListSerializer
May 11, 2020
574e924
Add Additional Command flag (UNKNOWN_7)
May 11, 2020
581113d
Update Version to 2.5.7-SNAPSHOT
bundabrg May 12, 2020
1135b9c
Misc Fixes
bundabrg Jun 17, 2020
9d1c431
Implement 1.16 fixes to allow a working ProxyPass
bundabrg Jun 24, 2020
5364b7c
Change to ByteBufAllocator
bundabrg Jun 24, 2020
e14af7b
WIP on startgamepacket
bundabrg Jun 24, 2020
f73481d
Implement StartGamePacket serializing
bundabrg Jun 24, 2020
75042cd
Implement readImage,writeImage which solves PlayerListPacket exceptions
bundabrg Jun 25, 2020
ec374cd
Implement CraftingDataPacket and all its associated helpers
bundabrg Jun 25, 2020
c78547a
Implement ItemSlotPacket
bundabrg Jun 25, 2020
d0e53b2
Implement SetSpawnPositionPacket
bundabrg Jun 25, 2020
65298c6
Add ItemDataInstance that contains a reference to an ItemData and the…
bundabrg Jun 25, 2020
80dc494
Implement InventoryContentPacket and associated helpers
bundabrg Jun 25, 2020
c267e40
Implement CreativeContentPacket
bundabrg Jun 25, 2020
b6edff8
Fix missing AvailbleCommandsSerializer static instance variable
bundabrg Jun 25, 2020
4966ec3
Flatten ItemData networkID
bundabrg Jun 25, 2020
027951f
Implement AvailableCommandsPacket + Contraints
bundabrg Jun 25, 2020
d9d855a
Fix InventorySlotSerializer serializing
bundabrg Jun 25, 2020
cbd7c0a
Fix LevelSoundEvent and LevelSoundEvent2 (untested)
bundabrg Jun 25, 2020
7eb30b5
Temporarily disable contraints (again) to allow working with Geyser f…
bundabrg Jun 25, 2020
7e09d51
Implement Fully Working AvailableCommandsPacket serializer with contr…
bundabrg Jun 26, 2020
45a2146
fix InventoryTransaction
Sleepybear Jun 25, 2020
bb03608
fix ContainerType enum
Sleepybear Jun 25, 2020
a560568
Update TextPacket info
Sleepybear Jun 26, 2020
42176a4
Write hasNetworkIds to InventoryTransaction
bundabrg Jun 26, 2020
c7f634f
Merge branch 'pull/1' into feature/1.16-protocol
bundabrg Jun 26, 2020
3a7fa5f
Fix PlayerSkinSerializer_v390
bundabrg Jun 26, 2020
503f3fb
Entity metadata fixes (#2)
Camotoy Jun 26, 2020
da89a63
Clean up StartGamePacket with new variable names
bundabrg Jun 26, 2020
b0a53ba
More debugging. This will catch exceptions that geyser seems to suppr…
bundabrg Jun 26, 2020
78b1928
Fix suppresed NPE with AdventureSettingsPacket
bundabrg Jun 26, 2020
49d11ff
Fix NPE for missing entityEvent
bundabrg Jun 26, 2020
0e54d60
Provide default spawnPosition
bundabrg Jun 26, 2020
aa103bd
Log missing EntityEvent, LevelEvent and SoundEvents
bundabrg Jun 26, 2020
4c7bd5a
Fix SetEntityLinkPacket
bundabrg Jun 26, 2020
8946ef7
Sort InventoryContentPacket entry map
AJ-Ferguson Jun 27, 2020
eacc81a
Fix v407 InventorySlotSerializer
AJ-Ferguson Jun 27, 2020
8acc46b
Add missing CommandParamTypes - WILDCARD_TARGET, BLOCK_POSITION
bundabrg Jun 27, 2020
3381cba
Merge remote-tracking branch 'aj/feature/1.16-protocol' into feature/…
bundabrg Jun 27, 2020
f0f2ea0
Temporarily store a packets bytes to a raw field to aid in debugging …
bundabrg Jun 27, 2020
036a8c8
Provide Binary Compatibility for AdventureSettingsPacket, AddPlayerPa…
bundabrg Jun 27, 2020
c3211fc
Retain Sorting for CreativeContentPacket
bundabrg Jun 27, 2020
61c0a15
Fix EventSerializer_v291 to properly serialize
bundabrg Jun 27, 2020
d765fda
Remove Debugging
bundabrg Jun 27, 2020
ad6fd21
Start work on ItemStackRequest Data
bundabrg Jun 28, 2020
05a5c41
Start work on Deserializing
bundabrg Jun 28, 2020
d95704b
Implement ItemStackRequest Serializer, Packet and Data
bundabrg Jun 28, 2020
186b4ae
Implement ItemStackResponse Packet, Serializer and Data
bundabrg Jun 28, 2020
67aef9f
Merge branch 'feature/stackrequest' into feature/1.16-protocol
bundabrg Jun 28, 2020
1f22ebd
| != +
bundabrg Jun 28, 2020
543056c
Add LevelEvents for SOUND_CAMERA, BLOCK_START_BREAK, BLOCK_STOP_BREAK…
bundabrg Jun 28, 2020
6410fd3
Merge branch 'feature/1.16-protocol' into feature/v363-1.16
bundabrg Jun 29, 2020
e9cd1f1
Start work on refector of MCEE
bundabrg Jun 29, 2020
92e2b10
Make it compile
bundabrg Jun 29, 2020
f43e892
AvailableCommandSerializer looks like it may be ok now
bundabrg Jun 29, 2020
a43d40f
Allow setting the raknetProtocolVersion on BedrockPacketCodec.Builder
bundabrg Jun 29, 2020
2f994c9
Merge branch 'feature/1.16-protocol' into feature/v363-1.16
bundabrg Jun 29, 2020
7201ad6
Set v363 raknetProtocolVersion to 9.
bundabrg Jun 29, 2020
51cc498
Fix AvailableCommandsSerializer_v291
bundabrg Jun 29, 2020
2b57dec
Fix StartGamePacket
bundabrg Jun 29, 2020
52c7463
Fix bugs in BedrockPacketHelper_v361, AvailableCommandsSerializer_v291
bundabrg Jun 29, 2020
898a3fe
Don't print LevelChunk data
bundabrg Jun 29, 2020
6e98152
Fix bug in LevelSoundEventSerializer_v332
bundabrg Jun 29, 2020
a3dfaa3
Merge branch 'feature/1.16-protocol' into feature/v363-1.16
bundabrg Jun 29, 2020
bc67a38
Remove Duplicate
bundabrg Jun 30, 2020
c0029ce
Merge branch 'develop' into feature/v363-1.16
bundabrg Jun 30, 2020
f10bc62
Remove Duplicate
bundabrg Jun 30, 2020
77a514d
Add missing Container Type
bundabrg Jun 30, 2020
fcf00ac
Merge branch 'fix/inventory-transaction-serializer' into feature/v363…
bundabrg Jun 30, 2020
48a8a52
Merge branch 'develop' into feature/v363
bundabrg Jul 3, 2020
325e21c
Merge branch 'develop' into feature/v363
bundabrg Jul 5, 2020
24e95d5
Add missing InventorySource type (#52)
bundabrg Jul 5, 2020
3c91ec0
Merge Fixes
bundabrg Jul 6, 2020
c6feb68
Fix StartGameSerializer_v363 as it was missing id fields in the Palette
bundabrg Jul 7, 2020
f9e9161
Merge branch 'develop' into feature/v363
bundabrg Jul 9, 2020
50ba534
Merge branch 'develop' into feature/v363
bundabrg Jul 20, 2020
9e6ce74
Merge branch 'develop' into feature/v363
bundabrg Jul 26, 2020
d1cf499
Merge branch 'develop' into feature/v363
bundabrg Aug 13, 2020
3754d35
Move Education to its own package and start implementing education-v390
bundabrg Aug 13, 2020
13a1469
Generify EventSerializer_v291
bundabrg Aug 13, 2020
b490314
Merge branch 'fix/event-serializer' into feature/v363
bundabrg Aug 13, 2020
05d74c8
Merge branch 'develop' into feature/v363
bundabrg Aug 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.nukkitx.protocol.bedrock.packet.UnknownPacket;
import com.nukkitx.protocol.util.Int2ObjectBiMap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
Expand Down Expand Up @@ -61,6 +62,7 @@ public BedrockPacket tryDecode(ByteBuf buf, int id) throws PacketSerializeExcept

if (log.isDebugEnabled() && buf.isReadable()) {
log.debug(packet.getClass().getSimpleName() + " still has " + buf.readableBytes() + " bytes to read!");
log.debug(ByteBufUtil.prettyHexDump(buf));
}
return packet;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public enum Flag {
EXECUTE,
TYPE,
CHEAT,
UNKNOWN_6
UNKNOWN_6,
UNKNOWN_7
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import it.unimi.dsi.fastutil.longs.LongList;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(doNotUseGetters = true, callSuper = false)
@ToString(exclude = {"data"}) // We don't really want to be printing the entire chunk
public class LevelChunkPacket extends BedrockPacket {
private int chunkX;
private int chunkZ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,23 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* LevelEventGeneric is sent by the server to send a 'generic' level event to the client. This packet sends an
* NBT serialised object and may for that reason be used for any event holding additional data.
*/
@Data
@EqualsAndHashCode(doNotUseGetters = true, callSuper = false)
public class LevelEventGenericPacket extends BedrockPacket {
private int eventId;

/**
* SerialisedEventData is a network little endian serialised object of event data, with fields that vary
* depending on eventId.
* Unlike many other NBT structures, this data is not actually in a compound but just loosely floating
* NBT tags. To decode using the nbt package, you would need to append 0x0a00 at the start (compound id
* and name length) and add 0x00 at the end, to manually wrap it in a compound. Likewise, you would have
* to remove these bytes when encoding.
*/
private NbtMap tag;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,52 +81,13 @@ public void deserialize(ByteBuf buffer, BedrockPacketHelper helper, EventPacket

packet.setUsePlayerId(buffer.readByte());

EventData data;

switch (type) {
case ACHIEVEMENT_AWARDED:
data = this.readAchievementAwarded(buffer, helper);
break;
case ENTITY_INTERACT:
data = this.readEntityInteract(buffer, helper);
break;
case PORTAL_BUILT:
data = this.readPortalBuilt(buffer, helper);
break;
case PORTAL_USED:
data = this.readPortalUsed(buffer, helper);
break;
case MOB_KILLED:
data = this.readMobKilled(buffer, helper);
break;
case CAULDRON_USED:
data = this.readCauldronUsed(buffer, helper);
break;
case PLAYER_DIED:
data = this.readPlayerDied(buffer, helper);
break;
case BOSS_KILLED:
data = this.readBossKilled(buffer, helper);
break;
case AGENT_COMMAND:
data = this.readAgentCommand(buffer, helper);
break;
case AGENT_CREATED:
data = AgentCreatedEventData.INSTANCE;
break;
case PATTERN_REMOVED:
data = this.readPatternRemoved(buffer, helper);
break;
case SLASH_COMMAND_EXECUTED:
data = this.readSlashCommandExecuted(buffer, helper);
break;
case FISH_BUCKETED:
data = this.readFishBucketed(buffer, helper);
break;
default:
throw new UnsupportedOperationException("Unknown event type " + type);
BiFunction<ByteBuf, BedrockPacketHelper, EventData> function = this.readers.get(type);

if (function == null) {
throw new UnsupportedOperationException("Unknown event type " + type);
}
packet.setEventData(data);

packet.setEventData(function.apply(buffer, helper));
}

protected AchievementAwardedEventData readAchievementAwarded(ByteBuf buffer, BedrockPacketHelper helper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public InventorySource readSource(ByteBuf buffer) {
return InventorySource.fromWorldInteraction(flag);
case CREATIVE:
return InventorySource.fromCreativeInventory();
case UNTRACKED_INTERACTION_UI:
return InventorySource.fromUntrackedInteractionUI(VarInts.readInt(buffer));
case NON_IMPLEMENTED_TODO:
containerId = VarInts.readInt(buffer);
return InventorySource.fromNonImplementedTodo(containerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class BedrockPacketHelper_v361 extends BedrockPacketHelper_v354 {

public static final BedrockPacketHelper INSTANCE = new BedrockPacketHelper_v361();

@Override
Expand Down
22 changes: 22 additions & 0 deletions bedrock/education-v363/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>bedrock-parent</artifactId>
<groupId>com.nukkitx.protocol</groupId>
<version>2.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>education-v363</artifactId>

<dependencies>
<dependency>
<groupId>com.nukkitx.protocol</groupId>
<artifactId>bedrock-v361</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.nukkitx.protocol.education.v363;

import com.nukkitx.protocol.bedrock.BedrockPacketHelper;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.v361.BedrockPacketHelper_v361;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class EducationPacketHelper_v363 extends BedrockPacketHelper_v361 {
public static final BedrockPacketHelper INSTANCE = new EducationPacketHelper_v363();

@Override
protected void registerEntityData() {
super.registerEntityData();

this.addEntityData(107, EntityData.AMBIENT_SOUND_INTERVAL);
this.addEntityData(108, EntityData.AMBIENT_SOUND_INTERVAL_RANGE);
this.addEntityData(109, EntityData.AMBIENT_SOUND_EVENT_NAME);
}

}
Loading