Skip to content

Commit 478c7f7

Browse files
committed
1.21.4
1 parent c41c5a1 commit 478c7f7

File tree

11 files changed

+78
-66
lines changed

11 files changed

+78
-66
lines changed

gradle.properties

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22
org.gradle.jvmargs=-Xmx2G
33
# Fabric Properties
44
# check these on https://fabricmc.net/develop
5-
minecraft_base_version=1.21.2
6-
minecraft_version=1.21.2
7-
yarn_mappings=1.21.2+build.1
8-
loader_version=0.16.7
5+
minecraft_base_version=1.21.4
6+
minecraft_version=1.21.4
7+
yarn_mappings=1.21.4+build.1
8+
loader_version=0.16.9
99
# Mod Properties
1010
mod_version=0.12.18
1111
maven_group=io.wispforest
1212
archives_base_name=owo-lib
1313
# Dependencies
14-
fabric_version=0.106.1+1.21.2
14+
fabric_version=0.111.0+1.21.4
1515

1616
# https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-fabric/
17-
rei_version=15.0.728
17+
rei_version=17.0.792
1818

1919
# https://maven.terraformersmc.com/releases/dev/emi/emi-fabric/
20-
emi_version=1.1.6+1.20.6
20+
emi_version=1.1.18+1.21.1
2121

2222
# https://search.maven.org/artifact/blue.endless/jankson
2323
jankson_version=1.2.2
2424

2525
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
26-
modmenu_version=12.0.0-beta.1
26+
modmenu_version=13.0.0-beta.1
2727

2828
# https://maven.nucleoid.xyz/xyz/nucleoid/server-translations-api/
29-
stapi_version=2.3.1+1.21-pre2
29+
stapi_version=2.4.0+1.21.2-rc1

owo-ui.xsd

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
4+
elementFormDefault="qualified"
5+
vc:minVersion="1.1">
36

47
<xs:element name="owo-ui">
58
<xs:complexType>

src/main/java/io/wispforest/owo/mixin/recipe_remainders/JsonDataLoaderMixin.java

+4-18
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,24 @@
1111
import io.wispforest.owo.util.RecipeRemainderStorage;
1212
import net.minecraft.item.Item;
1313
import net.minecraft.item.ItemStack;
14-
import net.minecraft.recipe.Recipe;
15-
import net.minecraft.recipe.RecipeEntry;
16-
import net.minecraft.recipe.RecipeType;
17-
import net.minecraft.recipe.input.RecipeInput;
18-
import net.minecraft.registry.RegistryKeys;
1914
import net.minecraft.resource.JsonDataLoader;
20-
import net.minecraft.resource.ResourceManager;
15+
import net.minecraft.resource.ResourceFinder;
2116
import net.minecraft.util.Identifier;
2217
import net.minecraft.util.JsonHelper;
23-
import net.minecraft.util.collection.DefaultedList;
24-
import net.minecraft.util.profiler.Profiler;
25-
import net.minecraft.world.World;
2618
import org.spongepowered.asm.mixin.Mixin;
2719
import org.spongepowered.asm.mixin.injection.At;
28-
import org.spongepowered.asm.mixin.injection.Inject;
29-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
31-
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
3220

3321
import java.io.Reader;
3422
import java.util.HashMap;
35-
import java.util.Map;
36-
import java.util.Optional;
3723

