backbone for client API commands with test
This commit is contained in:
1 parent
7f98564122
commit
fff3ccf3f6
4 files changed
+128
No files matched your search
@@ -44,6 +44,9 @@ public class ClientNetworkHandler
|
||||
if (CarpetClient.shapes != null)
|
||||
CarpetClient.shapes.addShapes((ListTag) t);
|
||||
});
|
||||
put("clientCommand", (p, t) -> {
|
||||
CarpetClient.onClientCommand(t);
|
||||
});
|
||||
}};
|
||||
|
||||
|
||||
@@ -99,4 +102,17 @@ public class ClientNetworkHandler
|
||||
CarpetSettings.LOG.error("Unknown carpet data: "+key);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clientCommand(String command)
|
||||
{
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putString("id", command);
|
||||
tag.putString("command", command);
|
||||
CompoundTag outer = new CompoundTag();
|
||||
outer.put("clientCommand", tag);
|
||||
CarpetClient.getPlayer().networkHandler.sendPacket(new CustomPayloadC2SPacket(
|
||||
CarpetClient.CARPET_CHANNEL,
|
||||
(new PacketByteBuf(Unpooled.buffer())).writeVarInt(CarpetClient.DATA).writeCompoundTag(outer)
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user