mirror of
https://github.com/lukasabbe/bookshelf-inspector.git
synced 2026-04-30 10:40:53 +00:00
25w06a
This commit is contained in:
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
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=25w02a
|
minecraft_version=25w06a
|
||||||
yarn_mappings=25w02a+build.9
|
yarn_mappings=25w06a+build.7
|
||||||
loader_version=0.16.10
|
loader_version=0.16.10
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.9+1.21.5-SNAPSHOT.1
|
mod_version=1.9+1.21.5-SNAPSHOT.1
|
||||||
@@ -11,7 +11,7 @@ maven_group=me.lukasabbe
|
|||||||
archives_base_name=Bookshelfinspector
|
archives_base_name=Bookshelfinspector
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.114.1+1.21.5
|
fabric_version=0.116.0+1.21.5
|
||||||
cloth_config=17.0.144
|
cloth_config=17.0.144
|
||||||
modmenu=13.0.0
|
modmenu=13.0.0
|
||||||
YAML_snake=2.3
|
YAML_snake=2.3
|
||||||
@@ -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());
|
||||||
|
|
||||||
|
|||||||
@@ -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,19 +24,20 @@ 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;
|
||||||
int screenWidth = client.getWindow().getScaledWidth();
|
final int screenWidth = client.getWindow().getScaledWidth();
|
||||||
int screenHeight = client.getWindow().getScaledHeight();
|
final int screenHeight = client.getWindow().getScaledHeight();
|
||||||
int x = screenWidth / 2;
|
final int x = screenWidth / 2;
|
||||||
int y = screenHeight / 2;
|
final int y = screenHeight / 2;
|
||||||
final ItemStack itemStack = currentBookData.itemStack;
|
final ItemStack itemStack = currentBookData.itemStack;
|
||||||
|
|
||||||
int color = 0xFFFFFFFF;
|
int color = 0xFFFFFFFF;
|
||||||
|
|
||||||
final Integer colorValue = itemStack.getRarity().getFormatting().getColorValue();
|
final Integer colorValue = itemStack.getRarity().getFormatting().getColorValue();
|
||||||
|
|
||||||
if(colorValue != null){
|
if(colorValue != null){
|
||||||
color = colorValue;
|
color = colorValue;
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,6 @@ public class HudRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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();
|
||||||
stack.push();
|
stack.push();
|
||||||
|
|||||||
Reference in New Issue
Block a user