This commit is contained in:
Bigjango13 2024-02-01 18:21:14 -05:00
commit 728f9d77fd
92 changed files with 1016 additions and 341 deletions

@ -1 +1 @@
Subproject commit 8e6c8d7effc54f8aecd30eda17069588298f4ada
Subproject commit b4c3ef9d0fdf46845f3e81e5d989dab06e71e6c1

@ -1 +1 @@
Subproject commit ea31be1cb2b43decb9c906215f80ff20efd2b479
Subproject commit 39e1d17f93fb2253be3692858241aab62104d05f

View File

@ -14,7 +14,7 @@
2. If a setting is cached, then the dialog's default value will be the cached value instead of the normal default.
3. When configuration has been completed, the settings specified will be cached.
2. The launcher replaces itself with MCPI.
1. MCPI-Reborn components are loaded using ``LD_PRELOAD`` and ``LD_LIBRARY_PATH``.
1. MCPI-Reborn components are loaded using `LD_PRELOAD` and `LD_LIBRARY_PATH`.
2. If the Media Layer Proxy is enabled, then the Media Layer Proxy Client is started as a sub-process.
### Server
@ -27,11 +27,11 @@
This component configures the various environmental variables required for MCPI-Reborn to work. When running in client-mode, this component will also launch several Zenity dialogs for interactive configuration.
The environmental variables configured by this component includes:
* ``LD_PRELOAD``
* ``LD_LIBRARY_PATH``
* ``MCPI_FEATURE_FLAGS``
* ``MCPI_RENDER_DISTANCE``
* ``MCPI_USERNAME``
* `LD_PRELOAD`
* `LD_LIBRARY_PATH`
* `MCPI_FEATURE_FLAGS`
* `MCPI_RENDER_DISTANCE`
* `MCPI_USERNAME`
This is always compiled for the host system's architecture.
@ -78,11 +78,11 @@ This is always compiled for ARM.
This sub-component includes headers for SDL, GLES, and EGL allowing easy (cross-)compilation.
### Mods
This component patches MCPI to modify its behavior. It's loaded using ``LD_PRELOAD``.
This component patches MCPI to modify its behavior. It's loaded using `LD_PRELOAD`.
This is always compiled for ARM.
### ``libreborn``
### `libreborn`
This component contains various utility functions including:
* Code Patching (ARM Only)
@ -91,7 +91,7 @@ This component contains various utility functions including:
The code patching is ARM only because it relies on hard-coded ARM instructions. However, this is irrelevant since code patching is only needed in ARM code (to patch MCPI).
### ``symbols``
### `symbols`
This component contains all MCPI symbols.
## Dependencies

View File

