Skip to content

Commit

Permalink
现在任意方块都能在女仆头顶渲染了
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Sep 5, 2024
1 parent 9b27e8e commit d2bad4b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit d2bad4b

Please sign in to comment.