Skip to content

Commit 61decc1

Browse files
authored
Merge pull request #26 from lukasabbe/1.21.9
1.21.10
2 parents 84b0525 + 47b10cf commit 61decc1

26 files changed

Lines changed: 125 additions & 104 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build
2-
on: [push, pull_request]
2+
on: [push]
33

44
jobs:
55
build:

build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
// see https://fabricmc.net/develop/ for new versions
3-
id 'fabric-loom' version '1.10-SNAPSHOT' apply false
3+
id 'fabric-loom' version '1.11-SNAPSHOT' apply false
44
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
5-
id 'net.neoforged.moddev' version '2.0.97' apply false
6-
5+
id 'net.neoforged.moddev' version '2.0.112' apply false
76
}

common/src/main/java/com/lukasabbe/bookshelfinspector/config/Config.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Config {
1919

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

4141
private void createConfig(Path configPath){
42-
Path defaultConfigPath = Services.PLATFORM.getFileInModContainer("bookshelfinspector", "bookshelfinspector-config.yml");
42+
Path defaultConfigPath = Services.PLATFORM.getFileOrCopyInModContainer("bookshelfinspector", "bookshelfinspector-config.yml");
43+
if(defaultConfigPath == null) return;
4344
try {
4445
Files.copy(defaultConfigPath, configPath);
4546
} catch (IOException e) {

common/src/main/java/com/lukasabbe/bookshelfinspector/mixin/BookshelfInvoker.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

common/src/main/java/com/lukasabbe/bookshelfinspector/mixin/BookshelfMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.lukasabbe.bookshelfinspector.mixin;
22

3-
import com.lukasabbe.bookshelfinspector.Constants;
43
import com.lukasabbe.bookshelfinspector.renderer.Inspector;
54
import net.minecraft.client.Minecraft;
65
import net.minecraft.client.player.LocalPlayer;

common/src/main/java/com/lukasabbe/bookshelfinspector/mixin/InGameHudMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.lukasabbe.bookshelfinspector.mixin;
22

3-
import com.lukasabbe.bookshelfinspector.Constants;
43
import com.lukasabbe.bookshelfinspector.renderer.HudRenderer;
54
import net.minecraft.client.DeltaTracker;
65
import net.minecraft.client.Minecraft;

common/src/main/java/com/lukasabbe/bookshelfinspector/platform/services/IPlatformHelper.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ public interface IPlatformHelper {
77

88
boolean isModLoaded(String modId);
99

10-
boolean isDevelopmentEnvironment();
11-
1210
Path getConfigPath(String file);
1311

14-
Path getFileInModContainer(String mod, String fileName);
15-
16-
default String getEnvironmentName() {
17-
18-
return isDevelopmentEnvironment() ? "development" : "production";
19-
}
12+
Path getFileOrCopyInModContainer(String mod, String fileName);
2013
}

common/src/main/java/com/lukasabbe/bookshelfinspector/renderer/HudRenderer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.lukasabbe.bookshelfinspector.renderer;
22

33
import com.lukasabbe.bookshelfinspector.BookshelfInspectorClient;
4-
import com.lukasabbe.bookshelfinspector.Constants;
54
import com.lukasabbe.bookshelfinspector.data.BookData;
65
import com.lukasabbe.bookshelfinspector.util.RomanNumerals;
7-
import com.mojang.blaze3d.vertex.PoseStack;
86
import net.minecraft.ChatFormatting;
97
import net.minecraft.client.Minecraft;
108
import net.minecraft.client.gui.Font;

common/src/main/java/com/lukasabbe/bookshelfinspector/renderer/Inspector.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
import com.lukasabbe.bookshelfinspector.BookshelfInspectorClient;
44
import com.lukasabbe.bookshelfinspector.data.BookData;
55
import com.lukasabbe.bookshelfinspector.data.Tags;
6-
import com.lukasabbe.bookshelfinspector.mixin.BookshelfInvoker;
76
import com.lukasabbe.bookshelfinspector.network.packets.BookShelfInventoryRequestPayload;
87
import com.lukasabbe.bookshelfinspector.network.packets.LecternInventoryRequestPayload;
98
import com.lukasabbe.bookshelfinspector.platform.Services;
109
import net.minecraft.client.Minecraft;
1110
import net.minecraft.core.BlockPos;
12-
import net.minecraft.world.level.block.Blocks;
1311
import net.minecraft.world.level.block.ChiseledBookShelfBlock;
1412
import net.minecraft.world.level.block.state.BlockState;
1513
import net.minecraft.world.phys.BlockHitResult;
@@ -23,9 +21,9 @@ public class Inspector {
2321
public void inspect(Minecraft client){
2422
if(!modAvailable) return;
2523

26-
if(client.cameraEntity == null || client.player == null) return;
24+
if(client.getCameraEntity() == null || client.player == null) return;
2725

28-
HitResult hit = client.cameraEntity.pick(5f,0f,false);
26+
HitResult hit = client.getCameraEntity().pick(5f,0f,false);
2927

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

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

8684
//if the position is empty, return
8785
if(optionalInt.isEmpty()) {

common/src/main/resources/bookshelfinspector.mixins.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
],
99
"client": [
1010
"BookshelfMixin",
11-
"InGameHudMixin",
12-
"BookshelfInvoker"
11+
"InGameHudMixin"
1312
],
1413
"server": [],
1514
"injectors": {

0 commit comments

Comments
 (0)