Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed two rendering issues caused by mod interoperability #230

Open
wants to merge 2 commits into
base: 1.20
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class EntangledChestEntityRenderer(private val arg: BlockEntityRendererFactory.C
matrices.translate(-0.5, 0.0, -0.5)

val popup = if(
MinecraftClient.getInstance().crosshairTarget != null &&
MinecraftClient.getInstance().crosshairTarget!!.type == HitResult.Type.BLOCK &&
(MinecraftClient.getInstance().crosshairTarget!! as BlockHitResult).blockPos == entity.pos &&
MinecraftClient.getInstance().player!!.getStackInHand(Hand.MAIN_HAND).item is Rune
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class EntangledTankEntityRenderer(private val arg: BlockEntityRendererFactory.Co
bottomModel.render(matrices, chestConsumer, lightAbove, overlay)

val popup = if(
MinecraftClient.getInstance().crosshairTarget != null &&
MinecraftClient.getInstance().crosshairTarget!!.type == HitResult.Type.BLOCK &&
(MinecraftClient.getInstance().crosshairTarget!! as BlockHitResult).blockPos == entity.pos &&
MinecraftClient.getInstance().player!!.getStackInHand(Hand.MAIN_HAND).item is Rune
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel
import net.fabricmc.fabric.api.renderer.v1.model.WrapperBakedModel
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant
Expand Down Expand Up @@ -42,7 +43,10 @@ class TankBlockItemBakedModel: BakedModel, FabricBakedModel {
override fun emitItemQuads(stack: ItemStack, randSupplier: Supplier<Random>, context: RenderContext) {

val client = MinecraftClient.getInstance()
val tankBlockModel = client.bakedModelManager.getModel(ModelIdentifier(Identifier(MOD_ID, "tank"), "level=0"))
var tankBlockModel = client.bakedModelManager.getModel(ModelIdentifier(Identifier(MOD_ID, "tank"), "level=0"))

while(tankBlockModel is WrapperBakedModel)
tankBlockModel = WrapperBakedModel.unwrap(tankBlockModel)

(tankBlockModel as? TankCustomModel)?.emitBlockQuads(null, null, BlockPos.ORIGIN, randSupplier, context)

Expand Down