It should also be converted from UTF-8 to CP-437.
The if (type == 0
could probably be extracted into its own if
statement rather than being duplicated. (If you can't tell duplicated code irks me, it's why some of Reborn is so weird and macro/template-filled.)
I still need to write an essay after this. (My priorities are messed up.)
It should also be converted from UTF-8 to CP-437.
Why not just also add entity.get
/setAbsPos
. It wouldn't break compatibility and could be useful.
Better late than never: minecraft-pi-reborn-legacy.zip.
If you're not converting to Unicode, this function is a bit redundant, just use player->username
.
Something like this (brace for pseudo-code):
if (minecraft->player) {
std::string player_namespace = "player.";
if (cmd.starts_with(player_namespace) && cmd != "player.setting")…
I mean, the original MCPI API also doesn't do any text. The outside (non-MCPI) world speaks Unicode, it might be easiest to convert outside text to CP-437 after decoding it and vice versa.…
In those cases, why not just check the vtable
of the entity? Ie. If the type ID is 0, do something like ((void *) entity->vtable) == ((void *) TripodCamera_vtable_base
, otherwise use the map.
Oh, I'm dumb. I didn't see that f3
directly used misc_get_entity_names()
. Though the if (entity->isPlayer()) { type = "Player"; } else { ... }
logic should probably be its own function IMO,…
If it cannot determine the entity type's name, it should just return an empty string, that way the caller can decide how to handle it. For instance, the F3 code would want to display <type ID>
instead of <misc_get_entity_name> (<type ID>)
. And the API code would just want to show the type ID if it cannot determine the name.
I've tried to avoid using auto
in Reborn (personal preference).
When this is called by the F3 screen, it should probably show Player
instead of the username.
Aren't unknown entity types already covered by misc_get_entity_name
?
This function converts the CP437 username to UTF-8. This works fine if the username is being output to the API, but make sure this isn't passed to Font::draw
.
These new symbols should probably be in their own sub-directory. Maybe src/game/mode/creator
? Keep CreatorMode
where it is though
This (and others) are missing a null-check for the local player.