TheBrokenRail
TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 06:05:39 +00:00
Port over most of the RaspberryJuice API

It might be easier to do std::vector, for polling just do:

for (const type &event : list) {
    if (id == -1 
TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 05:42:57 +00:00
Port over most of the RaspberryJuice API

When compatibility mode is disabled, `

TheBrokenRail pushed to master at minecraft-pi-reborn/minecraft-pi-reborn 2024-11-03 05:41:39 +00:00
9ae6cd17cf Convert API Chat Posts To CP-437
TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 05:21:50 +00:00
Port over most of the RaspberryJuice API

When in compat-mode, this should be put though the type ID map.

TheBrokenRail pushed to master at minecraft-pi-reborn/minecraft-pi-reborn 2024-11-03 04:02:23 +00:00
644e9e421b Finally Fix Dumb Method Names
TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

Same here, in compat mode it should only return types in the mapping table.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

This should be char instead of auto.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

Same as to_cp437, this needs to be freed.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

Why not just use the float version of from @ 0x27c64?

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

to_cp437 has to be freed, so maybe:

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

cleared or removed would probably be a better name IMO. invalid makes me think the event has bad values.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

Why not do char lines[4][100] rather than char l1[100], l2[100], l3[100], l4[100]; char *lines[4] = {l1, l2, l3, l4}?

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

If the mapping table doesn't contain the ID, it should probably just fail. Otherwise the behavior is pretty unpredictable.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

On one hand, all entity names are plain/safe ASCII. But on the other hand, it would be more consistent to Base64-encode them. You decide.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

Maybe iterating through the tile events should be a helper method like iterate_tile_events(const std::function<void(EventList_TileEvent &)> &callback)?

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

Base64-ing the XYZ data probably isn't necessary, why not move to get_output to ChatEvent::toString and ProjectileEvent::toString. That way they're consistent with other API calls where only text is Base64-ed.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

To make this easier to parse, maybe it should be get_output(empty_fallback(misc_get_entity_name_upper(entity), entity->id), true, true) instead. That way clients can always safely Base64 decode without having to check if it's just an ID. Also empty_fallback could probably be merged into get_output as an empty_fallback parameter.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

What was the reasoning behind using a custom structure instead of something like the standard std::queue or std::vector?

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

This should be static.

TheBrokenRail commented on pull request minecraft-pi-reborn/minecraft-pi-reborn#116 2024-11-03 03:37:56 +00:00
Port over most of the RaspberryJuice API

This is never called with a non-player sender. The type should be changed to Player *. That way, you can get rid of the isPlayer() check and the various (Player *) casts. (Yes, I know I'm contradicting past-me. Past-me was an idiot.)