@ -19,4 +19,4 @@
```
### Environment Variables
* ``MCPI_TOOLCHAIN_USE_DEFAULT_SEARCH_PATHS``: Use Default CMake Search Paths Rather Than Guessing
* `MCPI_TOOLCHAIN_USE_DEFAULT_SEARCH_PATHS`: Use Default CMake Search Paths Rather Than Guessing

View File

@ -1,44 +1,44 @@
# Changelog
**2.5.3**
* Add ``Replace Block Highlight With Outline`` Feature Flag (Enabled By Default)
* By Default, The Outline Width Is Set Using The GUI Scale
* This Can Be Overridden Using The ``MCPI_BLOCK_OUTLINE_WIDTH`` Environmental Variable
* Add `Replace Block Highlight With Outline` Feature Flag (Enabled By Default)
* By Default, The Outline Width Is Set Using The GUI Scale
* This Can Be Overridden Using The ``MCPI_BLOCK_OUTLINE_WIDTH`` Environmental Variable
* Added ``overwrite_calls_within`` Function
* Add ``Add Cake`` Feature Flag (Enabled By Default)
* Add Milk Buckets
* Implement Crafting Remainders
**2.5.2**
* Add ``3D Chest Model`` Feature Flag (Enabled By Default)
* Add `3D Chest Model` Feature Flag (Enabled By Default)
* Stop Using Jenkins
* Replace ``iconv``
* Replace `iconv`
* Replace LibPNG
**2.5.1**
* Allow Overriding Custom Skin Server Using ``MCPI_SKIN_SERVER`` Environmental Variable
* Allow Overriding Custom Skin Server Using `MCPI_SKIN_SERVER` Environmental Variable
* Fix Bug With SDK Generation
**2.5.0**
* [Custom skin support](CUSTOM_SKINS.md)!
* Add ``Load Custom Skins`` Feature Flag (Enabled By Default)
* Add `Load Custom Skins` Feature Flag (Enabled By Default)
**2.4.9**
* Allow Overriding GUI Scale With ``MCPI_GUI_SCALE`` Environmental Variable
* Add ``Disable Block Tinting`` Feature Flag (Disabled By Default)
* Add ``Disable Hostile AI In Creative Mode`` Feature Flag (Enabled By Default)
* Allow Overriding GUI Scale With `MCPI_GUI_SCALE` Environmental Variable
* Add `Disable Block Tinting` Feature Flag (Disabled By Default)
* Add `Disable Hostile AI In Creative Mode` Feature Flag (Enabled By Default)
* Allow Accessing Configuration At Runtime (Useful For Mods That Need To Support Multiple Versions)
**2.4.8**
* Fix Bug In ``extract_from_bl_instruction``
* Fix Bug In `extract_from_bl_instruction`
* Update LIEF And GLFW
* Allow Mods To Access The Original GLFW Keycode For Key Events (But Better)
* More Accurate Sound
**2.4.7**
* Improve Server Performance
* Add ``Add Biome Colors To Grass`` Feature Flag (Disabled By Default)
* Add ``Generate Caves`` Feature Flag (Enabled By Default)
* Add `Add Biome Colors To Grass` Feature Flag (Disabled By Default)
* Add `Generate Caves` Feature Flag (Enabled By Default)
* Allow Mods To Access The Original GLFW Keycode For Key Events
**2.4.6**
@ -52,16 +52,16 @@
**2.4.4**
* Cache Previous Launcher Configuration
* Add ``MCPI_API_PORT`` Environmental Variable
* Add `MCPI_API_PORT` Environmental Variable
* Fix Particles In Front-Facing View
* Fixed Launch Crash On Ubuntu ARM64
* PatchELF Replaced With LIEF
* Moved ``3D Anaglyph`` Feature Flag To Options Screen
* Add ``Improved Classic Title Screen`` Feature Flag (Enabled By Default)
* Moved `3D Anaglyph` Feature Flag To Options Screen
* Add `Improved Classic Title Screen` Feature Flag (Enabled By Default)
* Add Quit button
* Add Options Button (Moved From ``Fix Options Screen`` Feature Flag)
* Add ``Disable Speed Bridging`` Feature Flag (Disabled By Default)
* Add ``Disable Creative Mode Mining Delay`` Feature Flag (Disabled By Default)
* Add Options Button (Moved From `Fix Options Screen` Feature Flag)
* Add `Disable Speed Bridging` Feature Flag (Disabled By Default)
* Add `Disable Creative Mode Mining Delay` Feature Flag (Disabled By Default)
* Improved Feature Flag Names
* Miscellaneous Bug Fixes
* Improved Build System
@ -83,11 +83,11 @@
* More Reliable AppImages
* CMake Refactors
* Disable Broken Touchscreen-Specific Block Outline Behavior
* Add ``Remove Forced GUI Lag (Can Break Joining Servers)`` Feature Flag (Disabled By Default)
* Add ``Add Buckets`` Feature Flag (Enabled By Default)
* Add ``Classic HUD`` Feature Flag (Enabled By Default)
* Add ``Translucent Toolbar`` Feature Flag (Enabled By Default)
* Add ``Force EGL`` Feature Flag (Disabled By Default)
* Add `Remove Forced GUI Lag (Can Break Joining Servers)` Feature Flag (Disabled By Default)
* Add `Add Buckets` Feature Flag (Enabled By Default)
* Add `Classic HUD` Feature Flag (Enabled By Default)
* Add `Translucent Toolbar` Feature Flag (Enabled By Default)
* Add `Force EGL` Feature Flag (Disabled By Default)
* Fix Sound Pitch/Volume/Attenuation
* Fix Holding Left-Click When Attacking
* Don't Force EGL (Should Fix Some NVIDIA Systems)
@ -101,7 +101,7 @@
* Bug Fixes
**2.3.11**
* ``--version`` Command Line Option
* `--version` Command Line Option
* TPS Measured In Benchmark & Server
* Front-Facing Third-Person
* GLESv1 Comparability Layer
@ -127,39 +127,39 @@
* Don't Append Hyphens To New World Name, Only Folder Names
**2.3.6**
* Fix ``Invert Y-axis`` Option Name
* Fix `Invert Y-axis` Option Name
* Improve Touch GUI Inventory In Non-Touch GUI
* New Create World Dialog
* Controlled By ``Implement Create World Dialog`` Feature Flag (Enabled By Default)
* Controlled By `Implement Create World Dialog` Feature Flag (Enabled By Default)
* Custom World Names
* Game-Mode Selection
* Custom Seeds
**2.3.5**
* Renamed Some Feature Flags
* Add ``Improved Title Background`` Feature Flag (Enabled By Default)
* Add `Improved Title Background` Feature Flag (Enabled By Default)
* Non-Touch GUI Rework
* Make ``Full Touch GUI`` Feature Flag Disabled By Default
* Add ``Force Touch GUI Button Behavior`` Feature Flag (Enabled By Default)
* Add ``Improved Button Hover Behavior`` Feature Flag (Enabled By Default)
* Make `Full Touch GUI` Feature Flag Disabled By Default
* Add `Force Touch GUI Button Behavior` Feature Flag (Enabled By Default)
* Add `Improved Button Hover Behavior` Feature Flag (Enabled By Default)
**2.3.4**
* AppImage Fixes
* Make Death Messages Customizable Server-Side
* Fix Q-Key Behavior Behavior When Editing Signs
* Add ``Force Touch Inventory`` Feature Flag (Disabled By Default)
* Add ``Fix Pause Menu`` Feature Flag (Enabled By Default)
* Add `Force Touch Inventory` Feature Flag (Disabled By Default)
* Add `Fix Pause Menu` Feature Flag (Enabled By Default)
* Enables Server Visibility Toggle Button
* Options Changes (Not Supported On Legacy)
* Add ``Fix Options Screen`` Feature Flag (Enabled By Default)
* Add `Fix Options Screen` Feature Flag (Enabled By Default)
* Adds Options Button To Classic UI Start Screen
* Removes Useless Options Toggles
* Fixes Options Toggles' Default Position
* Store Multiple Settings In `options.txt`
* ``Peaceful Mode`` Feature Flag Moved To ``game_difficulty``
* ``Smooth Lighting`` Feature Flag Moved To ``gfx_ao``
* ``Fancy Graphics`` Feature Flag Moved To ``gfx_fancygraphics``
* ``Disable Hosting LAN Worlds`` Feature Flag Moved To ``mp_server_visible_default``
* `Peaceful Mode` Feature Flag Moved To `game_difficulty`
* `Smooth Lighting` Feature Flag Moved To `gfx_ao`
* `Fancy Graphics` Feature Flag Moved To `gfx_fancygraphics`
* `Disable Hosting LAN Worlds` Feature Flag Moved To `mp_server_visible_default`
**2.3.3**
* Add More Blocks To Expanded Creative Inventory
@ -170,30 +170,30 @@
* Add More Blocks To Expanded Creative Inventory
* Fix Nether Reactor With Creative Restrictions Disabled
* Alphabetize Feature Flags
* Add ``Disable V-Sync`` Feature Flag (Disabled By Default)
* Add `Disable V-Sync` Feature Flag (Disabled By Default)
**2.3.1**
* Internal Refactor Of ``libreborn``
* Remove Use Of ``/bin/sh``
* Internal Refactor Of `libreborn`
* Remove Use Of `/bin/sh`
* Load Custom Mods First
* Use Zenity Dark Mode
* Add ``Improved Cursor Rendering`` Feature Flag (Enabled By Default)
* Add `Improved Cursor Rendering` Feature Flag (Enabled By Default)
**2.3.0**
* Switch To AppImage For Packaging
* Prevent OpenAL From Crashing When Out Of Memory
* Vendor GLFW & Zenity
* Seamless Wayland Support
* Add ``MCPI_DEBUG`` Environmental Variable
* Add ``Disable Hosting LAN Worlds`` Feature Flag (Disabled By Default)
* Add ``Fix Furnace Not Checking Item Auxiliary`` Feature Flag (Enabled By Default)
* Add ``Disable Raw Mouse Motion (Not Recommended)`` Feature Flag (Disabled By Default) For Broken X11 Setups
* Add `MCPI_DEBUG` Environmental Variable
* Add `Disable Hosting LAN Worlds` Feature Flag (Disabled By Default)
* Add `Fix Furnace Not Checking Item Auxiliary` Feature Flag (Enabled By Default)
* Add `Disable Raw Mouse Motion (Not Recommended)` Feature Flag (Disabled By Default) For Broken X11 Setups
* Added Back `~/.minecraft-pi/mods`
* Improve Build System
* Improve Documentation
**2.2.11**
* Add ``Close Current Screen On Death`` Feature Flag (Enabled By Default) To Prevent Bugs
* Add `Close Current Screen On Death` Feature Flag (Enabled By Default) To Prevent Bugs
* Fix More Furnace UI Bugs When Using "Disable 'gui_blocks' Atlas"
**2.2.10**
@ -204,8 +204,8 @@
* Store Files In `/usr/lib`
**2.2.8**
* Add ``Hide Chat Messages`` Optional Feature Flag
* Add ``Remove Creative Mode Restrictions`` Optional Feature Flag
* Add `Hide Chat Messages` Optional Feature Flag
* Add `Remove Creative Mode Restrictions` Optional Feature Flag
* Improve GLFW->SDL Mouse Motion Event Conversion
* Performance Optimizations
* Make Majority Of Server-Specific Logging Code Also Apply To The Client
@ -237,15 +237,15 @@
* Make Missing Sound Event Cause Warning Rather Than Crash
**2.2.1**
* Prevent ``random.burp`` Sound From Crashing Game
* Prevent `random.burp` Sound From Crashing Game
* Always Cleanup Media Layer, Even On Crash
* Resolve All Sounds On Startup
**2.2.0**
* Sound Support
* Split Off ``Allow Joining Survival Servers`` From Game-Mode Mod
* Split Off `Allow Joining Survival Servers` From Game-Mode Mod
* Separate Headless Code From Server Code
* Fix Bug Where ``RakNetInstance`` Starts Pinging Potential Servers Before The "Join Game" Screen Is Opened
* Fix Bug Where `RakNetInstance` Starts Pinging Potential Servers Before The "Join Game" Screen Is Opened
* Clean-Up Code
* Remove Support For Debian Buster
@ -262,7 +262,7 @@
* Print Error Message If RakNet Fails To Start
**2.1.4**
* Fix ``RakNet::RakString`` Security Bug
* Fix `RakNet::RakString` Security Bug
**2.1.3**
* Workaround Broken Library Search Path On Some ARM 32-Bit Systems
@ -274,16 +274,16 @@
* Fix Symlink Code
**2.1.0**
* Allow Binding ``Q`` Key To Item Dropping
* Allow Binding `Q` Key To Item Dropping
* Expose More Feature Flags
* Replace ``Mob Spawning`` Feature Flag With ``Force Mob Spawning``
* Fix ``ESC`` Key In Options Menu When ``Miscellaneous Input Fixes`` Is Enabled
* Replace `Mob Spawning` Feature Flag With `Force Mob Spawning`
* Fix `ESC` Key In Options Menu When `Miscellaneous Input Fixes` Is Enabled
**2.0.9**
* Fix Translucent Preview Items In Furnace UI Being Fully Opaque When The ``gui_blocks`` Atlas Is Disabled
* Fix Translucent Preview Items In Furnace UI Being Fully Opaque When The `gui_blocks` Atlas Is Disabled
**2.0.8**
* Use Default Port In ``servers.txt`` If Not Specified
* Use Default Port In `servers.txt` If Not Specified
**2.0.7**
* Fix Sign Text Not Updating In Multiplayer When Exiting Editing UI Using Escape Button
@ -300,7 +300,7 @@
* Optimize Media Layer Proxy
**2.0.3**
* Make ``kill`` Admin Command Print Death Message
* Make `kill` Admin Command Print Death Message
**2.0.2**
* Fix Mouse Cursor Bugs

View File

@ -2,19 +2,19 @@
## Command Line Arguments
### ``--version`` (Or ``-v``)
If you run MCPI-Reborn with ``--version`` it will print its version to ``stdout``.
### `--version` (Or `-v`)
If you run MCPI-Reborn with `--version` it will print its version to `stdout`.
### ``--debug``
This sets ``MCPI_DEBUG``.
### `--debug`
This sets `MCPI_DEBUG`.
### ``--copy-sdk``
### `--copy-sdk`
This extracts the modding SDK and immediately exits. (This allows the SDK to be extracted without starting the game.)
### Client Mode Only
#### ``--print-available-feature-flags``
This print the available feature flags (and their default values) to ``stdout`` and then immediately exit.
#### `--print-available-feature-flags`
This print the available feature flags (and their default values) to `stdout` and then immediately exit.
The feature flags are printed in the following format:
```
@ -22,43 +22,43 @@ TRUE This Flag Is On By Default
FALSE This Flag Is Off By Default
```
#### ``--default``
This will skip the startup configuration dialogs and just use the default values. This will use the cached configuration unless ``--no-cache`` is used.
#### `--default`
This will skip the startup configuration dialogs and just use the default values. This will use the cached configuration unless `--no-cache` is used.
#### ``--benchmark``
#### `--benchmark`
This will make MCPI-Reborn enter a simple benchmark mode. This means automatically loading a newly generated world, then rotating the camera for a period of time. When it has finished, it will then exit and print the average FPS while the world was loaded. In this mode, all user input is blocked. However you can still modify rendering settings by changing feature flags.
The world used will always be re-created on start and uses a hard-coded seed.
#### ``--no-cache``
#### `--no-cache`
This will skip loading and saving the cached launcher configuration.
#### ``--wipe-cache``
#### `--wipe-cache`
This will wipe the cached launcher configuration.
### Server Mode Only
#### ``--only-generate``
#### `--only-generate`
This will make MCPI-Reborn immediately exit once world generation has completed. This is mainly used for automatically testing MCPI-Reborn.
## Environmental Variables
### ``MCPI_DEBUG``
### `MCPI_DEBUG`
This enables debug logging if it is set.
### ``MCPI_API_PORT``
### `MCPI_API_PORT`
This configures the API to use a different port (the default is 4711).
### Client Mode Only
If any of the following variables aren't set, one configuration dialog will open on startup for each unset variable.
#### ``MCPI_FEATURE_FLAGS``
This corresponds to ``--print-available-feature-flags``. This is just a list of all enabled feature flags separated by ``|``.
#### `MCPI_FEATURE_FLAGS`
This corresponds to `--print-available-feature-flags`. This is just a list of all enabled feature flags separated by `|`.
For instance, the string ``Feature A|Feature B`` would enable both ``Feature A`` and ``Feature B`` and *disable every other available feature flag*.
For instance, the string `Feature A|Feature B` would enable both `Feature A` and `Feature B` and *disable every other available feature flag*.
#### ``MCPI_RENDER_DISTANCE``
This is the render distance. The possible values are: ``Far``, ``Normal``, ``Short``, and ``Tiny``.
#### `MCPI_RENDER_DISTANCE`
This is the render distance. The possible values are: `Far`, `Normal`, `Short`, and `Tiny`.
#### ``MCPI_USERNAME``
#### `MCPI_USERNAME`
This is the username.

View File

@ -3,4 +3,4 @@ MCPI-Reborn supports downloading custom skins from [a central skin server](https
This *does not* cache skins and *will not* work without internet access.
Custom skins can be disabled using the ``Load Custom Skins`` feature flag.
Custom skins can be disabled using the `Load Custom Skins` feature flag.

View File

@ -1,10 +1,10 @@
# Dedicated Server
The dedicated server is a version of Minecraft: Pi Edition modified to run in a headless environment. It loads settings from a ``server.properties`` file.
The dedicated server is a version of Minecraft: Pi Edition modified to run in a headless environment. It loads settings from a `server.properties` file.
This server is also compatible with MCPE Alpha v0.6.1[^1].
## Setup
To use, install and run the ``minecraft-pi-reborn-server`` AppImage. It will generate the world and ``server.properties`` in the current directory.
To use, install and run the `minecraft-pi-reborn-server` AppImage. It will generate the world and `server.properties` in the current directory.
## Server Limitations
* Player data is not saved because of limitations with MCPE LAN worlds

View File

@ -6,16 +6,16 @@ Download packages [here](https://gitea.thebrokenrail.com/minecraft-pi-reborn/min
### System Requirements
* Debian Bullseye/Ubuntu 20.04 Or Higher
* FUSE 2
* Debian/Ubuntu: ``sudo apt install libfuse2``
* Arch: ``sudo pacman -S fuse2``
* Debian/Ubuntu: `sudo apt install libfuse2`
* Arch: `sudo pacman -S fuse2`
* Client-Only Dependencies
* Graphics Drivers
* GTK+ 3
* Debian/Ubuntu: ``sudo apt install libgtk-3-0``
* Arch: ``sudo pacman -S gtk3``
* Debian/Ubuntu: `sudo apt install libgtk-3-0`
* Arch: `sudo pacman -S gtk3`
* OpenAL
* Debian/Ubuntu: ``sudo apt install libopenal1``
* Arch: ``sudo pacman -S openal``
* Debian/Ubuntu: `sudo apt install libopenal1`
* Arch: `sudo pacman -S openal`
### Running
Follow [these](https://docs.appimage.org/introduction/quickstart.html#how-to-run-an-appimage) instructions.
@ -24,7 +24,7 @@ Follow [these](https://docs.appimage.org/introduction/quickstart.html#how-to-run
<a href="https://flathub.org/apps/details/com.thebrokenrail.MCPIReborn"><img width="240" alt="Download On Flathub" src="https://flathub.org/assets/badges/flathub-badge-en.svg" /></a>
### Note
Game data is stored in ``~/.var/app/com.thebrokenrail.MCPIReborn/.minecraft-pi`` instead of ``~/.minecraft-pi``.
Game data is stored in `~/.var/app/com.thebrokenrail.MCPIReborn/.minecraft-pi` instead of `~/.minecraft-pi`.
## Arch User Repository (Arch Linux Only)
The [``minecraft-pi-reborn-git``](https://aur.archlinux.org/packages/minecraft-pi-reborn-git) is available in the AUR.
The [`minecraft-pi-reborn-git`](https://aur.archlinux.org/packages/minecraft-pi-reborn-git) is available in the AUR.

View File

@ -5,9 +5,9 @@ MCPI-Reborn supports two ways to play multiplayer.
This is also supported by vanilla MCPI. Just load a world in MCPI and other devices on the network can join.
## External Servers
Unlike vanilla MCPI, MCPI-Reborn allows you to natively join a server outside of the local network. Just modify ``~/.minecraft-pi/servers.txt`` and it should show up in MCPI's server list.
Unlike vanilla MCPI, MCPI-Reborn allows you to natively join a server outside of the local network. Just modify `~/.minecraft-pi/servers.txt` and it should show up in MCPI's server list.
### Example ``~/.minecraft-pi/servers.txt``
### Example `~/.minecraft-pi/servers.txt`
```
# Default Port Is 19132
example.com

