Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
on: [push, pull_request]
on: [push]

jobs:
build:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release_fabric.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release Fabric
on: workflow_dispatch

jobs:
release:
strategy:
matrix:
java: [21]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: setup jsk ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: Build and Publish
run: ./gradlew fabric:build fabric:modrinth
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
- name: Capture build artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: fabric/build/libs/
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
// see https://fabricmc.net/develop/ for new versions
id 'fabric-loom' version '1.10-SNAPSHOT' apply false
id 'fabric-loom' version '1.11-SNAPSHOT' apply false
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
id 'net.neoforged.moddev' version '2.0.97' apply false

id 'net.neoforged.moddev' version '2.0.112' apply false
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Config {

public void loadConfig(){
Path configPath = Services.PLATFORM.getConfigPath("bookshelfinspector-config.yml");
if(!Files.exists(configPath))createConfig(configPath);
if(!Files.exists(configPath)) createConfig(configPath);
Yaml yaml = new Yaml();
try{
Map<String, Object> configMap = yaml.load(new FileReader(configPath.toFile()));
Expand All @@ -39,7 +39,8 @@ public void loadConfig(){
}

private void createConfig(Path configPath){
Path defaultConfigPath = Services.PLATFORM.getFileInModContainer("bookshelfinspector", "bookshelfinspector-config.yml");
Path defaultConfigPath = Services.PLATFORM.getFileOrCopyInModContainer("bookshelfinspector", "bookshelfinspector-config.yml");
if(defaultConfigPath == null) return;
try {
Files.copy(defaultConfigPath, configPath);
} catch (IOException e) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.lukasabbe.bookshelfinspector.mixin;

import com.lukasabbe.bookshelfinspector.Constants;
import com.lukasabbe.bookshelfinspector.renderer.Inspector;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.lukasabbe.bookshelfinspector.mixin;

import com.lukasabbe.bookshelfinspector.Constants;
import com.lukasabbe.bookshelfinspector.renderer.HudRenderer;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ public interface IPlatformHelper {

boolean isModLoaded(String modId);

boolean isDevelopmentEnvironment();

Path getConfigPath(String file);

Path getFileInModContainer(String mod, String fileName);

default String getEnvironmentName() {

return isDevelopmentEnvironment() ? "development" : "production";
}
Path getFileOrCopyInModContainer(String mod, String fileName);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.lukasabbe.bookshelfinspector.renderer;

import com.lukasabbe.bookshelfinspector.BookshelfInspectorClient;
import com.lukasabbe.bookshelfinspector.Constants;
import com.lukasabbe.bookshelfinspector.data.BookData;
import com.lukasabbe.bookshelfinspector.util.RomanNumerals;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import com.lukasabbe.bookshelfinspector.BookshelfInspectorClient;
import com.lukasabbe.bookshelfinspector.data.BookData;
import com.lukasabbe.bookshelfinspector.data.Tags;
import com.lukasabbe.bookshelfinspector.mixin.BookshelfInvoker;
import com.lukasabbe.bookshelfinspector.network.packets.BookShelfInventoryRequestPayload;
import com.lukasabbe.bookshelfinspector.network.packets.LecternInventoryRequestPayload;
import com.lukasabbe.bookshelfinspector.platform.Services;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ChiseledBookShelfBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
Expand All @@ -23,9 +21,9 @@ public class Inspector {
public void inspect(Minecraft client){
if(!modAvailable) return;

if(client.cameraEntity == null || client.player == null) return;
if(client.getCameraEntity() == null || client.player == null) return;

HitResult hit = client.cameraEntity.pick(5f,0f,false);
HitResult hit = client.getCameraEntity().pick(5f,0f,false);

//find block hit, if not found block returns
final HitResult.Type type = hit.getType();
Expand Down Expand Up @@ -81,7 +79,7 @@ private void bookShelfInspect(BlockPos pos, BlockHitResult blockHitResult, Minec

//Gets index position for a book in the bookshelf
ChiseledBookShelfBlock bookshelfBlock = (ChiseledBookShelfBlock) blockState.getBlock();
OptionalInt optionalInt = ((BookshelfInvoker)bookshelfBlock).invokerGetSlotForHitPos(blockHitResult,blockState);
OptionalInt optionalInt = bookshelfBlock.getHitSlot(blockHitResult, blockState.getValue(ChiseledBookShelfBlock.FACING));

//if the position is empty, return
if(optionalInt.isEmpty()) {
Expand Down
3 changes: 1 addition & 2 deletions common/src/main/resources/bookshelfinspector.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
],
"client": [
"BookshelfMixin",
"InGameHudMixin",
"BookshelfInvoker"
"InGameHudMixin"
],
"server": [],
"injectors": {
Expand Down
22 changes: 22 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'multiloader-loader'
id 'fabric-loom'
id "com.modrinth.minotaur" version "2.+"
}
repositories {
maven { url "https://maven.shedaniel.me/" }
Expand Down Expand Up @@ -44,4 +45,25 @@ loom {
runDir('runs/server')
}
}
}

modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "rOrXjyPb" // https://modrinth.com/mod/bookshelf-inspector
version = project.version
versionType = project.versionType
uploadFile = remapJar
gameVersions = [project.minecraft_version]
loaders = ["fabric"]
if(project.versionType == "beta" || project.versionType == "alpha"){
dependencies {
required.project "fabric-api"
}
}else{
dependencies {
required.project "fabric-api"
required.project "cloth-config"
required.project "modmenu"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lukasabbe.bookshelfinspector;
package com.lukasabbe.bookshelfinspector.config;

import com.lukasabbe.bookshelfinspector.BookshelfInspectorClient;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,16 @@ public String getPlatformName() {

@Override
public boolean isModLoaded(String modId) {

return FabricLoader.getInstance().isModLoaded(modId);
}

@Override
public boolean isDevelopmentEnvironment() {

return FabricLoader.getInstance().isDevelopmentEnvironment();
}

@Override
public Path getConfigPath(String file) {
return FabricLoader.getInstance().getConfigDir().resolve(file);
}

@Override
public Path getFileInModContainer(String mod, String fileName) {
public Path getFileOrCopyInModContainer(String mod, String fileName) {
if(FabricLoader.getInstance().getModContainer(mod).isEmpty()) return null;
ModContainer modContainer = FabricLoader.getInstance().getModContainer(mod).get();
return modContainer.findPath(fileName).orElseThrow();
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"com.lukasabbe.bookshelfinspector.BookshelfInspectorFabricClient"
],
"modmenu": [
"com.lukasabbe.bookshelfinspector.ModMenu"
"com.lukasabbe.bookshelfinspector.config.ModMenu"
]
},
"mixins": [
Expand All @@ -31,7 +31,7 @@
"depends": {
"fabricloader": ">=${fabric_loader_version}",
"fabric-api": "*",
"minecraft": "~${minecraft_version}",
"minecraft": "~1.21.9-beta.1",
"java": ">=${java_version}"
}
}
Expand Down
26 changes: 15 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
version=2.1+1.21.8
version=2.1+1.21.10

# release, beta & alpha
versionType=release
group=com.lukasabbe.bookshelfinspector
java_version=21

# Common
minecraft_version=1.21.8
minecraft_version=1.21.10
mod_name=BookshelfInspector
mod_author=Lukasabbe
mod_id=bookshelfinspector
license=MIT
credits=
description=Inspect any book in a chiseled bookshelf.
minecraft_version_range=[1.21.8, 1.22)
minecraft_version_range=[1.21.10, 1.22)

neo_form_version=1.21.8-20250717.133445
# https://projects.neoforged.net/neoforged/neoform
neo_form_version=1.21.10-20251007.142004
# The version of ParchmentMC that is used, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions
parchment_minecraft=1.21.8
parchment_version=2025.07.20
parchment_minecraft=1.21.9
parchment_version=2025.10.05

# Fabric
fabric_version=0.132.0+1.21.8
fabric_version=0.134.1+1.21.10
fabric_loader_version=0.17.2

# NeoForge
neoforge_version=21.8.39
neoforge_version=21.10.1-beta
neoforge_loader_version_range=[4,)

# Gradle
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# Global dep
YAML_snake=2.4
cloth_config=19.0.147
mod_menu=15.0.0-beta.3
YAML_snake=2.5
cloth_config=20.0.148
mod_menu=16.0.0-rc.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
24 changes: 22 additions & 2 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'multiloader-loader'
id 'net.neoforged.moddev'
id "com.modrinth.minotaur" version "2.+"
}
repositories {
maven { url "https://maven.shedaniel.me/" }
Expand Down Expand Up @@ -45,7 +46,26 @@ neoForge {

dependencies {
jarJar(implementation("org.yaml:snakeyaml:2.4")){}
additionalRuntimeClasspath "org.yaml:snakeyaml:2.4"
runtimeOnly "org.yaml:snakeyaml:2.4"
}

sourceSets.main.resources { srcDir 'src/generated/resources' }
sourceSets.main.resources { srcDir 'src/generated/resources' }

sourceSets.main.resources { srcDir 'src/generated/resources' }

modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "rOrXjyPb" // https://modrinth.com/mod/bookshelf-inspector
version = project.version
versionType = project.versionType
uploadFile = jar
gameVersions = [project.minecraft_version]
loaders = ["neoforge"]
if(project.versionType == "beta" || project.versionType == "alpha"){
dependencies {}
}else{
dependencies {
required.project "cloth-config"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.lukasabbe.bookshelfinspector;

import com.lukasabbe.bookshelfinspector.util.EventHandler;
import com.lukasabbe.bookshelfinspector.util.NetworkHandler;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;

@Mod(value = Constants.MOD_ID)
public class BookshelfInspectorNeoForge {

public BookshelfInspectorNeoForge(IEventBus eventBus) {
EventHandler.initServer();
eventBus.addListener(NetworkHandler::registerPayloads);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.lukasabbe.bookshelfinspector;

import com.lukasabbe.bookshelfinspector.config.ClothConfigGenerator;
import com.lukasabbe.bookshelfinspector.util.EventHandler;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModLoadingContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lukasabbe.bookshelfinspector;
package com.lukasabbe.bookshelfinspector.config;

import com.lukasabbe.bookshelfinspector.BookshelfInspectorClient;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.minecraft.client.gui.screens.Screen;
Expand Down Expand Up @@ -35,4 +36,4 @@ public static Screen createConfig(Screen parent){
builder.setSavingRunnable(BookshelfInspectorClient.config::saveConfig);
return builder.build();
}
}
}
Loading