Align renderer with 26.2 client API
This commit is contained in:
+7
-6
@@ -17,8 +17,9 @@ import com.google.gson.JsonParser;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Screenshot;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.Identifier;
|
||||
@@ -52,7 +53,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
}
|
||||
|
||||
Minecraft client = Minecraft.getInstance();
|
||||
client.execute(() -> client.setScreen(new RenderScreen()));
|
||||
client.execute(() -> client.screen = new RenderScreen());
|
||||
}
|
||||
|
||||
private void loadJobs(Path manifestPath) throws IOException {
|
||||
@@ -107,7 +108,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
}
|
||||
|
||||
if (customName != null) {
|
||||
stack.setHoverName(Component.literal(customName));
|
||||
stack.set(DataComponents.CUSTOM_NAME, Component.literal(customName));
|
||||
}
|
||||
|
||||
jobs.add(new RenderJob(renderPath, stack));
|
||||
@@ -182,7 +183,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
return;
|
||||
}
|
||||
|
||||
Screen currentScreen = client.currentScreen;
|
||||
Screen currentScreen = client.screen;
|
||||
if (currentScreen instanceof RenderScreen renderScreen) {
|
||||
renderScreen.resetCaptureState();
|
||||
}
|
||||
@@ -215,12 +216,12 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
context.fill(0, 0, width, height, 0x00000000);
|
||||
|
||||
if (currentJobIndex < jobs.size()) {
|
||||
RenderJob job = jobs.get(currentJobIndex);
|
||||
context.renderItem(job.stack(), (width / 2) - 8, (height / 2) - 8);
|
||||
context.drawItem(job.stack(), (width / 2) - 8, (height / 2) - 8);
|
||||
|
||||
if (!captureQueued) {
|
||||
captureQueued = true;
|
||||
|
||||
Reference in New Issue
Block a user