mirror of
https://github.com/lukasabbe/bookshelf-inspector.git
synced 2026-04-30 10:40:53 +00:00
@@ -14,18 +14,17 @@ jobs:
|
|||||||
- name: checkout repository
|
- name: checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: validate gradle wrapper
|
- name: validate gradle wrapper
|
||||||
uses: gradle/wrapper-validation-action@v2
|
uses: gradle/actions/wrapper-validation@v4
|
||||||
- name: setup jdk ${{ matrix.java }}
|
- name: setup jdk
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java }}
|
java-version: '21'
|
||||||
distribution: 'microsoft'
|
distribution: 'microsoft'
|
||||||
- name: make gradle wrapper executable
|
- name: make gradle wrapper executable
|
||||||
run: chmod +x ./gradlew
|
run: chmod +x ./gradlew
|
||||||
- name: build
|
- name: build
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
- name: capture build artifacts
|
- name: capture build artifacts
|
||||||
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Artifacts
|
name: Artifacts
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
name: Release
|
||||||
|
on: [workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java: [
|
||||||
|
21,
|
||||||
|
]
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: checkout rep
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: validate gradle wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
- name: setup jdk ${{ matrix.java }}
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: ${{ matrix.java }}
|
||||||
|
distribution: 'microsoft'
|
||||||
|
- name: make gradle wrapper executable
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
- name: build
|
||||||
|
run: ./gradlew build
|
||||||
|
- name: capture build artifacts
|
||||||
|
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: Artifacts
|
||||||
|
path: build/libs/
|
||||||
|
- uses: Kir-Antipov/mc-publish@v3.3
|
||||||
|
with:
|
||||||
|
modrinth-id: rOrXjyPb
|
||||||
|
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
|
||||||
|
changelog-file: CHANGELOG.md
|
||||||
|
dependencies: |
|
||||||
|
fabric-api
|
||||||
|
modmenu
|
||||||
|
cloth-config
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Test change log
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.8-SNAPSHOT'
|
id 'fabric-loom' version '1.10-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -2,16 +2,16 @@
|
|||||||
org.gradle.jvmargs=-Xmx4G
|
org.gradle.jvmargs=-Xmx4G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.21.4
|
minecraft_version=1.21.5
|
||||||
yarn_mappings=1.21.4+build.1
|
yarn_mappings=1.21.5+build.1
|
||||||
loader_version=0.16.9
|
loader_version=0.16.10
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.9+1.21.4-SNAPSHOT.4
|
mod_version=1.9+1.21.5
|
||||||
maven_group=me.lukasabbe
|
maven_group=me.lukasabbe
|
||||||
archives_base_name=Bookshelfinspector
|
archives_base_name=Bookshelfinspector
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.110.5+1.21.4
|
fabric_version=0.119.5+1.21.5
|
||||||
cloth_config=16.0.141
|
cloth_config=17.0.144
|
||||||
modmenu=12.0.0-beta.1
|
modmenu=13.0.0
|
||||||
YAML_snake=2.2
|
YAML_snake=2.3
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -84,7 +86,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|||||||
Vendored
+2
@@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ public class Bookshelfinspector implements ModInitializer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
//Registers request types
|
||||||
PayloadTypeRegistry.playC2S().register(BookShelfInventoryRequestPayload.ID,BookShelfInventoryRequestPayload.CODEC);
|
PayloadTypeRegistry.playC2S().register(BookShelfInventoryRequestPayload.ID,BookShelfInventoryRequestPayload.CODEC);
|
||||||
PayloadTypeRegistry.playC2S().register(LecternInventoryRequestPayload.ID, LecternInventoryRequestPayload.CODEC);
|
PayloadTypeRegistry.playC2S().register(LecternInventoryRequestPayload.ID, LecternInventoryRequestPayload.CODEC);
|
||||||
PayloadTypeRegistry.playS2C().register(BookShelfInventoryPayload.ID,BookShelfInventoryPayload.CODEC);
|
PayloadTypeRegistry.playS2C().register(BookShelfInventoryPayload.ID,BookShelfInventoryPayload.CODEC);
|
||||||
PayloadTypeRegistry.playS2C().register(ModCheckPayload.ID, ModCheckPayload.CODEC);
|
PayloadTypeRegistry.playS2C().register(ModCheckPayload.ID, ModCheckPayload.CODEC);
|
||||||
|
|
||||||
ServerPlayNetworking.registerGlobalReceiver(BookShelfInventoryRequestPayload.ID, new BookShelfInventoryRequestPayloadHandler());
|
ServerPlayNetworking.registerGlobalReceiver(BookShelfInventoryRequestPayload.ID, new BookShelfInventoryRequestPayloadHandler());
|
||||||
|
|
||||||
ServerPlayNetworking.registerGlobalReceiver(LecternInventoryRequestPayload.ID, new LecternInventoryRequestPayloadHandler());
|
ServerPlayNetworking.registerGlobalReceiver(LecternInventoryRequestPayload.ID, new LecternInventoryRequestPayloadHandler());
|
||||||
|
|
||||||
ServerPlayConnectionEvents.JOIN.register(((handler, sender, server) -> {
|
ServerPlayConnectionEvents.JOIN.register(((handler, sender, server) -> {
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ public class BookshelfinspectorClient implements ClientModInitializer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
|
||||||
config.loadConfig();
|
config.loadConfig();
|
||||||
|
|
||||||
ClientPlayNetworking.registerGlobalReceiver(BookShelfInventoryPayload.ID, new BookShelfInventoryHandler());
|
ClientPlayNetworking.registerGlobalReceiver(BookShelfInventoryPayload.ID, new BookShelfInventoryHandler());
|
||||||
ClientPlayNetworking.registerGlobalReceiver(ModCheckPayload.ID,new ModPayloadHandler());
|
ClientPlayNetworking.registerGlobalReceiver(ModCheckPayload.ID,new ModPayloadHandler());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package me.lukasabbe.bookshelfinspector.mixin;
|
package me.lukasabbe.bookshelfinspector.mixin;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import me.lukasabbe.bookshelfinspector.util.HudRenderer;
|
import me.lukasabbe.bookshelfinspector.util.HudRenderer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
@@ -22,8 +21,6 @@ public class InGameHudMixin {
|
|||||||
|
|
||||||
@Inject(method = "render",at=@At("RETURN"))
|
@Inject(method = "render",at=@At("RETURN"))
|
||||||
public void render(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci){
|
public void render(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci){
|
||||||
RenderSystem.enableBlend();
|
|
||||||
HudRenderer.hudRender(context, client);
|
HudRenderer.hudRender(context, client);
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,14 @@ public class BookshelfTools {
|
|||||||
final World world = Bookshelfinspector.serverInstance.getPlayerManager().getPlayer(player.getUuid()).getWorld();
|
final World world = Bookshelfinspector.serverInstance.getPlayerManager().getPlayer(player.getUuid()).getWorld();
|
||||||
|
|
||||||
if(world == null) return null;
|
if(world == null) return null;
|
||||||
Optional<ChiseledBookshelfBlockEntity> blockEntityOptional = world.getBlockEntity(pos,BlockEntityType.CHISELED_BOOKSHELF);
|
|
||||||
|
final Optional<ChiseledBookshelfBlockEntity> blockEntityOptional = world.getBlockEntity(pos,BlockEntityType.CHISELED_BOOKSHELF);
|
||||||
|
|
||||||
if(blockEntityOptional.isEmpty()) return null;
|
if(blockEntityOptional.isEmpty()) return null;
|
||||||
|
|
||||||
ChiseledBookshelfBlockEntity blockEntity = blockEntityOptional.get();
|
final ChiseledBookshelfBlockEntity blockEntity = blockEntityOptional.get();
|
||||||
|
|
||||||
final ItemStack stack = blockEntity.getStack(slotNum);
|
final ItemStack stack = blockEntity.getStack(slotNum);
|
||||||
|
|
||||||
if(stack.isEmpty()) return null;
|
if(stack.isEmpty()) return null;
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
|
|||||||
@@ -24,60 +24,60 @@ import net.minecraft.util.Formatting;
|
|||||||
public class HudRenderer {
|
public class HudRenderer {
|
||||||
public static void hudRender(DrawContext context, MinecraftClient client){
|
public static void hudRender(DrawContext context, MinecraftClient client){
|
||||||
if(!BookshelfinspectorClient.modAvailable) return;
|
if(!BookshelfinspectorClient.modAvailable) return;
|
||||||
|
|
||||||
if(client.options.hudHidden) return;
|
if(client.options.hudHidden) return;
|
||||||
|
if(!BookshelfinspectorClient.bookShelfData.isCurrentBookDataToggled) return;
|
||||||
|
|
||||||
if(BookshelfinspectorClient.bookShelfData.isCurrentBookDataToggled){
|
final BookData currentBookData = BookshelfinspectorClient.currentBookData;
|
||||||
final BookData currentBookData = BookshelfinspectorClient.currentBookData;
|
final int screenWidth = client.getWindow().getScaledWidth();
|
||||||
int screenWidth = client.getWindow().getScaledWidth();
|
final int screenHeight = client.getWindow().getScaledHeight();
|
||||||
int screenHeight = client.getWindow().getScaledHeight();
|
final int x = screenWidth / 2;
|
||||||
int x = screenWidth / 2;
|
final int y = screenHeight / 2;
|
||||||
int y = screenHeight / 2;
|
final ItemStack itemStack = currentBookData.itemStack;
|
||||||
final ItemStack itemStack = currentBookData.itemStack;
|
|
||||||
int color = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
final Integer colorValue = itemStack.getRarity().getFormatting().getColorValue();
|
int color = 0xFFFFFFFF;
|
||||||
if(colorValue != null){
|
|
||||||
color = colorValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
float scaleFactor = ((float) BookshelfinspectorClient.config.scale /10);
|
final Integer colorValue = itemStack.getRarity().getFormatting().getColorValue();
|
||||||
drawScaledText(context, itemStack.getName(), x,y+((int)(10*scaleFactor)), color, client.textRenderer);
|
|
||||||
|
|
||||||
ItemEnchantmentsComponent storedComponents = itemStack.getComponents().get(DataComponentTypes.STORED_ENCHANTMENTS);
|
|
||||||
if(storedComponents != null){
|
|
||||||
int i = ((int)(20*scaleFactor));
|
|
||||||
for(RegistryEntry<Enchantment> enchantment : storedComponents.getEnchantments()){
|
|
||||||
String lvl = "";
|
|
||||||
final int level = storedComponents.getLevel(enchantment);
|
|
||||||
if(level != 1)
|
|
||||||
lvl = String.valueOf(level);
|
|
||||||
final MutableText enchantmentText;
|
|
||||||
|
|
||||||
if(!BookshelfinspectorClient.config.useRoman || level == -1)
|
|
||||||
enchantmentText = enchantment.value().description().copy().append(" " + lvl);
|
|
||||||
else if (level != 1)
|
|
||||||
enchantmentText = enchantment.value().description().copy().append(" " + RomanNumerals.toRoman(level));
|
|
||||||
else
|
|
||||||
enchantmentText = enchantment.value().description().copy();
|
|
||||||
|
|
||||||
if(enchantment.isIn(EnchantmentTags.CURSE)) {
|
|
||||||
Texts.setStyleIfAbsent(enchantmentText, Style.EMPTY.withColor(Formatting.RED));
|
|
||||||
}else {
|
|
||||||
Texts.setStyleIfAbsent(enchantmentText, Style.EMPTY.withColor(Formatting.GRAY));
|
|
||||||
}
|
|
||||||
drawScaledText(context, enchantmentText, x,y+i, 0xFFFFFFFF,client.textRenderer);
|
|
||||||
i+=(int)(10*scaleFactor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var writtenBookContentComponent = itemStack.getComponents().get(DataComponentTypes.WRITTEN_BOOK_CONTENT);
|
|
||||||
|
|
||||||
if(writtenBookContentComponent != null){
|
|
||||||
drawScaledText(context, Text.translatable("book.byAuthor",writtenBookContentComponent.author()), x,y+(int)(20*scaleFactor), 0xFFFFFFFF,client.textRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(colorValue != null){
|
||||||
|
color = colorValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float scaleFactor = ((float) BookshelfinspectorClient.config.scale /10);
|
||||||
|
drawScaledText(context, itemStack.getName(), x,y+((int)(10*scaleFactor)), color, client.textRenderer);
|
||||||
|
|
||||||
|
ItemEnchantmentsComponent storedComponents = itemStack.getComponents().get(DataComponentTypes.STORED_ENCHANTMENTS);
|
||||||
|
if(storedComponents != null){
|
||||||
|
int i = ((int)(20*scaleFactor));
|
||||||
|
for(RegistryEntry<Enchantment> enchantment : storedComponents.getEnchantments()){
|
||||||
|
String lvl = "";
|
||||||
|
final int level = storedComponents.getLevel(enchantment);
|
||||||
|
if(level != 1)
|
||||||
|
lvl = String.valueOf(level);
|
||||||
|
final MutableText enchantmentText;
|
||||||
|
|
||||||
|
if(!BookshelfinspectorClient.config.useRoman || level == -1)
|
||||||
|
enchantmentText = enchantment.value().description().copy().append(" " + lvl);
|
||||||
|
else if (level != 1)
|
||||||
|
enchantmentText = enchantment.value().description().copy().append(" " + RomanNumerals.toRoman(level));
|
||||||
|
else
|
||||||
|
enchantmentText = enchantment.value().description().copy();
|
||||||
|
|
||||||
|
if(enchantment.isIn(EnchantmentTags.CURSE)) {
|
||||||
|
Texts.setStyleIfAbsent(enchantmentText, Style.EMPTY.withColor(Formatting.RED));
|
||||||
|
}else {
|
||||||
|
Texts.setStyleIfAbsent(enchantmentText, Style.EMPTY.withColor(Formatting.GRAY));
|
||||||
|
}
|
||||||
|
drawScaledText(context, enchantmentText, x,y+i, 0xFFFFFFFF,client.textRenderer);
|
||||||
|
i+=(int)(10*scaleFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var writtenBookContentComponent = itemStack.getComponents().get(DataComponentTypes.WRITTEN_BOOK_CONTENT);
|
||||||
|
|
||||||
|
if(writtenBookContentComponent != null){
|
||||||
|
drawScaledText(context, Text.translatable("book.byAuthor",writtenBookContentComponent.author()), x,y+(int)(20*scaleFactor), 0xFFFFFFFF,client.textRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private static void drawScaledText(DrawContext context, Text text, int centerX, int y, int color, TextRenderer textRenderer){
|
private static void drawScaledText(DrawContext context, Text text, int centerX, int y, int color, TextRenderer textRenderer){
|
||||||
MatrixStack stack = context.getMatrices();
|
MatrixStack stack = context.getMatrices();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=${loader_version}",
|
"fabricloader": ">=${loader_version}",
|
||||||
"minecraft": ">=1.21.4",
|
"minecraft": ">=1.21.5",
|
||||||
"fabric-api-base": "*",
|
"fabric-api-base": "*",
|
||||||
"fabric-networking-api-v1": "*",
|
"fabric-networking-api-v1": "*",
|
||||||
"fabric-lifecycle-events-v1": "*",
|
"fabric-lifecycle-events-v1": "*",
|
||||||
|
|||||||
Reference in New Issue
Block a user