3824
@Mixin(JsonDataLoader.class)
3925
public abstract class JsonDataLoaderMixin {
4026

41-
@WrapOperation(method = "load", at = @At(value = "INVOKE", target = "Lcom/google/gson/JsonParser;parseReader(Ljava/io/Reader;)Lcom/google/gson/JsonElement;"))
42-
private static JsonElement deserializeRecipeSpecificRemainders(Reader jsonReader, Operation<JsonElement> original, @Local(argsOnly = true) String dataType, @Local(ordinal = 1) Identifier recipeId) {
27+
@WrapOperation(method = "load(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/resource/ResourceFinder;Lcom/mojang/serialization/DynamicOps;Lcom/mojang/serialization/Codec;Ljava/util/Map;)V", at = @At(value = "INVOKE", target = "Lcom/google/gson/JsonParser;parseReader(Ljava/io/Reader;)Lcom/google/gson/JsonElement;"))
28+
private static JsonElement deserializeRecipeSpecificRemainders(Reader jsonReader, Operation<JsonElement> original, @Local(argsOnly = true) ResourceFinder finder, @Local(ordinal = 1) Identifier recipeId) {
4329
var element = original.call(jsonReader);
4430

45-
if (dataType.equals(RegistryKeys.getPath(RegistryKeys.RECIPE)) && element instanceof JsonObject json) {
31+
if (ServerRecipeManagerAccessor.owo$getFinder() == finder && element instanceof JsonObject json) {
4632
if (json.has("owo:remainders")) {
4733
var remainders = new HashMap<Item, ItemStack>();
4834

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.wispforest.owo.mixin.recipe_remainders;
2+
3+
import net.minecraft.recipe.ServerRecipeManager;
4+
import net.minecraft.resource.ResourceFinder;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.gen.Accessor;
7+
8+
@Mixin(ServerRecipeManager.class)
9+
public interface ServerRecipeManagerAccessor {
10+
11+
@Accessor("FINDER")
12+
static ResourceFinder owo$getFinder() {
13+
throw new UnsupportedOperationException();
14+
}
15+
}

src/main/java/io/wispforest/owo/ui/component/BlockComponent.java

+15-18
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,24 @@ public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partial
4747

4848
context.getMatrices().translate(-.5, -.5, -.5);
4949

50-
// TODO: [1.21.2-Porting] Figure out if this is still needed or not
51-
//RenderSystem.runAsFancy(() -> {
52-
final var vertexConsumers = client.getBufferBuilders().getEntityVertexConsumers();
53-
if (this.state.getRenderType() != BlockRenderType.ENTITYBLOCK_ANIMATED) {
54-
this.client.getBlockRenderManager().renderBlockAsEntity(
55-
this.state, context.getMatrices(), vertexConsumers,
56-
LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV
57-
);
58-
}
50+
final var vertexConsumers = client.getBufferBuilders().getEntityVertexConsumers();
51+
if (this.state.getRenderType() != BlockRenderType.INVISIBLE) {
52+
this.client.getBlockRenderManager().renderBlockAsEntity(
53+
this.state, context.getMatrices(), vertexConsumers,
54+
LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV
55+
);
56+
}
5957

60-
if (this.entity != null) {
61-
var медведь = this.client.getBlockEntityRenderDispatcher().get(this.entity);
62-
if (медведь != null) {
63-
медведь.render(entity, partialTicks, context.getMatrices(), vertexConsumers, LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV);
64-
}
58+
if (this.entity != null) {
59+
var медведь = this.client.getBlockEntityRenderDispatcher().get(this.entity);
60+
if (медведь != null) {
61+
медведь.render(entity, partialTicks, context.getMatrices(), vertexConsumers, LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV);
6562
}
63+
}
6664

67-
RenderSystem.setShaderLights(new Vector3f(-1.5f, -.5f, 0), new Vector3f(0, -1, 0));
68-
vertexConsumers.draw();
69-
DiffuseLighting.enableGuiDepthLighting();
70-
//});
65+
RenderSystem.setShaderLights(new Vector3f(-1.5f, -.5f, 0), new Vector3f(0, -1, 0));
66+
vertexConsumers.draw();
67+
DiffuseLighting.enableGuiDepthLighting();
7168

7269
context.getMatrices().pop();
7370
}

src/main/java/io/wispforest/owo/ui/component/EntityComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ profile, new WorldSession(TelemetrySender.NOOP, false, Duration.ZERO, ""),
267267

268268
this.skinTextures = DefaultSkinHelper.getSkinTextures(completeProfile);
269269
this.client.getSkinProvider().fetchSkinTextures(completeProfile).thenAccept(textures -> {
270-
this.skinTextures = textures;
270+
textures.ifPresent($ -> this.skinTextures = $);
271271
});
272272
});
273273
}

src/main/java/io/wispforest/owo/ui/component/ItemComponent.java

+13-17
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@
1212
import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback;
1313
import net.minecraft.client.MinecraftClient;
1414
import net.minecraft.client.gui.tooltip.TooltipComponent;
15+
import net.minecraft.client.item.ItemModelManager;
1516
import net.minecraft.client.render.DiffuseLighting;
1617
import net.minecraft.client.render.LightmapTextureManager;
1718
import net.minecraft.client.render.OverlayTexture;
18-
import net.minecraft.client.render.VertexConsumerProvider;
19-
import net.minecraft.client.render.item.ItemRenderer;
20-
import net.minecraft.item.ModelTransformationMode;
19+
import net.minecraft.client.render.item.ItemRenderState;
2120
import net.minecraft.command.argument.ItemStringReader;
2221
import net.minecraft.entity.player.PlayerEntity;
2322
import net.minecraft.item.Item;
2423
import net.minecraft.item.ItemStack;
24+
import net.minecraft.item.ModelTransformationMode;
2525
import net.minecraft.item.tooltip.TooltipType;
2626
import net.minecraft.registry.Registries;
2727
import net.minecraft.registry.RegistryWrapper;
2828
import net.minecraft.text.Text;
2929
import org.jetbrains.annotations.Nullable;
30-
import org.joml.Matrix4f;
3130
import org.w3c.dom.Element;
3231

3332
import java.util.ArrayList;
@@ -38,17 +37,15 @@
3837

3938
public class ItemComponent extends BaseComponent {
4039

41-
protected static final Matrix4f ITEM_SCALING = new Matrix4f().scaling(16, -16, 16);
40+
protected static final ItemRenderState ITEM_RENDER_STATE = new ItemRenderState();
4241

43-
protected final VertexConsumerProvider.Immediate entityBuffers;
44-
protected final ItemRenderer itemRenderer;
42+
protected final ItemModelManager itemModelManager;
4543
protected ItemStack stack;
4644
protected boolean showOverlay = false;
4745
protected boolean setTooltipFromStack = false;
4846

4947
protected ItemComponent(ItemStack stack) {
50-
this.entityBuffers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
51-
this.itemRenderer = MinecraftClient.getInstance().getItemRenderer();
48+
this.itemModelManager = MinecraftClient.getInstance().getItemModelManager();
5249
this.stack = stack;
5350
}
5451

@@ -64,8 +61,11 @@ protected int determineVerticalContentSize(Sizing sizing) {
6461

6562
@Override
6663
public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partialTicks, float delta) {
67-
final boolean notSideLit = !this.itemRenderer.getModel(this.stack, null, null, 0).isSideLit();
64+
this.itemModelManager.update(ITEM_RENDER_STATE, this.stack, ModelTransformationMode.GUI, false, null, null, 0);
65+
66+
final boolean notSideLit = !ITEM_RENDER_STATE.isSideLit();
6867
if (notSideLit) {
68+
context.draw();
6969
DiffuseLighting.disableGuiDepthLighting();
7070
}
7171

@@ -80,16 +80,12 @@ public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partial
8080
matrices.translate(8.0, 8.0, 0.0);
8181

8282
// Vanilla scaling and y inversion
83-
if (notSideLit) {
84-
matrices.scale(16, -16, 16);
85-
} else {
86-
matrices.multiplyPositionMatrix(ITEM_SCALING);
87-
}
83+
matrices.scale(16, -16, 16);
8884

8985
var client = MinecraftClient.getInstance();
9086

91-
this.itemRenderer.renderItem(this.stack, ModelTransformationMode.GUI, LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV, matrices, entityBuffers, client.world, 0);
92-
this.entityBuffers.draw();
87+
ITEM_RENDER_STATE.render(matrices, context.vertexConsumers(), LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV);
88+
context.draw();
9389

9490
// Clean up
9591
matrices.pop();

src/main/java/io/wispforest/owo/ui/component/TextAreaComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void inflate(Size space) {
117117
int cursor = this.editBox.getCursor();
118118
int selection = ((EditBoxAccessor) this.editBox).owo$getSelectionEnd();
119119

120-
((EditBoxAccessor) this.editBox).owo$setWidth(this.width() - this.getPaddingDoubled() - 9);
120+
((EditBoxAccessor) this.editBox).owo$setWidth(this.width() - this.getPadding() - 9);
121121
this.editBox.setText(this.getText());
122122

123123
super.inflate(space);

src/main/java/io/wispforest/owo/ui/util/NinePatchTexture.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
1212
import net.minecraft.client.render.RenderLayer;
1313
import net.minecraft.resource.JsonDataLoader;
14+
import net.minecraft.resource.ResourceFinder;
1415
import net.minecraft.resource.ResourceManager;
1516
import net.minecraft.util.Identifier;
1617
import net.minecraft.util.profiler.Profiler;
@@ -258,7 +259,7 @@ public static class MetadataLoader extends JsonDataLoader<NinePatchTexture> impl
258259
private static final Map<Identifier, NinePatchTexture> LOADED_TEXTURES = new HashMap<>();
259260

260261
public MetadataLoader() {
261-
super(CodecUtils.toCodec(NinePatchTexture.ENDEC), "nine_patch_textures");
262+
super(CodecUtils.toCodec(NinePatchTexture.ENDEC), ResourceFinder.json("nine_patch_textures"));
262263
}
263264

264265
@Override

src/main/resources/owo.mixins.json

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"offline.WorldSaveHandlerMixin",
3737
"recipe_remainders.CraftingResultSlotMixin",
3838
"recipe_remainders.JsonDataLoaderMixin",
39+
"recipe_remainders.ServerRecipeManagerAccessor",
3940
"registry.ReferenceAccessor",
4041
"registry.SimpleRegistryMixin",
4142
"text.LanguageMixin",

src/testmod/java/io/wispforest/uwu/rei/UiCategory.java

+13
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@
1414
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
1515
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
1616
import me.shedaniel.rei.api.common.display.Display;
17+
import me.shedaniel.rei.api.common.display.DisplaySerializer;
1718
import me.shedaniel.rei.api.common.entry.EntryIngredient;
1819
import me.shedaniel.rei.api.common.util.EntryIngredients;
1920
import me.shedaniel.rei.api.common.util.EntryStacks;
2021
import net.minecraft.item.Items;
2122
import net.minecraft.text.Text;
2223
import net.minecraft.util.Identifier;
24+
import org.jetbrains.annotations.Nullable;
2325

2426
import java.util.Collections;
2527
import java.util.List;
28+
import java.util.Optional;
2629

2730
public class UiCategory implements DisplayCategory<Display> {
2831

@@ -92,5 +95,15 @@ public List<EntryIngredient> getOutputEntries() {
9295
public CategoryIdentifier<?> getCategoryIdentifier() {
9396
return ID;
9497
}
98+
99+
@Override
100+
public Optional<Identifier> getDisplayLocation() {
101+
return Optional.empty();
102+
}
103+
104+
@Override
105+
public @Nullable DisplaySerializer<? extends Display> getSerializer() {
106+
return null;
107+
}
95108
}
96109
}

0 commit comments

Comments
 (0)