Skip to content

Commit 49a20f2

Browse files
committed
initial
1 parent b8b5d88 commit 49a20f2

51 files changed

Lines changed: 46947 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build ShulkerPreview ARM64
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK (needed for NDK tools)
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: temurin
22+
java-version: "17"
23+
24+
- name: Set up Android NDK
25+
uses: nttld/setup-ndk@v1
26+
id: setup_ndk
27+
with:
28+
ndk-version: r27c
29+
add-to-path: true
30+
31+
- name: Configure CMake (arm64-v8a)
32+
run: |
33+
cmake \
34+
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
35+
-DANDROID_ABI=arm64-v8a \
36+
-DANDROID_PLATFORM=android-26 \
37+
-DCMAKE_BUILD_TYPE=Release \
38+
-B build \
39+
-S .
40+
working-directory: ${{ github.workspace }}
41+
42+
- name: Build
43+
run: cmake --build build --config Release -j$(nproc)
44+
working-directory: ${{ github.workspace }}
45+
46+
- name: Upload artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: ShulkerPreview-arm64-v8a
50+
path: build/libShulkerPreview.so
51+
retention-days: 30

CMakeLists.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
cmake_minimum_required(VERSION 3.18)
2+
project(ShulkerPreview LANGUAGES C CXX)
3+
4+
set(CMAKE_CXX_STANDARD 20)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fvisibility=hidden -ffunction-sections -fdata-sections -fexceptions -w")
8+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fvisibility=hidden -ffunction-sections -fdata-sections -w")
9+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections,--strip-all -s")
10+
11+
include(FetchContent)
12+
13+
FetchContent_Declare(
14+
fmt
15+
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
16+
GIT_TAG 10.2.1
17+
)
18+
FetchContent_MakeAvailable(fmt)
19+
20+
FetchContent_Declare(
21+
preloader_android
22+
GIT_REPOSITORY https://github.com/LiteLDev/preloader-android.git
23+
GIT_TAG main
24+
)
25+
FetchContent_GetProperties(preloader_android)
26+
if(NOT preloader_android_POPULATED)
27+
FetchContent_Populate(preloader_android)
28+
29+
file(READ "${preloader_android_SOURCE_DIR}/src/pl/Logger.h" LOGGER_CONTENT)
30+
string(REPLACE "#include <format>" "#include <fmt/format.h>" LOGGER_CONTENT "${LOGGER_CONTENT}")
31+
string(REPLACE "std::vformat" "fmt::vformat" LOGGER_CONTENT "${LOGGER_CONTENT}")
32+
string(REPLACE "std::make_format_args" "fmt::make_format_args" LOGGER_CONTENT "${LOGGER_CONTENT}")
33+
file(WRITE "${preloader_android_SOURCE_DIR}/src/pl/Logger.h" "${LOGGER_CONTENT}")
34+
35+
add_subdirectory(${preloader_android_SOURCE_DIR} ${preloader_android_BINARY_DIR})
36+
endif()
37+
38+
target_link_libraries(preloader PUBLIC fmt::fmt)
39+
40+
FetchContent_Declare(
41+
glm
42+
GIT_REPOSITORY https://github.com/g-truc/glm.git
43+
GIT_TAG 0.9.9.8
44+
)
45+
FetchContent_MakeAvailable(glm)
46+
47+
FetchContent_Declare(
48+
simpleini
49+
GIT_REPOSITORY https://github.com/brofield/simpleini.git
50+
GIT_TAG master
51+
)
52+
FetchContent_MakeAvailable(simpleini)
53+
54+
include_directories(
55+
${CMAKE_SOURCE_DIR}/src
56+
${CMAKE_SOURCE_DIR}/src/ImGui
57+
${CMAKE_SOURCE_DIR}/src/ImGui/backends
58+
${simpleini_SOURCE_DIR}
59+
)
60+
61+
file(GLOB_RECURSE GAME_SOURCES
62+
src/*.cpp
63+
)
64+
# Exclude ImGui demo (not needed in release)
65+
list(FILTER GAME_SOURCES EXCLUDE REGEX ".*imgui_demo\\.cpp$")
66+
67+
add_library(ShulkerPreview SHARED ${GAME_SOURCES})
68+
target_include_directories(ShulkerPreview PRIVATE
69+
${CMAKE_SOURCE_DIR}/src
70+
${CMAKE_SOURCE_DIR}/src/ImGui
71+
${CMAKE_SOURCE_DIR}/src/ImGui/backends
72+
${simpleini_SOURCE_DIR}
73+
)
74+
target_link_libraries(ShulkerPreview
75+
preloader
76+
glm::glm
77+
log
78+
android
79+
EGL
80+
GLESv3
81+
GLESv2
82+
)

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
# ShulkerBoxPreview
1+
# ShulkerPreview
2+
3+
A mod that adds shulker box content previews (Android).
4+
5+
## Acknowledgements
6+
7+
Big thanks to [Kashifro](https://github.com/Kashifro) for finding the `arm64-v8a` signatures and helping out with other things!
8+
9+
## Requirements
10+
11+
- [LeviLauncher (Android)](https://github.com/LiteLDev/LeviLaunchroid)
12+
13+
## Installation
14+
15+
1. Download `libShulkerPreview.so` from [Releases](https://github.com/OpenMCBE/ShulkerBoxPreview/releases)
16+
2. Install LeviLauncher.
17+
3. Add the `libShulkerPreview.so` mod in LeviLauncher.
18+
4. Launch Minecraft through LeviLauncher.
19+
20+
## Known Issues
21+
22+
On Android touch screens, if you tap a Shulker Box and then slide your finger across the inventory (even over empty slots or other items), the preview UI stays visible while your finger is moving. Pull requests for fixing this would be highly appreciated!

0 commit comments

Comments
 (0)