View File

@ -1,6 +1,6 @@
# Overriding Assets
To make overriding assets easier, MCPI-Reborn provides an overrides folder. Any file located in Minecraft: Pi Edition's ``data`` folder can be overridden by placing a file with the same name and path in the overrides folder. The overrides folder is located at ``~/.minecraft-pi/overrides``.
To make overriding assets easier, MCPI-Reborn provides an overrides folder. Any file located in Minecraft: Pi Edition's `data` folder can be overridden by placing a file with the same name and path in the overrides folder. The overrides folder is located at `~/.minecraft-pi/overrides`.
## Examples
- ``data/images/terrain.png`` -> ``~/.minecraft-pi/overrides/images/terrain.png``
- ``data/lang/en_US.lang`` -> ``~/.minecraft-pi/overrides/lang/en_US.lang``
- `data/images/terrain.png` -> `~/.minecraft-pi/overrides/images/terrain.png`
- `data/lang/en_US.lang` -> `~/.minecraft-pi/overrides/lang/en_US.lang`

View File

@ -8,7 +8,7 @@ TRUE Fix Sign Placement
TRUE Show Block Outlines
FALSE Expand Creative Mode Inventory
FALSE Remove Creative Mode Restrictions
TRUE Animated Water
TRUE Animated Water & Lava
TRUE Remove Invalid Item Background
TRUE Disable "gui_blocks" Atlas
TRUE Fix Camera Rendering
@ -52,3 +52,5 @@ TRUE Load Custom Skins
TRUE 3D Chest Model
TRUE Replace Block Highlight With Outline
TRUE Add Cake
TRUE Use Java Beta 1.3 Light Ramp
TRUE Send Full Level When Hosting Game

View File

@ -15,7 +15,7 @@ void _overwrite_calls(const char *file, int line, void *start, void *target);
#define overwrite_calls(start, target) _overwrite_calls(__FILE__, __LINE__, start, target);
void _overwrite_calls_within(const char *file, int line, void *from, void *to, void *start, void *target);
#define overwrite_calls_within(from, to, start, target) _overwrite_calls(__FILE__, __LINE__, from, to, start, target);
#define overwrite_calls_within(from, to, start, target) _overwrite_calls_within(__FILE__, __LINE__, from, to, start, target);
void *extract_from_bl_instruction(unsigned char *from);

View File

@ -50,6 +50,25 @@ const char *reborn_get_version();
int reborn_is_headless();
int reborn_is_server();
// Customize VTable
#define CUSTOM_VTABLE(name, parent) \
static void _setup_##name##_vtable(parent##_vtable *vtable); \
static parent##_vtable *get_##name##_vtable() { \
static parent##_vtable *vtable = NULL; \
/* Allocate VTable */ \
if (vtable == NULL) { \
/* Init */ \
vtable = dup_##parent##_vtable(parent##_vtable_base); \
ALLOC_CHECK(vtable); \
/* Setup */ \
_setup_##name##_vtable(vtable); \
} \
/* Return */ \
return vtable; \
} \
/* User-Defined Setup Code */ \
static void _setup_##name##_vtable(parent##_vtable *vtable)
#ifdef __cplusplus
}
#endif

View File

