mirror of
https://github.com/lukasabbe/bookshelf-inspector.git
synced 2026-04-30 10:40:53 +00:00
Start for snapshots, alot of small things had broken
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/*
|
||||
package me.lukasabbe.bookshelfinspector.config;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
@@ -44,3 +45,4 @@ public class ModMenu implements ModMenuApi {
|
||||
};
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -7,7 +7,7 @@ import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.GuiLayer;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.ItemEnchantmentsComponent;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.Texts;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.joml.Matrix3x2fStack;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class HudRenderer {
|
||||
@@ -27,6 +28,7 @@ public class HudRenderer {
|
||||
if(client.options.hudHidden) return;
|
||||
if(!BookshelfinspectorClient.bookShelfData.isCurrentBookDataToggled) return;
|
||||
|
||||
context.pushGuiLayer(GuiLayer.HUD);
|
||||
final BookData currentBookData = BookshelfinspectorClient.currentBookData;
|
||||
final int screenWidth = client.getWindow().getScaledWidth();
|
||||
final int screenHeight = client.getWindow().getScaledHeight();
|
||||
@@ -78,15 +80,17 @@ public class HudRenderer {
|
||||
drawScaledText(context, Text.translatable("book.byAuthor",writtenBookContentComponent.author()), x,y+(int)(20*scaleFactor), 0xFFFFFFFF,client.textRenderer);
|
||||
}
|
||||
|
||||
context.popGuiLayer();
|
||||
|
||||
}
|
||||
private static void drawScaledText(DrawContext context, Text text, int centerX, int y, int color, TextRenderer textRenderer){
|
||||
MatrixStack stack = context.getMatrices();
|
||||
stack.push();
|
||||
stack.translate(centerX,y,0);
|
||||
Matrix3x2fStack stack = context.getMatrices();
|
||||
stack.pushMatrix();
|
||||
stack.translate(centerX,y);
|
||||
final float scale = (float) BookshelfinspectorClient.config.scale / 10;
|
||||
stack.scale(scale, scale, scale);
|
||||
stack.translate(-centerX,-y,0);
|
||||
stack.scale(scale, scale);
|
||||
stack.translate(-centerX,-y);
|
||||
context.drawCenteredTextWithShadow(textRenderer,text,centerX,y,color);
|
||||
stack.pop();
|
||||
stack.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
],
|
||||
"main": [
|
||||
"me.lukasabbe.bookshelfinspector.Bookshelfinspector"
|
||||
],
|
||||
"modmenu": [
|
||||
"me.lukasabbe.bookshelfinspector.config.ModMenu"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
@@ -25,7 +22,7 @@
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=${loader_version}",
|
||||
"minecraft": ">=1.21.6-alpha.25.14.craftmine",
|
||||
"minecraft": ">=1.21.6-alpha.25.15.a",
|
||||
"fabric-api-base": "*",
|
||||
"fabric-networking-api-v1": "*",
|
||||
"fabric-lifecycle-events-v1": "*",
|
||||
|
||||
Reference in New Issue
Block a user