From 667c7993dcea8b09bdffcad9956b353f054ad6e2 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 17 Jun 2024 00:07:02 +0900 Subject: Update to 1.21 --- .../client/entry/type/BuiltinClientEntryTypes.java | 2 +- .../api/client/favorites/FavoriteEntryType.java | 4 +- .../rei/api/client/gui/SimpleDisplayRenderer.java | 2 +- .../rei/api/client/util/SpriteRenderer.java | 54 ++++++++++------------ .../rei/api/common/display/basic/BasicDisplay.java | 2 +- .../shedaniel/rei/api/common/entry/EntryStack.java | 2 +- .../api/common/entry/type/BuiltinEntryTypes.java | 2 +- .../api/common/entry/type/VanillaEntryTypes.java | 4 +- .../api/common/registry/RecipeManagerContext.java | 2 +- .../info/simple/RecipeBookGridMenuInfo.java | 2 +- 10 files changed, 36 insertions(+), 40 deletions(-) (limited to 'api/src') diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/type/BuiltinClientEntryTypes.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/type/BuiltinClientEntryTypes.java index 96c6b860d..3b2d45225 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/entry/type/BuiltinClientEntryTypes.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/type/BuiltinClientEntryTypes.java @@ -33,7 +33,7 @@ import org.jetbrains.annotations.ApiStatus; @ApiStatus.NonExtendable @Environment(EnvType.CLIENT) public interface BuiltinClientEntryTypes { - ResourceLocation RENDERING_ID = new ResourceLocation("rendering"); + ResourceLocation RENDERING_ID = ResourceLocation.withDefaultNamespace("rendering"); EntryType RENDERING = EntryType.deferred(RENDERING_ID); } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java b/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java index 62236f22c..87738b156 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java @@ -44,12 +44,12 @@ public interface FavoriteEntryType { /** * A builtin type of favorites, wrapping a {@link EntryStack}. */ - ResourceLocation ENTRY_STACK = new ResourceLocation("roughlyenoughitems", "entry_stack"); + ResourceLocation ENTRY_STACK = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "entry_stack"); /** * A builtin type of favorites, wrapping a {@link Display}. */ @ApiStatus.Experimental - ResourceLocation DISPLAY = new ResourceLocation("roughlyenoughitems", "display"); + ResourceLocation DISPLAY = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "display"); static Registry registry() { return PluginManager.getClientInstance().get(FavoriteEntryType.Registry.class); diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java index f62ec2491..c3963ec93 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java @@ -47,7 +47,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class SimpleDisplayRenderer extends DisplayRenderer implements WidgetHolder { - protected static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png"); + protected static final ResourceLocation CHEST_GUI_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/recipecontainer.png"); protected List inputWidgets; protected List outputWidgets; protected List widgets; diff --git a/api/src/main/java/me/shedaniel/rei/api/client/util/SpriteRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/util/SpriteRenderer.java index ceaee76e6..5c9e3c92f 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/util/SpriteRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/util/SpriteRenderer.java @@ -197,6 +197,11 @@ public class SpriteRenderer { next(sprite.contents().name()); } + private static VertexConsumer normal(VertexConsumer consumer, Matrix3f var1, float var2, float var3, float var4) { + Vector3f var5 = var1.transform(new Vector3f(var2, var3, var4)); + return consumer.setNormal(var5.x(), var5.y(), var5.z()); + } + public void next(ResourceLocation texture) { if (this.consumer == null) { throw new RuntimeException("Invalid VertexConsumer!"); @@ -241,38 +246,29 @@ public class SpriteRenderer { this.consumer = consumers.getBuffer(layer); - normal(this.consumer.vertex(this.model, x, y + nSY, z1) - .color(this.r, this.g, this.b, this.a) - .uv(this.uStart, this.vEnd - dY) - .overlayCoords(this.u, this.v) - .uv2(this.l), this.normal, this.nX, this.nY, this.nZ) - .endVertex(); - normal(this.consumer.vertex(this.model, x + nSX, y + nSY, z1) - .color(this.r, this.g, this.b, this.a) - .uv(this.uEnd - dX, this.vEnd - dY) - .overlayCoords(this.u, this.v) - .uv2(this.l), this.normal, this.nX, this.nY, this.nZ) - .endVertex(); - normal(this.consumer.vertex(this.model, x + nSX, y, z1) - .color(this.r, this.g, this.b, this.a) - .uv(this.uEnd - dX, this.vStart) - .overlayCoords(this.u, this.v) - .uv2(this.l), this.normal, this.nX, this.nY, this.nZ) - .endVertex(); - normal(this.consumer.vertex(this.model, x, y, z1) - .color(this.r, this.g, this.b, this.a) - .uv(this.uStart, this.vStart) - .overlayCoords(this.u, this.v) - .uv2(this.l), this.normal, this.nX, this.nY, this.nZ) - .endVertex(); + normal(this.consumer.addVertex(this.model, x, y + nSY, z1) + .setColor(this.r, this.g, this.b, this.a) + .setUv(this.uStart, this.vEnd - dY) + .setUv2(this.u, this.v) + .setOverlay(this.l), this.normal, this.nX, this.nY, this.nZ); + normal(this.consumer.addVertex(this.model, x + nSX, y + nSY, z1) + .setColor(this.r, this.g, this.b, this.a) + .setUv(this.uEnd - dX, this.vEnd - dY) + .setUv2(this.u, this.v) + .setOverlay(this.l), this.normal, this.nX, this.nY, this.nZ); + normal(this.consumer.addVertex(this.model, x + nSX, y, z1) + .setColor(this.r, this.g, this.b, this.a) + .setUv(this.uEnd - dX, this.vStart) + .setUv2(this.u, this.v) + .setOverlay(this.l), this.normal, this.nX, this.nY, this.nZ); + normal(this.consumer.addVertex(this.model, x, y, z1) + .setColor(this.r, this.g, this.b, this.a) + .setUv(this.uStart, this.vStart) + .setUv2(this.u, this.v) + .setOverlay(this.l), this.normal, this.nX, this.nY, this.nZ); } } } - - private static VertexConsumer normal(VertexConsumer consumer, Matrix3f var1, float var2, float var3, float var4) { - Vector3f var5 = var1.transform(new Vector3f(var2, var3, var4)); - return consumer.normal(var5.x(), var5.y(), var5.z()); - } } } \ No newline at end of file diff --git a/api/src/main/java/me/shedaniel/rei/api/common/display/basic/BasicDisplay.java b/api/src/main/java/me/shedaniel/rei/api/common/display/basic/BasicDisplay.java index 4acd1c530..f9707be9a 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/display/basic/BasicDisplay.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/display/basic/BasicDisplay.java @@ -253,7 +253,7 @@ public abstract class BasicDisplay implements Display { List output = EntryIngredients.read(tag.getList("output", Tag.TAG_LIST)); ResourceLocation location; if (tag.contains("location", Tag.TAG_STRING)) { - location = new ResourceLocation(tag.getString("location")); + location = ResourceLocation.parse(tag.getString("location")); } else { location = null; } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java b/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java index 878e083ba..1eb1ac111 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java @@ -131,7 +131,7 @@ public interface EntryStack extends TextRepresentable, Renderer { * @see EntryIngredient#read(ListTag) */ static EntryStack read(CompoundTag tag) { - ResourceLocation type = new ResourceLocation(tag.getString("type")); + ResourceLocation type = ResourceLocation.parse(tag.getString("type")); EntryDefinition definition = EntryTypeRegistry.getInstance().get(type); if (definition == null) throw new NullPointerException("Read missing entry type: " + type); EntrySerializer serializer = definition.getSerializer(); diff --git a/api/src/main/java/me/shedaniel/rei/api/common/entry/type/BuiltinEntryTypes.java b/api/src/main/java/me/shedaniel/rei/api/common/entry/type/BuiltinEntryTypes.java index 7f9ed6bb4..cd885103e 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/entry/type/BuiltinEntryTypes.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/entry/type/BuiltinEntryTypes.java @@ -29,7 +29,7 @@ import org.jetbrains.annotations.ApiStatus; @ApiStatus.NonExtendable public interface BuiltinEntryTypes { - ResourceLocation EMPTY_ID = new ResourceLocation("empty"); + ResourceLocation EMPTY_ID = ResourceLocation.withDefaultNamespace("empty"); EntryType EMPTY = EntryType.deferred(EMPTY_ID); } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/entry/type/VanillaEntryTypes.java b/api/src/main/java/me/shedaniel/rei/api/common/entry/type/VanillaEntryTypes.java index 1a9b12f77..b7d58e8ee 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/entry/type/VanillaEntryTypes.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/entry/type/VanillaEntryTypes.java @@ -30,6 +30,6 @@ import org.jetbrains.annotations.ApiStatus; @ApiStatus.NonExtendable public interface VanillaEntryTypes { - EntryType ITEM = EntryType.deferred(new ResourceLocation("item")); - EntryType FLUID = EntryType.deferred(new ResourceLocation("fluid")); + EntryType ITEM = EntryType.deferred(ResourceLocation.withDefaultNamespace("item")); + EntryType FLUID = EntryType.deferred(ResourceLocation.withDefaultNamespace("fluid")); } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/registry/RecipeManagerContext.java b/api/src/main/java/me/shedaniel/rei/api/common/registry/RecipeManagerContext.java index 878db7b98..49c99f513 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/registry/RecipeManagerContext.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/registry/RecipeManagerContext.java @@ -57,7 +57,7 @@ public interface RecipeManagerContext

> extends Reloadable @Nullable default RecipeHolder byId(CompoundTag tag, String key) { if (tag.contains(key, Tag.TAG_STRING)) { - return getRecipeManager().byKey(new ResourceLocation(tag.getString(key))).orElse(null); + return getRecipeManager().byKey(ResourceLocation.parse(tag.getString(key))).orElse(null); } return null; } diff --git a/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/RecipeBookGridMenuInfo.java b/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/RecipeBookGridMenuInfo.java index bd000880d..ca5bb00e2 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/RecipeBookGridMenuInfo.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/RecipeBookGridMenuInfo.java @@ -31,7 +31,7 @@ import net.minecraft.world.inventory.RecipeBookMenu; import net.minecraft.world.item.ItemStack; @Deprecated(forRemoval = true) -public class RecipeBookGridMenuInfo, D extends SimpleGridMenuDisplay> implements SimpleGridMenuInfo { +public class RecipeBookGridMenuInfo, D extends SimpleGridMenuDisplay> implements SimpleGridMenuInfo { private final D display; public RecipeBookGridMenuInfo(D display) { -- cgit