From d2bad4bf830845d32c86bf5f198c0d2325548826 Mon Sep 17 00:00:00 2001 From: tartaric_acid Date: Thu, 5 Sep 2024 23:13:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E4=BB=BB=E6=84=8F=E6=96=B9?= =?UTF-8?q?=E5=9D=97=E9=83=BD=E8=83=BD=E5=9C=A8=E5=A5=B3=E4=BB=86=E5=A4=B4?= =?UTF-8?q?=E9=A1=B6=E6=B8=B2=E6=9F=93=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../geckolayer/GeckoLayerMaidBipedHead.java | 24 +++++++++++-------- .../entity/layer/LayerMaidBipedHead.java | 24 +++++++++++-------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/geckolayer/GeckoLayerMaidBipedHead.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/geckolayer/GeckoLayerMaidBipedHead.java index c41d82d40..68082c2f0 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/geckolayer/GeckoLayerMaidBipedHead.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/geckolayer/GeckoLayerMaidBipedHead.java @@ -79,17 +79,21 @@ public void render(PoseStack poseStack, MultiBufferSource bufferIn, int packedLi // 渲染女仆背部的 ItemStack stack = maid.getBackpackShowItem(); - if (stack.getItem() instanceof BlockItem) { - Block block = ((BlockItem) stack.getItem()).getBlock(); - if (block instanceof IPlantable && !(block instanceof DoublePlantBlock)) { - BlockState plant = ((IPlantable) block).getPlant(entity.level, entity.blockPosition()); - poseStack.pushPose(); - RenderUtils.prepMatrixForLocator(poseStack, geoModel.headBones()); - poseStack.scale(-0.8F, 0.8F, -0.8F); - poseStack.translate(-0.5, 0.625, -0.5); - Minecraft.getInstance().getBlockRenderer().renderSingleBlock(plant, poseStack, bufferIn, packedLightIn, OverlayTexture.NO_OVERLAY); - poseStack.popPose(); + // 不做限制,任意方块都可以显示 + if (stack.getItem() instanceof BlockItem blockItem) { + Block block = blockItem.getBlock(); + BlockState blockState; + if (block instanceof IPlantable iPlantable && !(block instanceof DoublePlantBlock)) { + blockState = iPlantable.getPlant(entity.level, entity.blockPosition()); + } else { + blockState = block.defaultBlockState(); } + poseStack.pushPose(); + RenderUtils.prepMatrixForLocator(poseStack, geoModel.headBones()); + poseStack.scale(-0.8F, 0.8F, -0.8F); + poseStack.translate(-0.5, 0.625, -0.5); + Minecraft.getInstance().getBlockRenderer().renderSingleBlock(blockState, poseStack, bufferIn, packedLightIn, OverlayTexture.NO_OVERLAY, ModelData.EMPTY, null); + poseStack.popPose(); } else { SimpleHatsCompat.renderGeckoHat(poseStack, bufferIn, packedLightIn, entity, stack, geoModel.headBones()); } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/layer/LayerMaidBipedHead.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/layer/LayerMaidBipedHead.java index c4e70253f..f2f45dcac 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/layer/LayerMaidBipedHead.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/layer/LayerMaidBipedHead.java @@ -76,17 +76,21 @@ public void render(PoseStack poseStack, MultiBufferSource bufferIn, int packedLi // 渲染女仆背部的 ItemStack stack = maid.getBackpackShowItem(); - if (stack.getItem() instanceof BlockItem) { - Block block = ((BlockItem) stack.getItem()).getBlock(); - if (block instanceof IPlantable && !(block instanceof DoublePlantBlock)) { - BlockState plant = ((IPlantable) block).getPlant(mob.level, mob.blockPosition()); - poseStack.pushPose(); - this.getParentModel().getHead().translateAndRotate(poseStack); - poseStack.scale(0.8F, -0.8F, -0.8F); - poseStack.translate(-0.5, 0.625, -0.5); - Minecraft.getInstance().getBlockRenderer().renderSingleBlock(plant, poseStack, bufferIn, packedLightIn, OverlayTexture.NO_OVERLAY, ModelData.EMPTY, null); - poseStack.popPose(); + // 不做限制,任意方块都可以显示 + if (stack.getItem() instanceof BlockItem blockItem) { + Block block = blockItem.getBlock(); + BlockState blockState; + if (block instanceof IPlantable iPlantable && !(block instanceof DoublePlantBlock)) { + blockState = iPlantable.getPlant(mob.level, mob.blockPosition()); + } else { + blockState = block.defaultBlockState(); } + poseStack.pushPose(); + this.getParentModel().getHead().translateAndRotate(poseStack); + poseStack.scale(0.8F, -0.8F, -0.8F); + poseStack.translate(-0.5, 0.625, -0.5); + Minecraft.getInstance().getBlockRenderer().renderSingleBlock(blockState, poseStack, bufferIn, packedLightIn, OverlayTexture.NO_OVERLAY, ModelData.EMPTY, null); + poseStack.popPose(); } else { SimpleHatsCompat.renderHat(poseStack, bufferIn, packedLightIn, mob, stack, this.getParentModel()); }