@ -16,7 +16,7 @@ static std::string to_utf8(const std::u32string &s) {
// Minecraft-Flavored CP437
#define CP437_CHARACTERS 256
static const std::string cp437_characters_map[CP437_CHARACTERS] = {
"\0", "", "", "", "", "", "", "", "", "", "\n", "", "", "\r", "", "",
"\0", "", "", "", "", "", "", "", "", "", "\n", "", "", "", "", "",
"", "", "", "", "", "§", "", "", "", "", "", "", "", "", "", "",
" ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?",

View File

@ -14,7 +14,7 @@ void sanitize_string(char **str, int max_length, unsigned int allow_newlines) {
// Loop Through Message
if (!allow_newlines) {
for (int i = 0; i < length; i++) {
if ((*str)[i] == '\n' || (*str)[i] == '\r') {
if ((*str)[i] == '\n') {
// Replace Newline
(*str)[i] = ' ';
}

View File

@ -123,6 +123,8 @@ static SDLKey glfw_key_to_sdl_key(int key) {
return SDLK_RETURN;
case GLFW_KEY_BACKSPACE:
return SDLK_BACKSPACE;
case GLFW_KEY_DELETE:
return SDLK_DELETE;
// Fullscreen
case GLFW_KEY_F11:
return SDLK_F11;

View File

@ -28,6 +28,7 @@ typedef enum {
SDLK_s = 115,
SDLK_t = 116,
SDLK_w = 119,
SDLK_DELETE = 127,
SDLK_UP = 273,
SDLK_DOWN = 274,
SDLK_RIGHT = 275,

View File

@ -15,7 +15,7 @@ set(SRC
src/version/version.cpp
# chat
src/chat/chat.cpp
src/chat/ui.c
src/chat/ui.cpp
# creative
src/creative/creative.cpp
# game-mode
@ -97,6 +97,10 @@ else()
src/screenshot/screenshot.c
# textures
src/textures/textures.cpp
src/textures/lava.cpp
# text-input-box
src/text-input-box/TextInputBox.cpp
src/text-input-box/TextInputScreen.cpp
)
endif()

View File

@ -15,7 +15,6 @@ extern "C" {
#ifndef MCPI_SERVER_MODE
void chat_open();
unsigned int chat_get_counter();
#endif
// Override using the HOOK() macro to provide customized chat behavior.

View File

@ -29,6 +29,8 @@ void Level_saveLevelData_injection(Level *level);
// Use this instead of directly calling Gui::addMessage(), it has proper logging!
void misc_add_message(Gui *gui, const char *text);
extern bool is_in_chat;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,35 @@
#pragma once
#include <symbols/minecraft.h>
struct TextInputBox {
GuiComponent super;
int m_ID;
int m_xPos;
int m_yPos;
int m_width;
int m_height;
std::string m_placeholder;
std::string m_text;
bool m_bFocused;
bool m_bEnabled;
bool m_bCursorOn;
int m_insertHead;
int m_lastFlashed;
Font *m_pFont;
int m_maxLength;
void setSize(int x, int y, int width = 200, int height = 12);
void init(Font *pFont);
void setEnabled(bool bEnabled);
void keyPressed(int key);
void charPressed(int chr);
void render();
void tick();
void setFocused(bool b);
void onClick(int x, int y);
bool clicked(int x, int y);
static TextInputBox *create(int id, const std::string &placeholder = "", const std::string &text = "");
};

View File

@ -0,0 +1,12 @@
#pragma once
#include <symbols/minecraft.h>
#include <mods/text-input-box/TextInputBox.h>
struct TextInputScreen {
Screen super;
std::vector<TextInputBox *> *m_textInputs;
static void setup(Screen_vtable *vtable);
};

View File

@ -1,2 +1,2 @@
# ``atlas`` Mod
This mod allows disabling the ``gui_blocks`` atlas.
# `atlas` Mod
This mod allows disabling the `gui_blocks` atlas.

View File

@ -1,2 +1,2 @@
# ``benchmark`` Mod
# `benchmark` Mod
This mod contain a simple game benchmark.

View File

@ -1,2 +1,2 @@
# ``bucket`` Mod
# `bucket` Mod
This mod adds buckets.

View File

@ -170,25 +170,16 @@ static ItemInstance *BucketItem_getCraftingRemainingItem(FoodItem *item, ItemIns
}
// Bucket VTable
static FoodItem_vtable *get_bucket_vtable() {
static FoodItem_vtable *vtable = NULL;
if (vtable == NULL) {
// Init
vtable = dup_FoodItem_vtable(FoodItem_vtable_base);
ALLOC_CHECK(vtable);
// Modify
vtable->getDescriptionId = BucketItem_getDescriptionId;
vtable->getIcon = BucketItem_getIcon;
vtable->useOn = BucketItem_useOn;
vtable->getUseDuration = BucketItem_getUseDuration;
vtable->useTimeDepleted = BucketItem_useTimeDepleted;
vtable->getUseAnimation = BucketItem_getUseAnimation;
vtable->isFood = BucketItem_isFood;
vtable->use = BucketItem_use;
vtable->getCraftingRemainingItem = BucketItem_getCraftingRemainingItem;
}
return vtable;
CUSTOM_VTABLE(bucket, FoodItem) {
vtable->getDescriptionId = BucketItem_getDescriptionId;
vtable->getIcon = BucketItem_getIcon;
vtable->useOn = BucketItem_useOn;
vtable->getUseDuration = BucketItem_getUseDuration;
vtable->useTimeDepleted = BucketItem_useTimeDepleted;
vtable->getUseAnimation = BucketItem_getUseAnimation;
vtable->isFood = BucketItem_isFood;
vtable->use = BucketItem_use;
vtable->getCraftingRemainingItem = BucketItem_getCraftingRemainingItem;
}
// Create Items

View File

@ -28,7 +28,7 @@ static int Cake_getTexture2(__attribute__((unused)) Tile *tile, int face) {
return 122;
}
static int Cake_getTexture3(__attribute__((unused)) Tile *tile, Level *level, int x, int y, int z, int face) {
static int Cake_getTexture3(__attribute__((unused)) Tile *tile, LevelSource *level, int x, int y, int z, int face) {
// Eaten face
if (face == 3) {
int data = level->vtable->getData(level, x, y, z);
@ -86,7 +86,7 @@ static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) {
return aabb;
}
static void Cake_updateShape(Tile *tile, Level *level, int x, int y, int z) {
static void Cake_updateShape(Tile *tile, LevelSource *level, int x, int y, int z) {
// Set cake
int data = level->vtable->getData(level, x, y, z);
if (data >= 6) data = 0;

View File

@ -1,2 +1,2 @@
# ``camera`` Mod
# `camera` Mod
This mod fixes the Camera's renderer so that it is no longer invisible.

View File

@ -1,2 +1,2 @@
# ``chat`` Mod
# `chat` Mod
This mod implements a chat system.

View File

@ -6,9 +6,12 @@
extern "C" {
#endif
__attribute__((visibility("internal"))) extern int _chat_enabled;
#ifndef MCPI_SERVER_MODE
__attribute__((visibility("internal"))) void _chat_queue_message(char *message);
__attribute__((visibility("internal"))) void _chat_queue_message(const char *message);
#endif
#ifndef MCPI_HEADLESS_MODE
__attribute__((visibility("internal"))) void _init_chat_ui();
#endif
#ifdef __cplusplus

View File

@ -5,9 +5,6 @@
#include <cstring>
#include <cstdio>
#include <vector>
#ifndef MCPI_HEADLESS_MODE
#include <pthread.h>
#endif
#include <symbols/minecraft.h>
#ifndef MCPI_HEADLESS_MODE
@ -22,9 +19,6 @@
#include "chat-internal.h"
#include <mods/chat/chat.h>
// Store If Chat is Enabled
int _chat_enabled = 0;
// Message Limitations
#define MAX_CHAT_MESSAGE_LENGTH 512
@ -95,45 +89,27 @@ static void ServerSideNetworkHandler_handle_ChatPacket_injection(ServerSideNetwo
#ifndef MCPI_HEADLESS_MODE
// Message Queue
static pthread_mutex_t queue_mutex = PTHREAD_MUTEX_INITIALIZER;
static std::vector<std::string> queue;
// Add To Queue
void _chat_queue_message(char *message) {
// Lock
pthread_mutex_lock(&queue_mutex);
void _chat_queue_message(const char *message) {
// Add
std::string str;
str.append(message);
std::string str = message;
queue.push_back(str);
// Unlock
pthread_mutex_unlock(&queue_mutex);
}
// Empty Queue
unsigned int old_chat_counter = 0;
static void send_queued_messages(Minecraft *minecraft) {
// Lock
pthread_mutex_lock(&queue_mutex);
// If Message Was Submitted, No Other Chat Windows Are Open, And The Game Is Not Paused, Then Re-Lock Cursor
unsigned int new_chat_counter = chat_get_counter();
if (old_chat_counter > new_chat_counter && new_chat_counter == 0) {
// Unlock UI
media_set_interactable(1);
}
old_chat_counter = new_chat_counter;
// Loop
for (unsigned int i = 0; i < queue.size(); i++) {
send_api_chat_command(minecraft, (char *) queue[i].c_str());
}
queue.clear();
// Unlock
pthread_mutex_unlock(&queue_mutex);
}
#endif
// Init
void init_chat() {
_chat_enabled = feature_has("Implement Chat", server_enabled);
if (_chat_enabled) {
if (feature_has("Implement Chat", server_enabled)) {
// Disable Original ChatPacket Loopback
unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x6b490, disable_chat_packet_loopback_patch);
@ -141,9 +117,11 @@ void init_chat() {
overwrite_call((void *) 0x6b518, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection);
// Re-Broadcast ChatPacket
patch_address(ServerSideNetworkHandler_handle_ChatPacket_vtable_addr, (void *) ServerSideNetworkHandler_handle_ChatPacket_injection);
// Send Messages On Input Tick
#ifndef MCPI_HEADLESS_MODE
// Send Messages On Input Tick
input_run_on_tick(send_queued_messages);
// Init UI
_init_chat_ui();
#endif
}
}

View File

@ -1,83 +0,0 @@
// Config Needs To Load First
#include <libreborn/libreborn.h>
// Chat UI Code Is Useless In Headless Mode
#ifndef MCPI_HEADLESS_MODE
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <media-layer/core.h>
#include "chat-internal.h"
#include <mods/chat/chat.h>
// Count Chat Windows
static pthread_mutex_t chat_counter_lock = PTHREAD_MUTEX_INITIALIZER;
static volatile unsigned int chat_counter = 0;
unsigned int chat_get_counter() {
return chat_counter;
}
// Chat Thread
#define DIALOG_TITLE "Chat"
static void *chat_thread(__attribute__((unused)) void *nop) {
// Open
int return_code;
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", MCPI_APP_ID,
"--entry",
"--text", "Enter Chat Message:",
NULL
};
char *output = run_command(command, &return_code, NULL);
// Handle Message
if (output != NULL) {
// Check Return Code
if (is_exit_status_success(return_code)) {
// Remove Ending Newline
int length = strlen(output);
if (output[length - 1] == '\n') {
output[length - 1] = '\0';
}
length = strlen(output);
// Don't Allow Empty Strings
if (length > 0) {
// Submit
char *safe_output = to_cp437(output);
_chat_queue_message(safe_output);
free(safe_output);
}
}
// Free Output
free(output);
}
// Update Counter
pthread_mutex_lock(&chat_counter_lock);
chat_counter--;
pthread_mutex_unlock(&chat_counter_lock);
// Return
return NULL;
}
// Create Chat Thead
void chat_open() {
if (_chat_enabled) {
// Lock UI
media_set_interactable(0);
// Update Counter
pthread_mutex_lock(&chat_counter_lock);
chat_counter++;
pthread_mutex_unlock(&chat_counter_lock);
// Start Thread
pthread_t thread;
pthread_create(&thread, NULL, chat_thread, NULL);
}
}
#endif

137
mods/src/chat/ui.cpp Normal file
View File

@ -0,0 +1,137 @@
// Config Needs To Load First
#include <libreborn/libreborn.h>
// Chat UI Code Is Useless In Headless Mode
#ifndef MCPI_HEADLESS_MODE
#include "chat-internal.h"
#include <mods/chat/chat.h>
#include <mods/text-input-box/TextInputScreen.h>
#include <mods/misc/misc.h>
// Structure
struct ChatScreen {
TextInputScreen super;
TextInputBox *chat;
Button *send;
};
CUSTOM_VTABLE(chat_screen, Screen) {
TextInputScreen::setup(vtable);
// Init
static Screen_init_t original_init = vtable->init;
vtable->init = [](Screen *super) {
original_init(super);
ChatScreen *self = (ChatScreen *) super;
// Text Input
self->chat = TextInputBox::create(1);
self->super.m_textInputs->push_back(self->chat);
self->chat->init(super->font);
self->chat->setFocused(true);
// Send Button
if (Minecraft_isTouchscreen(super->minecraft)) {
self->send = (Button *) new Touch_TButton;
} else {
self->send = new Button;
}
ALLOC_CHECK(self->send);
int send_id = 2;
std::string send_text = "Send";
if (Minecraft_isTouchscreen(super->minecraft)) {
Touch_TButton_constructor((Touch_TButton *) self->send, send_id, &send_text);
} else {
Button_constructor(self->send, send_id, &send_text);
}
super->rendered_buttons.push_back(self->send);
super->selectable_buttons.push_back(self->send);
// Hide Chat Messages
is_in_chat = true;
};
// Removal
static Screen_removed_t original_removed = vtable->removed;
vtable->removed = [](Screen *super) {
original_removed(super);
is_in_chat = false;
ChatScreen *self = (ChatScreen *) super;
delete self->chat;
self->send->vtable->destructor_deleting(self->send);
};
// Rendering
static Screen_render_t original_render = vtable->render;
vtable->render = [](Screen *super, int x, int y, float param_1) {
// Background
super->vtable->renderBackground(super);
// Render Chat
Gui_renderChatMessages(&super->minecraft->gui, super->height, 20, true, super->font);
// Call Original Method
original_render(super, x, y, param_1);
};
// Positioning
vtable->setupPositions = [](Screen *super) {
Screen_setupPositions_non_virtual(super);
ChatScreen *self = (ChatScreen *) super;
self->send->height = 20;
self->send->width = 40;
int x = 0;
int y = super->height - self->send->height;
int width = super->width - self->send->width;
self->chat->setSize(x, y, width, self->send->height);
self->send->y = super->height - self->send->height;
self->send->x = x + width;
};
// Key Presses
static Screen_keyPressed_t original_keyPressed = vtable->keyPressed;
vtable->keyPressed = [](Screen *super, int key) {
// Handle Enter
ChatScreen *self = (ChatScreen *) super;
if (key == 0x0d && self->chat->m_bFocused) {
if (self->chat->m_text.length() > 0) {
_chat_queue_message(self->chat->m_text.c_str());
}
Minecraft_setScreen(super->minecraft, NULL);
}
// Call Original Method
original_keyPressed(super, key);
};
// Button Click
vtable->buttonClicked = [](Screen *super, Button *button) {
ChatScreen *self = (ChatScreen *) super;
if (button == self->send) {
// Send
self->chat->setFocused(true);
super->vtable->keyPressed(super, 0x0d);
} else {
// Call Original Method
Screen_buttonClicked_non_virtual(super, button);
}
};
}
static Screen *create_chat_screen() {
// Construct
ChatScreen *screen = new ChatScreen;
ALLOC_CHECK(screen);
Screen_constructor(&screen->super.super);
// Set VTable
screen->super.super.vtable = get_chat_screen_vtable();
// Return
return (Screen *) screen;
}
// Open Screen
static bool open_chat_screen = false;
void chat_open() {
open_chat_screen = true;
}
// Init
void _init_chat_ui() {
misc_run_on_tick([](Minecraft *minecraft) {
if (open_chat_screen && Minecraft_isLevelGenerated(minecraft) && minecraft->screen == NULL) {
Minecraft_setScreen(minecraft, create_chat_screen());
}
open_chat_screen = false;
});
}
#endif

View File

@ -1,2 +1,2 @@
# ``compat`` Mod
# `compat` Mod
This utility mod sends keyboard input to other mods. It also patches out all EGL and X11 calls.

View File

@ -70,12 +70,7 @@ HOOK(SDL_PollEvent, int, (SDL_Event *event)) {
input_third_person();
handled = 1;
} else if (event->key.keysym.sym == SDLK_t) {
// Only When In-Game With No Other Chat Windows Open
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON && chat_get_counter() == 0) {
// Open Chat
chat_open();
}
// Mark Handled
chat_open();
handled = 1;
} else if (event->key.keysym.sym == SDLK_ESCAPE) {
// Treat Escape As Back Button Press (This Fixes Issues With Signs)

View File

@ -1,2 +1,2 @@
# ``creative`` Mod
# `creative` Mod
This mod adds an optional feature flag to add more items to the Creative Mode inventory.

View File

@ -1,2 +1,2 @@
# ``death`` Mod
# `death` Mod
This mod implements death messages.

View File

@ -1,2 +1,2 @@
# ``feature`` Mod
# `feature` Mod
This utility mod handles feature flags.

View File

@ -1,2 +1,2 @@
# ``game-mode`` Mod
# `game-mode` Mod
This mod implements Survival Mode and dynamic game-mode switching.

View File

@ -1,4 +1,4 @@
# ``home`` Mod
# `home` Mod
This utility mod handles changing the location where world data is stored. This is so it doesn't conflict with Minecraft: Java Edition.
Normally, it changes it to ``~/.minecraft-pi``, but in server mode it changes it to the launch directory.
Normally, it changes it to `~/.minecraft-pi`, but in server mode it changes it to the launch directory.

View File

@ -1,2 +1,2 @@
# ``init`` Mod
# `init` Mod
This utility mod handles initializing the other mods in the correct order.

View File

@ -1,10 +1,10 @@
# ``input`` Mod
# `input` Mod
This mod fixes various input-related bugs, including:
* Bows being broken.
* The cursor interacting with the toolbar while the it is locked.
* Being unable to attack mobs.
* The ``ESC`` key not behaving as expected.
* The `ESC` key not behaving as expected.
It also adds various features, including:
* Hide GUI and third person toggle keys.
* Dropping items with ``Q``.
* Dropping items with `Q`.

View File

@ -80,7 +80,8 @@ static void _handle_mouse_grab(Minecraft *minecraft) {
// Block UI Interaction When Mouse Is Locked
static bool Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection(Minecraft *minecraft) {
if (!enable_misc || SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF) {
bool is_in_game = minecraft->screen == NULL || minecraft->screen->vtable == (Screen_vtable *) Touch_IngameBlockSelectionScreen_vtable_base;
if (!enable_misc || (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF && is_in_game)) {
// Call Original Method
return creative_is_restricted() && Minecraft_isCreativeMode(minecraft);
} else {

View File

@ -1,4 +1,4 @@
# ``misc`` Mod
# `misc` Mod
This mod has several miscellaneous mods that are too small to be their own mod, including:
* Rendering text above the hotbar when an item is selected.
* Sanitizing player usernames for invalid characters.

View File

@ -65,6 +65,7 @@ static void Gui_renderBubbles_GuiComponent_blit_injection(Gui *component, int32_
// Additional GUI Rendering
static int hide_chat_messages = 0;
bool is_in_chat = 0;
static int render_selected_item_text = 0;
static void Gui_renderChatMessages_injection(Gui *gui, int32_t y_offset, uint32_t max_messages, bool disable_fading, Font *font) {
// Handle Classic HUD
@ -76,7 +77,7 @@ static void Gui_renderChatMessages_injection(Gui *gui, int32_t y_offset, uint32_
}
// Call Original Method
if (!hide_chat_messages) {
if (!hide_chat_messages && !is_in_chat) {
Gui_renderChatMessages(gui, y_offset, max_messages, disable_fading, font);
}
@ -489,7 +490,7 @@ static ContainerMenu *ContainerMenu_injection(ContainerMenu *container_menu, Con
// Return
return container_menu;
}
static unsigned char *ContainerMenu_destructor_injection(ContainerMenu *container_menu) {
static ContainerMenu *ContainerMenu_destructor_injection(ContainerMenu *container_menu) {
// Play Animation
Container *container = container_menu->container;
ChestTileEntity *tile_entity = (ChestTileEntity *) (((unsigned char *) container) - offsetof(ChestTileEntity, container));
@ -499,7 +500,7 @@ static unsigned char *ContainerMenu_destructor_injection(ContainerMenu *containe
}
// Call Original Method
return ContainerMenu_destructor_non_virtual(container_menu);
return ContainerMenu_destructor_complete_non_virtual(container_menu);
}
#ifndef MCPI_HEADLESS_MODE
@ -558,6 +559,18 @@ static void Player_stopUsingItem_injection(Player *self) {
Player_stopUsingItem(self);
}
// Java Light Ramp
static void Dimension_updateLightRamp_injection(Dimension *self) {
// https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/world/level/Dimension.cpp#L92-L105
for (int i = 0; i <= 15; i++) {
float f1 = 1.0f - (((float) i) / 15.0f);
self->light_ramp[i] = ((1.0f - f1) / (f1 * 3.0f + 1.0f)) * (1.0f - 0.1f) + 0.1f;
// Default Light Ramp:
// float fVar4 = 1.0 - ((float) i * 0.0625);
// self->light_ramp[i] = ((1.0 - fVar4) / (fVar4 * 3.0 + 1.0)) * 0.95 + 0.15;
}
}
// Init
static void nop() {
}
@ -720,8 +733,8 @@ void init_misc() {
// Animation
overwrite_calls((void *) ContainerMenu_constructor, (void *) ContainerMenu_injection);
overwrite_calls((void *) ContainerMenu_destructor_non_virtual, (void *) ContainerMenu_destructor_injection);
patch_address(ContainerMenu_destructor_vtable_addr, (void *) ContainerMenu_destructor_injection);
overwrite_calls((void *) ContainerMenu_destructor_complete_non_virtual, (void *) ContainerMenu_destructor_injection);
patch_address(ContainerMenu_destructor_complete_vtable_addr, (void *) ContainerMenu_destructor_injection);
}
patch_address((void *) 0x115b48, (void *) ChestTileEntity_shouldSave_injection);
@ -739,10 +752,17 @@ void init_misc() {
overwrite_calls((void *) FurnaceTileEntity_getLitProgress, (void *) FurnaceTileEntity_getLitProgress_injection);
// Send the full level, not only changed chunks
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x717c4, nop_patch);
unsigned char mov_r3_ff[4] = {0xff, 0x30, 0xa0, 0xe3}; // "mov r3, #0xff"
patch((void *) 0x7178c, mov_r3_ff);
if (feature_has("Send Full Level When Hosting Game", server_enabled)) {
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x717c4, nop_patch);
unsigned char mov_r3_ff[4] = {0xff, 0x30, 0xa0, 0xe3}; // "mov r3, #0xff"
patch((void *) 0x7178c, mov_r3_ff);
}
// Java Light Ramp
if (feature_has("Use Java Beta 1.3 Light Ramp", server_disabled)) {
overwrite((void *) Dimension_updateLightRamp_non_virtual, (void *) Dimension_updateLightRamp_injection);
}
// Fix used items transferring durability
overwrite_calls((void *) Player_startUsingItem, (void *) Player_startUsingItem_injection);

View File

@ -1,4 +1,4 @@
# ``multiplayer`` Mod
# `multiplayer` Mod
This mod implements connecting to external (non-LAN) servers. This mod is client mode only.
It is controlled by the ``~/.minecraft-pi/servers.txt`` file.
It is controlled by the `~/.minecraft-pi/servers.txt` file.

View File

@ -1,4 +1,4 @@
# ``options`` Mod
# `options` Mod
This mod allows various options to be configured, including:
* Mob Spawning
* The Render Distance

View File

@ -1,4 +1,4 @@
# ``override`` Mod
# `override` Mod
This mod allows built-in assets to be overriden by placing replacements in an override folder.
``<MCPI Root>/data/images/terrain.png`` would be overriden by ``<MCPI World Data Root>/overrides/images/terrain.png``.
`<MCPI Root>/data/images/terrain.png` would be overriden by `<MCPI World Data Root>/overrides/images/terrain.png`.

View File

@ -1,2 +1,2 @@
# ``readdir`` Mod
# `readdir` Mod
This mod fixes a small bug where the contents of directories cannot be read on a 64-bit filesystem. This notably broke the world selection screen.

View File

@ -1,2 +1,2 @@
# ``screenshot`` Mod
# `screenshot` Mod
This mod implements the core screenshot logic.

View File

@ -1,2 +1,2 @@
# ``server`` Mod
# `server` Mod
This mod contains most of the code involved in converting MCPI into a server.

View File

@ -1,2 +1,2 @@
# ``sign`` Mod
# `sign` Mod
This mod fixes sign placement.

View File

@ -12,7 +12,13 @@
// Handle Backspace
static int32_t sdl_key_to_minecraft_key_injection(int32_t sdl_key) {
if (sdl_key == SDLK_BACKSPACE) {
return 8;
return 0x8;
} else if (sdl_key == SDLK_DELETE) {
return 0x2e;
} else if (sdl_key == SDLK_LEFT) {
return 0x25;
} else if (sdl_key == SDLK_RIGHT) {
return 0x27;
} else {
// Call Original Method
return Common_sdl_key_to_minecraft_key(sdl_key);
@ -31,37 +37,17 @@ static void LocalPlayer_openTextEdit_injection(LocalPlayer *local_player, TileEn
}
// Store Text Input
std::vector<char> input;
void sign_key_press(char key) {
input.push_back(key);
}
static void clear_input(__attribute__((unused)) Minecraft *minecraft) {
input.clear();
}
// Handle Text Input
static void TextEditScreen_updateEvents_injection(TextEditScreen *screen) {
// Call Original Method
TextEditScreen_updateEvents_non_virtual(screen);
if (!screen->passthrough_input) {
for (char key : input) {
// Handle Normal Key
screen->vtable->keyboardNewChar(screen, key);
}
}
clear_input(NULL);
Keyboard__inputText.push_back(key);
}
// Init
void init_sign() {
if (feature_has("Fix Sign Placement", server_disabled)) {
// Handle Backspace
overwrite_calls((void *) Common_sdl_key_to_minecraft_key, (void *) sdl_key_to_minecraft_key_injection);
// Fix Signs
patch_address(LocalPlayer_openTextEdit_vtable_addr, (void *) LocalPlayer_openTextEdit_injection);
patch_address(TextEditScreen_updateEvents_vtable_addr, (void *) TextEditScreen_updateEvents_injection);
// Clear Input On Input Tick
input_run_on_tick(clear_input);
}
// Handle Backspace
overwrite_calls((void *) Common_sdl_key_to_minecraft_key, (void *) sdl_key_to_minecraft_key_injection);
}

View File

@ -1,2 +1,2 @@
# ``skin`` Mod
# `skin` Mod
This mod adds custom skin loading.

View File

@ -1,2 +1,2 @@
# ``sound`` Mod
# `sound` Mod
This mod implements a sound engine.

View File

@ -1,2 +1,2 @@
# ``test`` Mod
# `test` Mod
This utility mod tests that the system is configured correctly before starting.

View File

@ -0,0 +1,2 @@
# `text-input-box` Mod
This mod implements a GUI component for text input. This is ported from [ReMinecraftPE](https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/components/TextInputBox.cpp).

View File

@ -0,0 +1,200 @@
#include <libreborn/libreborn.h>
#include <mods/text-input-box/TextInputBox.h>
TextInputBox *TextInputBox::create(int id, const std::string &placeholder, const std::string &text) {
// Construct
TextInputBox *self = new TextInputBox;
GuiComponent_constructor(&self->super);
// Setup
self->m_ID = id;
self->m_xPos = 0;
self->m_yPos = 0;
self->m_width = 0;
self->m_height = 0;
self->m_placeholder = placeholder;
self->m_text = text;
self->m_bFocused = false;
self->m_bEnabled = true;
self->m_bCursorOn = true;
self->m_insertHead = 0;
self->m_lastFlashed = 0;
self->m_pFont = nullptr;
self->m_maxLength = -1;
// Return
return self;
}
void TextInputBox::setSize(int x, int y, int width, int height) {
m_xPos = x;
m_yPos = y;
m_width = width;
m_height = height;
}
void TextInputBox::init(Font *pFont) {
m_pFont = pFont;
}
void TextInputBox::setEnabled(bool bEnabled) {
m_bEnabled = bEnabled;
}
void TextInputBox::keyPressed(int key) {
if (!m_bFocused) {
return;
}
switch (key) {
case 0x8: {
// Backspace
if (m_text.empty()) {
return;
}
if (m_insertHead <= 0) {
return;
}
if (m_insertHead > int(m_text.size())) {
m_insertHead = int(m_text.size());
}
m_text.erase(m_text.begin() + m_insertHead - 1, m_text.begin() + m_insertHead);
m_insertHead--;
break;
}
case 0x2e: {
// Delete
if (m_text.empty()) {
return;
}
if (m_insertHead < 0) {
return;
}
if (m_insertHead >= int(m_text.size())) {
return;
}
m_text.erase(m_text.begin() + m_insertHead, m_text.begin() + m_insertHead + 1);
break;
}
case 0x25: {
// Left
m_insertHead--;
if (m_insertHead < 0) {
m_insertHead = 0;
}
break;
}
case 0x27: {
// Right
m_insertHead++;
if (!m_text.empty()) {
if (m_insertHead > int(m_text.size())) {
m_insertHead = int(m_text.size());
}
} else {
m_insertHead = 0;
}
break;
}
case 0x0d: {
// Enter
m_bFocused = false;
break;
}
}
}
void TextInputBox::tick() {
if (!m_lastFlashed) {
m_lastFlashed = Common_getTimeMs();
}
if (m_bFocused) {
if (Common_getTimeMs() > m_lastFlashed + 500) {
m_lastFlashed += 500;
m_bCursorOn ^= 1;
}
} else {
m_bCursorOn = false;
}
}
void TextInputBox::setFocused(bool b) {
if (m_bFocused == b) {
return;
}
m_bFocused = b;
if (b) {
m_lastFlashed = Common_getTimeMs();
m_bCursorOn = true;
m_insertHead = int(m_text.size());
}
}
void TextInputBox::onClick(int x, int y) {
setFocused(clicked(x, y));
}
static int PADDING = 5;
void TextInputBox::charPressed(int k) {
if (!m_bFocused) {
return;
}
// note: the width will increase by the same amount no matter where K is appended
std::string test_str = m_text + char(k);
if (m_maxLength != -1 && int(test_str.length()) > m_maxLength) {
return;
}
int width = Font_width(m_pFont, &test_str);
if (width < (m_width - PADDING)) {
m_text.insert(m_text.begin() + m_insertHead, k);
m_insertHead++;
}
}
void TextInputBox::render() {
GuiComponent_fill(&super, m_xPos, m_yPos, m_xPos + m_width, m_yPos + m_height, 0xFFAAAAAA);
GuiComponent_fill(&super, m_xPos + 1, m_yPos + 1, m_xPos + m_width - 1, m_yPos + m_height - 1, 0xFF000000);
int textYPos = (m_height - 8) / 2;
if (m_text.empty()) {
GuiComponent_drawString(&super, m_pFont, &m_placeholder, m_xPos + PADDING, m_yPos + textYPos, 0x404040);
} else {
GuiComponent_drawString(&super, m_pFont, &m_text, m_xPos + PADDING, m_yPos + textYPos, 0xFFFFFF);
}
if (m_bCursorOn) {
int xPos = 5;
std::string substr = m_text.substr(0, m_insertHead);
xPos += Font_width(m_pFont, &substr);
std::string str = "_";
GuiComponent_drawString(&super, m_pFont, &str, m_xPos + xPos, m_yPos + textYPos + 2, 0xFFFFFF);
}
}
bool TextInputBox::clicked(int xPos, int yPos) {
if (!m_bEnabled) {
return false;
}
if (xPos < m_xPos) {
return false;
}
if (yPos < m_yPos) {
return false;
}
if (xPos >= m_xPos + m_width) {
return false;
}
if (yPos >= m_yPos + m_height) {
return false;
}
return true;
}

View File

@ -0,0 +1,50 @@
#include <libreborn/libreborn.h>
#include <mods/text-input-box/TextInputScreen.h>
// VTable
void TextInputScreen::setup(Screen_vtable *vtable) {
vtable->keyPressed = [](Screen *super2, int key) {
Screen_keyPressed_non_virtual(super2, key);
TextInputScreen *self = (TextInputScreen *) super2;
for (int i = 0; i < int(self->m_textInputs->size()); i++) {
TextInputBox *textInput = (*self->m_textInputs)[i];
textInput->keyPressed(key);
}
};
vtable->keyboardNewChar = [](Screen *super2, char key) {
Screen_keyboardNewChar_non_virtual(super2, key);
TextInputScreen *self = (TextInputScreen *) super2;
for (int i = 0; i < int(self->m_textInputs->size()); i++) {
TextInputBox *textInput = (*self->m_textInputs)[i];
textInput->charPressed(key);
}
};
vtable->mouseClicked = [](Screen *super2, int x, int y, int param_1) {
Screen_mouseClicked_non_virtual(super2, x, y, param_1);
TextInputScreen *self = (TextInputScreen *) super2;
for (int i = 0; i < int(self->m_textInputs->size()); i++) {
TextInputBox *textInput = (*self->m_textInputs)[i];
textInput->onClick(x, y);
}
};
vtable->render = [](Screen *super2, int x, int y, float param_1) {
Screen_render_non_virtual(super2, x, y, param_1);
TextInputScreen *self = (TextInputScreen *) super2;
for (int i = 0; i < int(self->m_textInputs->size()); i++) {
TextInputBox *textInput = (*self->m_textInputs)[i];
textInput->tick();
textInput->render();
}
};
vtable->init = [](Screen *super2) {
Screen_init_non_virtual(super2);
TextInputScreen *self = (TextInputScreen *) super2;
self->m_textInputs = new std::vector<TextInputBox *>;
};
vtable->removed = [](Screen *super2) {
Screen_removed_non_virtual(super2);
TextInputScreen *self = (TextInputScreen *) super2;
delete self->m_textInputs;
};
}

View File

@ -1,2 +1,2 @@
# ``textures`` Mod
# `textures` Mod
This mod enables the animated water texture.

245
mods/src/textures/lava.cpp Normal file
View File

@ -0,0 +1,245 @@
#include <cmath>
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "textures-internal.h"
// Lava texture code was originally decompield by @iProgramMC as part of ReMinecraftPE.
// See: https://github.com/ReMinecraftPE/mcpe
// Structures
struct LavaTexture {
DynamicTexture super;
int field_14;
int field_18;
float m_data1[256];
float m_data2[256];
float m_data3[256];
float m_data4[256];
};
struct LavaSideTexture {
DynamicTexture super;
int field_14;
int field_18;
int field_1C;
float m_data1[256];
float m_data2[256];
float m_data3[256];
float m_data4[256];
};
struct FireTexture {
DynamicTexture super;
float m_data1[320];
float m_data2[320];
Random m_random;
};
// LavaTexture
CUSTOM_VTABLE(lava_texture, DynamicTexture) {
vtable->tick = [](DynamicTexture *super) {
LavaTexture *self = (LavaTexture *) super;
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
float f = 0.0F;
int ax = int(Mth_sin((float(x) * float(M_PI) * 2) / 16.0f) * 1.2f);
int ay = int(Mth_sin((float(y) * float(M_PI) * 2) / 16.0f) * 1.2f);
for (int bx = x - 1; bx <= x + 1; bx++) {
for (int by = y - 1; by <= y + 1; by++) {
int k2 = (bx + ay) & 0xf;
int i3 = (by + ax) & 0xf;
f += self->m_data1[k2 + i3 * 16];
}
}
self->m_data2[x + y * 16] = f / 10.0f + ((self->m_data3[(x & 0xf) + ((y + 0) & 0xf) * 16] + self->m_data3[((x + 1) & 0xf) + (y & 0xf) * 16] + self->m_data3[((x + 1) & 0xf) + ((y + 1) & 0xf) * 16] + self->m_data3[(x & 0xf) + ((y + 1) & 0xf) * 16]) * 0.25f) * 0.8f;
self->m_data3[x + y * 16] += self->m_data4[x + y * 16] * 0.01f;
if (self->m_data3[x + y * 16] < 0.0f) {
self->m_data3[x + y * 16] = 0.0f;
}
self->m_data4[x + y * 16] -= 0.06f;
if (Mth_random() < 0.005f) {
self->m_data4[x + y * 16] = 1.5f;
}
}
}
std::swap(self->m_data1, self->m_data2);
for (int i = 0; i < 256; i++) {
float x1 = self->m_data1[i] * 2.0f;
if (x1 > 1.0f) {
x1 = 1.0f;
}
if (x1 < 0.0f) {
x1 = 0.0f;
}
self->super.pixels[i * 4 + 0] = int(155.0f + 100.0f * x1);
self->super.pixels[i * 4 + 1] = int(255.0f * x1 * x1);
self->super.pixels[i * 4 + 2] = int(128.0f * x1 * x1 * x1 * x1);
self->super.pixels[i * 4 + 3] = 255;
}
};
}
static DynamicTexture *create_lava_texture() {
// Construct
LavaTexture *texture = new LavaTexture;
ALLOC_CHECK(texture);
DynamicTexture_constructor(&texture->super, Tile_lava->texture);
// Set VTable
texture->super.vtable = get_lava_texture_vtable();
// Setup
texture->field_14 = 0;
texture->field_18 = 0;
for (int i = 0; i < 256; i++) {
texture->m_data1[i] = 0.0f;
texture->m_data2[i] = 0.0f;
texture->m_data3[i] = 0.0f;
texture->m_data4[i] = 0.0f;
}
// Return
return (DynamicTexture *) texture;
}
// LavaSideTexture
CUSTOM_VTABLE(lava_side_texture, DynamicTexture) {
vtable->tick = [](DynamicTexture *super) {
LavaSideTexture *self = (LavaSideTexture *) super;
self->field_1C++;
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
float f = 0.0F;
int ax = int(Mth_sin((float(x) * float(M_PI) * 2) / 16.0f) * 1.2f);
int ay = int(Mth_sin((float(y) * float(M_PI) * 2) / 16.0f) * 1.2f);
for (int bx = x - 1; bx <= x + 1; bx++) {
for (int by = y - 1; by <= y + 1; by++) {
int k2 = (bx + ay) & 0xf;
int i3 = (by + ax) & 0xf;
f += self->m_data1[k2 + i3 * 16];
}
}
self->m_data2[x + y * 16] = f / 10.0f + ((self->m_data3[(x & 0xf) + ((y + 0) & 0xf) * 16] + self->m_data3[((x + 1) & 0xf) + (y & 0xf) * 16] + self->m_data3[((x + 1) & 0xf) + ((y + 1) & 0xf) * 16] + self->m_data3[(x & 0xf) + ((y + 1) & 0xf) * 16]) * 0.25f) * 0.8f;
self->m_data3[x + y * 16] += self->m_data4[x + y * 16] * 0.01f;
if (self->m_data3[x + y * 16] < 0.0f) {
self->m_data3[x + y * 16] = 0.0f;
}
self->m_data4[x + y * 16] -= 0.06f;
if (Mth_random() < 0.005f) {
self->m_data4[x + y * 16] = 1.5f;
}
}
}
std::swap(self->m_data1, self->m_data2);
for (int i = 0; i < 256; i++) {
float x1 = self->m_data1[(i - 16 * (self->field_1C / 3)) & 0xFF] * 2.0f;
if (x1 > 1.0f) {
x1 = 1.0f;
}
if (x1 < 0.0f) {
x1 = 0.0f;
}
self->super.pixels[i * 4 + 0] = int(155.0f + 100.0f * x1);
self->super.pixels[i * 4 + 1] = int(255.0f * x1 * x1);
self->super.pixels[i * 4 + 2] = int(128.0f * x1 * x1 * x1 * x1);
self->super.pixels[i * 4 + 3] = 255;
}
};
}
static DynamicTexture *create_lava_side_texture() {
// Construct
LavaSideTexture *texture = new LavaSideTexture;
ALLOC_CHECK(texture);
DynamicTexture_constructor(&texture->super, Tile_lava->texture + 1);
// Set VTable
texture->super.vtable = get_lava_side_texture_vtable();
// Setup
texture->field_14 = 0;
texture->field_18 = 0;
texture->field_1C = 0;
texture->super.texture_size = 2;
for (int i = 0; i < 256; i++) {
texture->m_data1[i] = 0.0f;
texture->m_data2[i] = 0.0f;
texture->m_data3[i] = 0.0f;
texture->m_data4[i] = 0.0f;
}
// Return
return (DynamicTexture *) texture;
}
// FireTexture
CUSTOM_VTABLE(fire_texture, DynamicTexture) {
vtable->tick = [](DynamicTexture *super) {
FireTexture *self = (FireTexture *) super;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 20; j++) {
int l = 18;
float f1 = self->m_data1[i + ((j + 1) % 20) * 16] * l;
for (int i1 = i - 1; i1 <= i + 1; i1++) {
for (int k1 = j; k1 <= j + 1; k1++) {
int i2 = i1;
int k2 = k1;
if (i2 >= 0 && k2 >= 0 && i2 < 16 && k2 < 20)
{
f1 += self->m_data1[i2 + k2 * 16];
}
l++;
}
}
self->m_data2[i + j * 16] = f1 / 25.2f;
if (j >= 19) {
union {
uint32_t x;
uint8_t b[4];
} a;
a.x = Random_genrand_int32(&self->m_random);
self->m_data2[i + j * 16] = 0.2f + (((a.b[3] / 256.0f) * 0.1f) + ((((a.b[0] / 256.0f) * (a.b[1] / 256.0f)) * (a.b[2] / 256.0f)) * 4.0f));
}
}
}
std::swap(self->m_data1, self->m_data2);
for (int i = 0; i < 256; i++) {
float x = self->m_data1[i] * 1.8f;
if (x > 1.0f) {
x = 1.0f;
}
if (x < 0.0f) {
x = 0.0f;
}
self->super.pixels[4 * i + 0] = int(x * 155.0f + 100.0f);
self->super.pixels[4 * i + 1] = int(x * x * 255.0f);
self->super.pixels[4 * i + 2] = int(x * x * x * x * x * x * x * x * x * x * 255.0f);
self->super.pixels[4 * i + 3] = x >= 0.5f ? 255 : 0;
}
};
}
static DynamicTexture *create_fire_texture(int a2) {
// Construct
FireTexture *texture = new FireTexture;
ALLOC_CHECK(texture);
DynamicTexture_constructor(&texture->super, Tile_fire->texture + (16 * a2));
// Set VTable
texture->super.vtable = get_fire_texture_vtable();
// Setup Random
int seed = Common_getTimeMs();
texture->m_random.seed = seed;
texture->m_random.param_1 = 0x271;
texture->m_random.param_2 = false;
texture->m_random.param_3 = 0;
// Return
return (DynamicTexture *) texture;
}
// Add Textures
static void Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) {
// Call Original Method
Textures_addDynamicTexture(textures, dynamic_texture);
// Add Lava
Textures_addDynamicTexture(textures, create_lava_texture());
Textures_addDynamicTexture(textures, create_lava_side_texture());
Textures_addDynamicTexture(textures, create_fire_texture(0));
Textures_addDynamicTexture(textures, create_fire_texture(1));
}
// Init
void _init_textures_lava() {
overwrite_call((void *) 0x170b4, (void *) Textures_addDynamicTexture_injection);
}

View File

@ -0,0 +1,3 @@
#pragma once
__attribute__((visibility("internal"))) void _init_textures_lava();

View File

@ -11,6 +11,7 @@
#include <mods/feature/feature.h>
#include <mods/textures/textures.h>
#include <mods/init/init.h>
#include "textures-internal.h"
#include "stb_image.h"
@ -213,8 +214,10 @@ static Texture AppPlatform_linux_loadTexture_injection(__attribute__((unused)) A
// Init
void init_textures() {
// Tick Dynamic Textures (Animated Water)
if (feature_has("Animated Water", server_disabled)) {
if (feature_has("Animated Water & Lava", server_disabled)) {
misc_run_on_tick(Minecraft_tick_injection);
// Animated Lava
_init_textures_lava();
}
// Scale Animated Textures

View File

@ -1,2 +1,2 @@
# ``title-screen`` Mod
# `title-screen` Mod
This mod improves the title screen.

View File

@ -1,2 +1,2 @@
# ``touch`` Mod
# `touch` Mod
This mod allows the hidden touch GUI to be activated.

View File

@ -1,2 +1,2 @@
# ``version`` Mod
# `version` Mod
This mod adds the MCPI-Reborn version to the start screen.

View File

@ -75,6 +75,8 @@ set(SRC
src/level/LevelData.def
src/level/LevelSettings.def
src/level/ServerLevel.def
src/level/Dimension.def
src/level/MultiPlayerLevel.def
src/item/ItemRenderer.def
src/item/ItemInHandRenderer.def
src/item/AuxDataTileItem.def
@ -107,10 +109,11 @@ set(SRC
src/gui/components/OptionsPane.def
src/gui/components/GuiComponent.def
src/gui/components/Button.def
src/gui/components/Gui.def
src/gui/Gui.def
src/gui/components/IntRectangle.def
src/gui/components/RectangleArea.def
src/gui/components/ScrollingPane.def
src/gui/components/Touch_TButton.def
src/app-platform/AppPlatform.def
src/app-platform/AppPlatform_linux.def
src/app-platform/AppPlatform_readAssetFile_return_value.def
@ -136,16 +139,19 @@ set(SRC
src/misc/Vec3.def
src/misc/HitResult.def
src/misc/PerfRenderer.def
src/misc/Texture.def
src/misc/Textures.def
src/textures/Texture.def
src/textures/Textures.def
src/textures/DynamicTexture.def
src/misc/SoundEngine.def
src/misc/Common.def
src/misc/Config.def
src/misc/Random.def
src/misc/Mth.def
src/input/IMoveInput.def
src/input/IBuildInput.def
src/input/MouseBuildInput.def
src/input/Mouse.def
src/input/Keyboard.def
src/recipes/FurnaceRecipes.def
src/recipes/Recipes.def
src/recipes/Recipes_Type.def

View File

@ -40,6 +40,7 @@ property HitResult hit_result = 0xc38;
property int progress = 0xc60;
property PerfRenderer *perf_renderer = 0xcbc;
property CommandServer *command_server = 0xcc0;
property Font *font = 0x16c;
// Smooth Lighting
static-property bool useAmbientOcclusion = 0x136b90;

View File

@ -0,0 +1 @@
method int width(std::string *string) = 0x24d4c;

View File

@ -1,7 +1,7 @@
size 0xa74;
extends GuiComponent;
size 0xa74;
method void tick() = 0x27778;
method void handleClick(int param_2, int param_3, int param_4) = 0x2599c;
method void renderOnSelectItemNameText(int param_1, Font *font, int param_2) = 0x26aec;

View File

@ -1,5 +1,6 @@
extends GuiComponent;
size 0x28;
constructor (int param_1, std::string *text) = 0x1bc54;
method int hovered(Minecraft *minecraft, int click_x, int click_y) = 0x1be2c;

View File

@ -1,3 +1,9 @@
size 0x8;
constructor () = 0x28204;
vtable 0x1039b0;
method void blit(int x_dest, int y_dest, int x_src, int y_src, int width_dest, int height_dest, int width_src, int height_src) = 0x282a4;
method void drawCenteredString(Font *font, std::string *text, int x, int y, int color) = 0x2821c;
method void fill(int x1, int y1, int x2, int y2, uint color) = 0x285f0;
method void drawString(Font *font, std::string *text, int x, int y, int color) = 0x28284;
method void fill(int x1, int y1, int x2, int y2, uint color) = 0x285f0;

View File

@ -3,3 +3,5 @@ extends ImageButton;
constructor (Options_Option *option) = 0x1c968;
method void updateImage(Options *options) = 0x1ca58;
property Options_Option *option = 0x54;

View File

@ -0,0 +1,4 @@
extends Button;
size 0x28;
constructor (int param_1, std::string *text) = 0x1c168;

View File

@ -1,15 +1,23 @@
extends GuiComponent;
size 0x48;
constructor () = 0x29028;
vtable-size 0x74;
vtable 0x1039d8;
virtual-method void updateEvents() = 0x14;
virtual-method void keyboardNewChar(char key) = 0x70;
virtual-method void keyPressed(int key) = 0x6c;
virtual-method void render(int param_1, int param_2, float param_3) = 0x8;
virtual-method void render(int x, int y, float param_1) = 0x8;
virtual-method bool handleBackEvent(bool param_1) = 0x24;
virtual-method void tick() = 0x28;
virtual-method void buttonClicked(Button *button) = 0x60;
virtual-method void init() = 0xc;
virtual-method void mouseClicked(int x, int y, int param_1) = 0x64;
virtual-method void removed() = 0x2c;
virtual-method void renderBackground() = 0x30;
virtual-method void setupPositions() = 0x10;
property Minecraft *minecraft = 0x14;
property std::vector<Button *> rendered_buttons = 0x18;
@ -17,3 +25,4 @@ property std::vector<Button *> selectable_buttons = 0x30;
property int width = 0x8;
property int height = 0xc;
property bool passthrough_input = 0x10;
property Font *font = 0x40;

View File

@ -1,5 +1,6 @@
extends Screen;
size 0x16c;
constructor () = 0x3afbc;
vtable 0x1053c0;

View File

@ -0,0 +1 @@
static-property std::vector<char> _inputText = 0x1364f0;

View File

@ -0,0 +1,5 @@
vtable 0x110370;
virtual-method void updateLightRamp() = 0x28;
property float light_ramp[16] = 0x10;

View File

@ -1,6 +1,6 @@
extends LevelSource;
vtable 0x108de0;
vtable 0x10fcf0;
method void saveLevelData() = 0xa2e94;
method void setTileAndData(int x, int y, int z, int id, int data) = 0xa38b4;

View File

@ -0,0 +1,3 @@
extends Level;
vtable 0x108de0;

View File

@ -2,4 +2,4 @@ extends Level;
size 0xb80;
constructor (uchar *storage, uchar *name, LevelSettings *settings, int param_4, uchar *dimension) = 0x7692c;
constructor (uchar *storage, uchar *name, LevelSettings *settings, int param_4, Dimension *dimension) = 0x7692c;

View File

@ -1,6 +1,5 @@
vtable 0x10e1b8;
constructor (Container *container, int param_1) = 0x919a8;
virtual-method uchar *destructor() = 0x0;
property Container *container = 0x1c;

View File

@ -10,8 +10,6 @@ method int getFreeSlot() = 0x91ffc;
method int getSlot(int id) = 0x91ce0;
method int linkSlot(int linked_slot, int unlinked_slot, bool push_aside) = 0x92188;
virtual-method ItemInstance *getItem(int pos) = 0x8;
virtual-method void setItem(int pos, ItemInstance *item) = 0xc;
virtual-method bool add(ItemInstance *item_instance) = 0x30;
property int *linked_slots = 0xc;

View File

@ -5,3 +5,4 @@ static-method void renderCursor(float x, float y, Minecraft *minecraft) = 0x480c
static-method void sleepMs(int x) = 0x13cf4;
static-method int sdl_key_to_minecraft_key(int sdl_key) = 0x1243c;
static-method void anGenBuffers(int count, uint *buffers) = 0x5f28c;
static-method int getTimeMs() = 0x13cd4;

5
symbols/src/misc/Mth.def Normal file
View File

@ -0,0 +1,5 @@
static-property Random _random = 0x17a87c;
static-method float random() = 0x777a4;
static-method float sin(float x) = 0x7775c;
static-method float cos(float x) = 0x77728;

View File

@ -1,3 +1,10 @@
method int genrand_int32() = 0x42cf8;
size 0x9d0;
static-property Random random = 0x17a87c;
method float nextFloat() = 0x42cf8;
method uint genrand_int32() = 0x50e14;
method void init_genrand(uint seed) = 0x27d38;
property uint seed = 0x0;
property int param_1 = 0x9c4; // Set To 0x271
property bool param_2 = 0x9c8; // Set To False
property float param_3 = 0x9cc; // Set To 0

View File

@ -0,0 +1,12 @@
vtable 0x108120;
vtable-size 0x10;
size 0x40c;
constructor (int texture) = 0x66154;
virtual-method void tick() = 0x8;
virtual-method void bindTexture(Textures *textures) = 0xc;
property int texture_index = 0x4;
property int texture_size = 0x8;
property uchar pixels[1024] = 0xc;

View File

@ -1,3 +1,4 @@
method void tick(bool param_1) = 0x531c4;
method int loadAndBindTexture(std::string *name) = 0x539cc;
method int assignTexture(std::string *name, uchar *data) = 0x5354c;
method void addDynamicTexture(DynamicTexture *texture) = 0x534f8;

View File

@ -11,11 +11,12 @@ method Tile *init() = 0xc34dc;
virtual-method bool isCubeShaped() = 0x8;
virtual-method int getRenderShape() = 0xc;
virtual-method void setShape(float x1, float y1, float z1, float x2, float y2, float z2) = 0x10;
virtual-method void updateShape(Level *level, int x, int y, int z) = 0x14;
virtual-method void updateShape(LevelSource *level, int x, int y, int z) = 0x14;
virtual-method void updateDefaultShape() = 0x18;
virtual-method float getBrightness(LevelSource *level, int x, int y, int z) = 0x20;
virtual-method int getTexture1() = 0x28;
virtual-method int getTexture2(int face) = 0x2c;
virtual-method int getTexture3(Level *level, int x, int y, int z, int face) = 0x30;
virtual-method int getTexture3(LevelSource *level, int x, int y, int z, int face) = 0x30;
virtual-method AABB *getAABB(Level *level, int x, int y, int z) = 0x34;
virtual-method bool isSolidRender() = 0x40;
virtual-method void tick(Level *level, int x, int y, int z) = 0x58;
@ -24,6 +25,7 @@ virtual-method void onPlace(Level *level, int x, int y, int z) = 0x68;
virtual-method void onRemove(Level *level, int x, int y, int z) = 0x6c;
virtual-method int getRenderLayer() = 0x94;
virtual-method int use(Level *level, int x, int y, int z, Player *player) = 0x98;
virtual-method void setPlacedBy(Level *level, int x, int y, int z, Mob *placer) = 0xa8;
virtual-method int getColor(LevelSource *level_source, int x, int y, int z) = 0xb8;
virtual-method std::string getDescriptionId() = 0xdc;
virtual-method Tile *setDescriptionId(std::string *description_id) = 0xe0;
@ -56,6 +58,7 @@ static-property Tile *info_updateGame2 = 0x181c6c;
static-property Tile *bedrock = 0x181cc4;
static-property Tile *tallgrass = 0x181d0c;
static-property Tile *stoneSlab = 0x181b44;
static-property Tile *fire = 0x181de0;
// "Carried" Tiles
static-property Tile *leaves = 0x18120c;

View File

@ -1 +1,3 @@
method void tesselateBlockInWorld(Tile *tile, int x, int y, int z) = 0x59e30;
property Level *level = 0x0;