diff --git a/common/src/main/java/org/figuramc/figura/avatar/local/LocalAvatarLoader.java b/common/src/main/java/org/figuramc/figura/avatar/local/LocalAvatarLoader.java index 78625b8cc..4aba5527b 100644 --- a/common/src/main/java/org/figuramc/figura/avatar/local/LocalAvatarLoader.java +++ b/common/src/main/java/org/figuramc/figura/avatar/local/LocalAvatarLoader.java @@ -56,7 +56,8 @@ public class LocalAvatarLoader { String namespace = split[split.length - 2]; String path = split[split.length - 1]; - ResourceLocation id = new ResourceLocation(namespace, path.substring(0, path.length() - 5)); + // This is a 4 because .nbt has 4 characters + ResourceLocation id = new ResourceLocation(namespace, path.substring(0, path.length() - 4)); // nbt CompoundTag nbt; diff --git a/common/src/main/java/org/figuramc/figura/config/Configs.java b/common/src/main/java/org/figuramc/figura/config/Configs.java index 40ed09cfb..e9b9769a4 100644 --- a/common/src/main/java/org/figuramc/figura/config/Configs.java +++ b/common/src/main/java/org/figuramc/figura/config/Configs.java @@ -139,7 +139,8 @@ public void onChange() { }}; public static final ConfigType.BoolConfig ALLOW_FP_HANDS = new ConfigType.BoolConfig("allow_fp_hands", RENDERING, false), - FIRST_PERSON_MATRICES = new ConfigType.BoolConfig("first_person_matrices", RENDERING, true); + FIRST_PERSON_MATRICES = new ConfigType.BoolConfig("first_person_matrices", RENDERING, true), + INVENTORY_SCISSOR = new ConfigType.BoolConfig("inventory_scissor", RENDERING, true); // -- ACTION WHEEL -- // diff --git a/common/src/main/java/org/figuramc/figura/lua/api/RendererAPI.java b/common/src/main/java/org/figuramc/figura/lua/api/RendererAPI.java index 7d3cc5a2e..fbc7c85ea 100644 --- a/common/src/main/java/org/figuramc/figura/lua/api/RendererAPI.java +++ b/common/src/main/java/org/figuramc/figura/lua/api/RendererAPI.java @@ -429,7 +429,7 @@ public RendererAPI cameraNormal(FiguraMat3 matrix) { ) public RendererAPI setPostEffect(String effect) { this.postShader = effect == null ? null : LuaUtils.parsePath("shaders/post/" + effect + ".json"); - if (Minecraft.getInstance().getResourceManager().getResource(postShader).isEmpty()) + if (postShader != null && Minecraft.getInstance().getResourceManager().getResource(postShader).isEmpty()) throw new LuaError("The post shader %s does not exist or could not be found".formatted(postShader.toString())); return this; } diff --git a/common/src/main/java/org/figuramc/figura/mixin/gui/InventoryScreenMixin.java b/common/src/main/java/org/figuramc/figura/mixin/gui/InventoryScreenMixin.java index 5a217d93a..6545467ef 100644 --- a/common/src/main/java/org/figuramc/figura/mixin/gui/InventoryScreenMixin.java +++ b/common/src/main/java/org/figuramc/figura/mixin/gui/InventoryScreenMixin.java @@ -26,10 +26,13 @@ private static void renderEntityInInventoryFollowsMouse(GuiGraphics guiGraphics, float yaw = h - mouseY; Vector3f modelOffset = new Vector3f(0.0F, -(entity.getBbHeight() / 2.0F + yOffset), 0); - // Scissor is disabled here as enabling it would cut off nameplate rendering and taller models. - // guiGraphics.enableScissor(x, y, i, j); + if (Configs.INVENTORY_SCISSOR.value) { + guiGraphics.enableScissor(x, y, i, j); + } UIHelper.drawEntity(g, h, size, (float) Math.atan(yaw / 40f) * 20f, (float) -Math.atan(pitch / 40f) * 20f, entity, guiGraphics, modelOffset, EntityRenderMode.MINECRAFT_GUI); - // guiGraphics.disableScissor(); + if (Configs.INVENTORY_SCISSOR.value) { + guiGraphics.disableScissor(); + } ci.cancel(); } } diff --git a/common/src/main/java/org/figuramc/figura/mixin/gui/ScreenMixin.java b/common/src/main/java/org/figuramc/figura/mixin/gui/ScreenMixin.java index d4e5172b9..b05de0fbe 100644 --- a/common/src/main/java/org/figuramc/figura/mixin/gui/ScreenMixin.java +++ b/common/src/main/java/org/figuramc/figura/mixin/gui/ScreenMixin.java @@ -1,7 +1,9 @@ package org.figuramc.figura.mixin.gui; +import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.ClickEvent; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import org.figuramc.figura.FiguraMod; import org.figuramc.figura.avatar.Avatar; @@ -34,8 +36,12 @@ private void handleComponentClicked(Style style, CallbackInfoReturnable Avatar avatar = AvatarManager.getAvatarForPlayer(FiguraMod.getLocalPlayerUUID()); if (avatar == null) return; - - LuaValue value = avatar.loadScript("figura_function", event.getValue()); + LuaValue value = null; + try { + value = avatar.loadScript("figura_function", event.getValue()); + } catch (Exception e) { + FiguraMod.sendChatMessage(Component.literal(e.getMessage()).withStyle(Style.EMPTY.withColor(ChatFormatting.RED).withBold(true))); + } if (value != null) avatar.run(value, avatar.tick); } diff --git a/common/src/main/resources/assets/figura/lang/en_us.json b/common/src/main/resources/assets/figura/lang/en_us.json index 9d40b937d..e4b27a47b 100644 --- a/common/src/main/resources/assets/figura/lang/en_us.json +++ b/common/src/main/resources/assets/figura/lang/en_us.json @@ -393,6 +393,9 @@ "figura.config.render_debug_parts_pivot.1.tooltip": "Do not render pivots", "figura.config.render_debug_parts_pivot.2.tooltip": "Render pivots of only the Host Avatar", "figura.config.render_debug_parts_pivot.3.tooltip": "Render pivots of all Avatars", + + "figura.config.inventory_scissor": "Render Inventory with Scissors", + "figura.config.inventory_scissor.tooltip": "Enabling this stops the player from rendering outside of the inventory entity view box.", "figura.config.first_person_matrices": "First Person Matrices", "figura.config.first_person_matrices.tooltip": "Toggles if the model part matrices should be updated while in first person", "figura.config.action_wheel": "Action Wheel", diff --git a/forge/build.gradle b/forge/build.gradle index 6033d3564..059f6d237 100755 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -128,6 +128,10 @@ void setupRepositories(RepositoryHandler repositories) { } } +configurations.configureEach { + resolutionStrategy.force("net.sf.jopt-simple:jopt-simple:5.0.4") +} + // From the Forge MDK's buildscript, this is temporary until arch loom does it for us // Merge the resources and classes into the same directory. // This is done because java expects modules to be in a single directory. diff --git a/gradle.properties b/gradle.properties index c2925e3bb..e0779caa6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ mappings = 2 enabled_platforms = fabric,forge,neoforge # Mod Properties -mod_version = 0.1.5-rc.1 +mod_version = 0.1.5-rc.2 maven_group = org.figuramc archives_base_name = figura assets_version = v2