diff --git a/gradle.properties b/gradle.properties index e6f7700..ad82103 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ satin_version=1.8.0 sodium_version=mc1.19-0.4.2 iris_version=1.19.x-v1.2.5 -mod_version = 6.0.3 +mod_version = 6.0.4 maven_group = net.ludocrypt archives_base_name = limlib \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/BackgroundRendererMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/BackgroundRendererMixin.java index de2af56..dc8df84 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/BackgroundRendererMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/BackgroundRendererMixin.java @@ -13,7 +13,7 @@ public abstract class BackgroundRendererMixin { @ModifyVariable(method = "render", at = @At(value = "STORE", ordinal = 4), ordinal = 2) - private static float corners$modifySkyColor(float in) { + private static float limlib$modifySkyColor(float in) { MinecraftClient client = MinecraftClient.getInstance(); LiminalEffects effects = ((DimensionTypeAccess) (Object) client.world.getDimension()).getLiminalEffects(); diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java index 4c3ef0d..37fd16a 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java @@ -136,11 +136,19 @@ public void renderHands(Framebuffer framebuffer, float tickDelta, MatrixStack ma client.getFramebuffer().beginWrite(true); } + framebuffer.clear(MinecraftClient.IS_SYSTEM_MAC); + framebuffer.beginWrite(true); + LimlibRendering.LIMINAL_QUAD_RENDERER.forEach((renderer) -> { renderer.heldItemRenderQueue.forEach(Runnable::run); renderer.heldItemRenderQueue.clear(); }); + framebuffer.endWrite(); + client.getFramebuffer().beginWrite(true); + + framebuffer.draw(framebuffer.textureWidth, framebuffer.textureHeight); + RenderSystem.setProjectionMatrix(projectionMatrix); } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java index b361899..168c84d 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java @@ -1,8 +1,11 @@ package net.ludocrypt.limlib.mixin.client.render.model; +import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; +import java.util.Set; import java.util.function.Function; import org.apache.commons.compress.utils.Lists; @@ -10,8 +13,10 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import com.google.common.collect.Maps; import com.mojang.datafixers.util.Pair; @@ -22,9 +27,11 @@ import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.render.model.ModelLoader; +import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.render.model.json.JsonUnbakedModel; import net.minecraft.client.render.model.json.ModelElement; import net.minecraft.client.render.model.json.ModelElementFace; +import net.minecraft.client.texture.MissingSprite; import net.minecraft.client.texture.Sprite; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; @@ -36,9 +43,27 @@ public abstract class JsonUnbakedModelMixin implements UnbakedModelAccess { @Unique private Map> subElements = Maps.newHashMap(); + @Shadow + public String id; + @Shadow protected JsonUnbakedModel parent; + @Inject(method = "Lnet/minecraft/client/render/model/json/JsonUnbakedModel;getTextureDependencies(Ljava/util/function/Function;Ljava/util/Set;)Ljava/util/Collection;", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", ordinal = 0, shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) + private void limlib$getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences, CallbackInfoReturnable> ci, Set set, JsonUnbakedModel jsonUnbakedModel, Set set2) { + this.getSubElements().forEach((subElementId, subElement) -> { + subElement.forEach((modelElement) -> { + modelElement.faces.values().forEach((modelElementFace) -> { + SpriteIdentifier spriteIdentifier = this.resolveSprite(modelElementFace.textureId); + if (Objects.equals(spriteIdentifier.getTextureId(), MissingSprite.getMissingSpriteId())) { + unresolvedTextureReferences.add(Pair.of(modelElementFace.textureId, this.id)); + } + set2.add(spriteIdentifier); + }); + }); + }); + } + @Inject(method = "Lnet/minecraft/client/render/model/json/JsonUnbakedModel;bake(Lnet/minecraft/client/render/model/ModelLoader;Lnet/minecraft/client/render/model/json/JsonUnbakedModel;Ljava/util/function/Function;Lnet/minecraft/client/render/model/ModelBakeSettings;Lnet/minecraft/util/Identifier;Z)Lnet/minecraft/client/render/model/BakedModel;", at = @At("RETURN"), cancellable = true) private void limlib$bake(ModelLoader loader, JsonUnbakedModel parent, Function textureGetter, ModelBakeSettings settings, Identifier id, boolean hasDepth, CallbackInfoReturnable ci) { Map>>> subQuads = Maps.newHashMap(); @@ -66,6 +91,9 @@ public abstract class JsonUnbakedModelMixin implements UnbakedModelAccess { @Shadow private native static BakedQuad createQuad(ModelElement element, ModelElementFace elementFace, Sprite sprite, Direction side, ModelBakeSettings settings, Identifier id); + @Shadow + public abstract SpriteIdentifier resolveSprite(String spriteName); + @Override public Map> getSubElements() { Map> conjoinedElements = Maps.newHashMap(); diff --git a/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/DimensionTypeRegistrarMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/DimensionTypeRegistrarMixin.java index bb59879..80d1fae 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/DimensionTypeRegistrarMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/DimensionTypeRegistrarMixin.java @@ -16,7 +16,7 @@ public class DimensionTypeRegistrarMixin { @Inject(method = "Lnet/minecraft/world/dimension/DimensionTypeRegistrar;initAndGetDefault(Lnet/minecraft/util/registry/Registry;)Lnet/minecraft/util/registry/RegistryEntry;", at = @At("RETURN")) - private static void limlib$InitAndGetDefault(Registry registry, CallbackInfoReturnable> ci) { + private static void limlib$initAndGetDefault(Registry registry, CallbackInfoReturnable> ci) { LimlibRegistries.LIMINAL_WORLD.forEach((world) -> BuiltinRegistries.add(registry, world.getDimensionTypeKey(), world.getDimensionType())); } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/WorldPresetsRegistrarMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/WorldPresetsRegistrarMixin.java index f564dab..e05f5db 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/WorldPresetsRegistrarMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/common/world/registry/WorldPresetsRegistrarMixin.java @@ -18,7 +18,7 @@ public class WorldPresetsRegistrarMixin { @Inject(method = "Lnet/minecraft/world/gen/WorldPresets$Registrar;createPreset(Lnet/minecraft/world/dimension/DimensionOptions;)Lnet/minecraft/world/gen/WorldPreset;", at = @At("RETURN")) - private void limlib$CreatePreset(DimensionOptions dimensionOptions, CallbackInfoReturnable ci) { + private void limlib$createPreset(DimensionOptions dimensionOptions, CallbackInfoReturnable ci) { Map, DimensionOptions> map = Maps.newHashMap(); map.putAll(((WorldPresetAccessor) ci.getReturnValue()).getDimensions()); LimlibRegistries.LIMINAL_WORLD.forEach((world) -> map.put(world.getDimensionKey(), world.getDimensionOptions()));