Skip to content

Commit

Permalink
Migrate to 1.19.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnuecke committed Jan 6, 2023
1 parent 87774e1 commit 42da190
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 85 deletions.
4 changes: 2 additions & 2 deletions common/src/main/java/li/cil/manual/api/prefab/Manual.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.common.base.Suppliers;
import dev.architectury.registry.registries.Registrar;
import dev.architectury.registry.registries.Registries;
import dev.architectury.registry.registries.RegistrarManager;
import li.cil.manual.api.ManualModel;
import li.cil.manual.api.Tab;
import li.cil.manual.api.content.Document;
Expand Down Expand Up @@ -35,7 +35,7 @@ public class Manual implements ManualModel {
*/
private static final String REDIRECT_PRAGMA = "#redirect ";

private static final Supplier<Registries> REGISTRIES = Suppliers.memoize(() -> Registries.get(Constants.MOD_ID));
private static final Supplier<RegistrarManager> REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(Constants.MOD_ID));

// ----------------------------------------------------------------------- //

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import li.cil.manual.api.provider.PathProvider;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -43,8 +43,8 @@ public Optional<String> pathFor(final ItemStack stack) {
final Item item = stack.getItem();
final Block block = Block.byItem(item);
if (block != Blocks.AIR) {
final ResourceLocation blockId = Registry.BLOCK.getKey(block);
if (blockId == Registry.BLOCK.getDefaultKey()) {
final ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(block);
if (blockId == BuiltInRegistries.BLOCK.getDefaultKey()) {
return Optional.empty();
}

Expand All @@ -56,8 +56,8 @@ public Optional<String> pathFor(final ItemStack stack) {
.replace(PATH, blockId.getPath()));
}
} else {
final ResourceLocation itemId = Registry.ITEM.getKey(item);
if (itemId == Registry.ITEM.getDefaultKey()) {
final ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(item);
if (itemId == BuiltInRegistries.ITEM.getDefaultKey()) {
return Optional.empty();
}

Expand All @@ -76,8 +76,8 @@ public Optional<String> pathFor(final ItemStack stack) {
@Override
public Optional<String> pathFor(final Level world, final BlockPos pos, final Direction face) {
final Block block = world.getBlockState(pos).getBlock();
final ResourceLocation blockId = Registry.BLOCK.getKey(block);
if (blockId == Registry.BLOCK.getDefaultKey()) {
final ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(block);
if (blockId == BuiltInRegistries.BLOCK.getDefaultKey()) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.math.Matrix4f;
import it.unimi.dsi.fastutil.chars.Char2IntMap;
import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap;
import li.cil.manual.api.render.FontRenderer;
Expand Down Expand Up @@ -154,7 +153,7 @@ private void drawChar(final PoseStack matrixStack, final VertexConsumer buffer,
final float u = column * U_STEP;
final float v = row * V_STEP;

final Matrix4f matrix = matrixStack.last().pose();
final var matrix = matrixStack.last().pose();
buffer.vertex(matrix, x, lineHeight(), 0)
.color(r, g, b, a)
.uv(u, v + V_SIZE)
Expand Down Expand Up @@ -203,7 +202,9 @@ public static RenderType create(final ResourceLocation texture) {
// --------------------------------------------------------------------- //

private FontRenderTypes() {
super("", DefaultVertexFormat.POSITION, VertexFormat.Mode.QUADS, 256, false, false, () -> {}, () -> {});
super("", DefaultVertexFormat.POSITION, VertexFormat.Mode.QUADS, 256, false, false, () -> {
}, () -> {
});
throw new UnsupportedOperationException("No meant to be instantiated.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector4f;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import org.joml.Vector4f;

import javax.annotation.Nullable;

Expand All @@ -25,8 +25,8 @@ public void renderIcon(final PoseStack matrixStack) {
// This is *nasty*, but sadly there's no renderItemAndEffectIntoGUI() variant that
// takes a MatrixStack. Yet.

final Vector4f position = new Vector4f(0, 0, 0, 1);
position.transform(matrixStack.last().pose());
final var position = new Vector4f();
position.mul(matrixStack.last().pose());

final PoseStack renderSystemPoseStack = RenderSystem.getModelViewStack();
renderSystemPoseStack.pushPose();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package li.cil.manual.client.document.segment;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import li.cil.manual.api.render.ContentRenderer;
import li.cil.manual.api.render.InteractiveContentRenderer;
import li.cil.manual.api.util.PathUtils;
Expand Down Expand Up @@ -82,7 +81,7 @@ public Optional<InteractiveSegment> render(final PoseStack matrixStack, final in
mouseY >= y && mouseY <= y + height;
if (isHovered) {
DocumentRenderTypes.draw(DocumentRenderTypes.highlight(), (buffer) -> {
final Matrix4f matrix = matrixStack.last().pose();
final var matrix = matrixStack.last().pose();

final float r = 0.2f, g = 0.4f, b = 0.6f, a = 0.25f;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector4f;
import li.cil.manual.api.render.ContentRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.world.item.ItemStack;
import org.joml.Vector4f;

public final class ItemStackContentRenderer implements ContentRenderer {
/**
Expand Down Expand Up @@ -47,8 +47,8 @@ public void render(final PoseStack matrixStack, final int mouseX, final int mous
// This is *nasty*, but sadly there's no renderItemAndEffectIntoGUI() variant that
// takes a MatrixStack. Yet.

final Vector4f position = new Vector4f(0, 0, 0, 1);
position.transform(matrixStack.last().pose());
final var position = new Vector4f();
position.mul(matrixStack.last().pose());

final PoseStack renderSystemPoseStack = RenderSystem.getModelViewStack();
renderSystemPoseStack.pushPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import li.cil.manual.api.render.ContentRenderer;
import li.cil.manual.client.document.DocumentRenderTypes;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -51,7 +50,7 @@ public int getHeight() {
@Override
public void render(final PoseStack matrixStack, final int mouseX, final int mouseY) {
DocumentRenderTypes.draw(DocumentRenderTypes.texture(location), (buffer) -> {
final Matrix4f matrix = matrixStack.last().pose();
final var matrix = matrixStack.last().pose();
buffer.vertex(matrix, 0, texture.height, 0).uv(0, 1).endVertex();
buffer.vertex(matrix, texture.width, texture.height, 0).uv(1, 1).endVertex();
buffer.vertex(matrix, texture.width, 0, 0).uv(1, 0).endVertex();
Expand Down
Loading

0 comments on commit 42da190

Please sign in to comment.