Use 26.2 jar API directly
This commit is contained in:
+8
-6
@@ -17,7 +17,7 @@ import com.google.gson.JsonParser;
|
|||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.Screenshot;
|
import net.minecraft.client.Screenshot;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.core.component.DataComponents;
|
import net.minecraft.core.component.DataComponents;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
@@ -31,6 +31,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
|||||||
private final List<RenderJob> jobs = new ArrayList<>();
|
private final List<RenderJob> jobs = new ArrayList<>();
|
||||||
private Path outputDir;
|
private Path outputDir;
|
||||||
private int currentJobIndex;
|
private int currentJobIndex;
|
||||||
|
private RenderScreen renderScreen;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
@@ -53,7 +54,8 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Minecraft client = Minecraft.getInstance();
|
Minecraft client = Minecraft.getInstance();
|
||||||
client.execute(() -> client.screen = new RenderScreen());
|
renderScreen = new RenderScreen();
|
||||||
|
client.execute(() -> client.setScreen(renderScreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadJobs(Path manifestPath) throws IOException {
|
private void loadJobs(Path manifestPath) throws IOException {
|
||||||
@@ -102,7 +104,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
|||||||
String renderPath = renderPathElement.getAsString();
|
String renderPath = renderPathElement.getAsString();
|
||||||
String customName = customNameElement != null && customNameElement.isJsonPrimitive() ? customNameElement.getAsString() : null;
|
String customName = customNameElement != null && customNameElement.isJsonPrimitive() ? customNameElement.getAsString() : null;
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(BuiltInRegistries.ITEM.get(Identifier.withDefaultNamespace(itemId)));
|
ItemStack stack = new ItemStack(BuiltInRegistries.ITEM.getValue(Identifier.withDefaultNamespace(itemId)));
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -183,8 +185,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen currentScreen = client.screen;
|
if (renderScreen != null) {
|
||||||
if (currentScreen instanceof RenderScreen renderScreen) {
|
|
||||||
renderScreen.resetCaptureState();
|
renderScreen.resetCaptureState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +217,8 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void extractRenderState(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) {
|
||||||
|
super.extractRenderState(context, mouseX, mouseY, delta);
|
||||||
context.fill(0, 0, width, height, 0x00000000);
|
context.fill(0, 0, width, height, 0x00000000);
|
||||||
|
|
||||||
if (currentJobIndex < jobs.size()) {
|
if (currentJobIndex < jobs.size()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user