Skip to content

Commit

Permalink
refactor: rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
zimuya4153 committed Dec 10, 2024
1 parent 34aad4c commit f2154b2
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 937 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v2

- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@master

- run: |
xmake repo -u
Expand All @@ -21,8 +21,8 @@ jobs:
- run: |
xmake -w -y
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: |
bin/
bin/
30 changes: 16 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v2

- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@master

- run: |
xmake repo -u
Expand All @@ -21,7 +21,7 @@ jobs:
- run: |
xmake -w -y
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: |
Expand All @@ -34,24 +34,26 @@ jobs:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- name: Download Mod
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: release/
path: artifact

- run: |
cp LICENSE README.md release/
- name: Copy additional files
run: |
cp -v LICENSE README.md artifact/
- name: Archive release
run: |
cd release
zip -r ../${{ github.event.repository.name }}-windows-x64.zip *
cd ..
working-directory: artifact

- uses: softprops/action-gh-release@v1
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
append_body: true
files: |
${{ github.event.repository.name }}-windows-x64.zip
${{ github.event.repository.name }}-windows-x64.zip
13 changes: 10 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"name": "FuckNetherHeight",
"entry": "FuckNetherHeight.dll",
"name": "${modName}",
"entry": "${modFile}",
"type": "native",
"version": "0.13.5"
"version": "${modVersion}",
"description": "Fuck Vanilla Bedrock Edition Nether Height Limit",
"author": "GroupMountain",
"dependencies": [
{
"name": "GMLIB"
}
]
}
118 changes: 0 additions & 118 deletions scripts/after_build.lua

This file was deleted.

33 changes: 33 additions & 0 deletions src/Entry.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "Global.h"

namespace FuckNetherHeight {

std::unique_ptr<Entry>& Entry::getInstance() {
static std::unique_ptr<Entry> instance;
return instance;
}

bool Entry::load() {
if (ll::getServerStatus() != ll::ServerStatus::Starting) {
logger.error("FuckNetherHeight must be loaded at startup!");
return false;
}
enableMod();
return true;
}

bool Entry::enable() {
logger.info("FuckNetherHeight Loaded!");
logger.info("Author: GroupMountain");
logger.info("Repository: https://github.com/GroupMountain/FuckNetherHeight");
return true;
}

bool Entry::disable() {
disableMod();
return true;
}

} // namespace FuckNetherHeight

LL_REGISTER_MOD(FuckNetherHeight::Entry, FuckNetherHeight::Entry::getInstance());
27 changes: 27 additions & 0 deletions src/Entry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <span> // temporarily fix the workflows build

#include <ll/api/mod/NativeMod.h>
#include <ll/api/mod/RegisterHelper.h>

namespace FuckNetherHeight {

class Entry {

public:
static std::unique_ptr<Entry>& getInstance();

Entry(ll::mod::NativeMod& self) : mSelf(self) {}

[[nodiscard]] ll::mod::NativeMod& getSelf() const { return mSelf; }

bool load();

bool enable();

bool disable();

private:
ll::mod::NativeMod& mSelf;
};

} // namespace FuckNetherHeight
Loading

0 comments on commit f2154b2

Please sign in to comment.