Search in sources :

Example 1 with EntityRenderDispatcher

use of net.minecraft.client.render.entity.EntityRenderDispatcher in project meteor-client by MeteorDevelopment.

the class EntityTooltipComponent method renderEntity.

protected void renderEntity(MatrixStack matrices, int x, int y) {
    if (mc.player == null)
        return;
    float size = 24;
    if (Math.max(entity.getWidth(), entity.getHeight()) > 1.0) {
        size /= Math.max(entity.getWidth(), entity.getHeight());
    }
    DiffuseLighting.disableGuiDepthLighting();
    matrices.push();
    int yOffset = 16;
    if (entity instanceof SquidEntity) {
        size = 16;
        yOffset = 2;
    }
    matrices.translate(x + 10, y + yOffset, 1050);
    matrices.scale(1f, 1f, -1);
    matrices.translate(0, 0, 1000);
    matrices.scale(size, size, size);
    Quaternion quaternion = Vec3f.POSITIVE_Z.getDegreesQuaternion(180.f);
    Quaternion quaternion2 = Vec3f.POSITIVE_X.getDegreesQuaternion(-10.f);
    quaternion.hamiltonProduct(quaternion2);
    matrices.multiply(quaternion);
    setupAngles();
    EntityRenderDispatcher entityRenderDispatcher = mc.getEntityRenderDispatcher();
    quaternion2.conjugate();
    entityRenderDispatcher.setRotation(quaternion2);
    entityRenderDispatcher.setRenderShadows(false);
    VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
    entity.age = mc.player.age;
    entity.setCustomNameVisible(false);
    entityRenderDispatcher.render(entity, 0, 0, 0, 0.f, 1.f, matrices, immediate, 15728880);
    immediate.draw();
    entityRenderDispatcher.setRenderShadows(true);
    matrices.pop();
    DiffuseLighting.enableGuiDepthLighting();
}
Also used : SquidEntity(net.minecraft.entity.passive.SquidEntity) Quaternion(net.minecraft.util.math.Quaternion) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider)

Example 2 with EntityRenderDispatcher

use of net.minecraft.client.render.entity.EntityRenderDispatcher in project ImmersivePortalsMod by qouteall.

the class MyGameRenderer method renderPlayerItself.

private void renderPlayerItself(Vec3d playerPos, Vec3d playerLastTickPos, float patialTicks) {
    EntityRenderDispatcher entityRenderDispatcher = ((IEWorldRenderer) mc.worldRenderer).getEntityRenderDispatcher();
    PlayerListEntry playerListEntry = CHelper.getClientPlayerListEntry();
    GameMode originalGameMode = MyRenderHelper.originalGameMode;
    Entity player = mc.cameraEntity;
    assert player != null;
    Vec3d oldPos = player.getPos();
    Vec3d oldLastTickPos = McHelper.lastTickPosOf(player);
    GameMode oldGameMode = playerListEntry.getGameMode();
    Helper.setPosAndLastTickPos(player, playerPos, playerLastTickPos);
    ((IEPlayerListEntry) playerListEntry).setGameMode(originalGameMode);
    entityRenderDispatcher.render(player, patialTicks, false);
    Helper.setPosAndLastTickPos(player, oldPos, oldLastTickPos);
    ((IEPlayerListEntry) playerListEntry).setGameMode(oldGameMode);
}
Also used : GameMode(net.minecraft.world.GameMode) Entity(net.minecraft.entity.Entity) IEWorldRenderer(com.qouteall.immersive_portals.ducks.IEWorldRenderer) IEPlayerListEntry(com.qouteall.immersive_portals.ducks.IEPlayerListEntry) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) IEPlayerListEntry(com.qouteall.immersive_portals.ducks.IEPlayerListEntry) Vec3d(net.minecraft.util.math.Vec3d) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) BlockEntityRenderDispatcher(net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher)

Example 3 with EntityRenderDispatcher

use of net.minecraft.client.render.entity.EntityRenderDispatcher in project isometric-renders by gliscowo.

the class IsometricRenderScreen method drawContent.

@Override
protected void drawContent(MatrixStack matrices) {
    float scale = renderScale * height / 515f;
    RenderSystem.pushMatrix();
    RenderSystem.translatef(115, (float) Math.round(renderHeight * 1f + (height - 515f) / 10f), 1500);
    RenderSystem.scalef(1, 1, -1);
    MatrixStack matrixStack = new MatrixStack();
    matrixStack.translate(0, 0, 1000);
    matrixStack.scale(scale, scale, 1);
    Quaternion flip = Vector3f.POSITIVE_Z.getDegreesQuaternion(180);
    flip.hamiltonProduct(Vector3f.POSITIVE_X.getDegreesQuaternion(-angle));
    Quaternion rotation = Vector3f.POSITIVE_Y.getDegreesQuaternion(RuntimeConfig.rotation);
    matrixStack.multiply(flip);
    matrixStack.multiply(rotation);
    EntityRenderDispatcher entityRenderDispatcher = MinecraftClient.getInstance().getEntityRenderDispatcher();
    entityRenderDispatcher.setRenderShadows(false);
    VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
    renderCallback.render(matrixStack, immediate, playAnimations ? ((MinecraftClientAccessor) client).getRenderTickCounter().tickDelta : 0);
    immediate.draw();
    entityRenderDispatcher.setRenderShadows(true);
    RenderSystem.popMatrix();
}
Also used : Quaternion(net.minecraft.util.math.Quaternion) MatrixStack(net.minecraft.client.util.math.MatrixStack) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider)

Example 4 with EntityRenderDispatcher

use of net.minecraft.client.render.entity.EntityRenderDispatcher in project Client by MatHax.

the class EntityTooltipComponent method renderEntity.

protected void renderEntity(MatrixStack matrices, int x, int y) {
    if (mc.player == null)
        return;
    float size = 24;
    if (Math.max(entity.getWidth(), entity.getHeight()) > 1.0)
        size /= Math.max(entity.getWidth(), entity.getHeight());
    DiffuseLighting.disableGuiDepthLighting();
    matrices.push();
    int yOffset = 16;
    if (entity instanceof SquidEntity) {
        size = 16;
        yOffset = 2;
    }
    matrices.translate(x + 10, y + yOffset, 1050);
    matrices.scale(1f, 1f, -1);
    matrices.translate(0, 0, 1000);
    matrices.scale(size, size, size);
    Quaternion quaternion = Vec3f.POSITIVE_Z.getDegreesQuaternion(180.f);
    Quaternion quaternion2 = Vec3f.POSITIVE_X.getDegreesQuaternion(-10.f);
    quaternion.hamiltonProduct(quaternion2);
    matrices.multiply(quaternion);
    setupAngles();
    EntityRenderDispatcher entityRenderDispatcher = mc.getEntityRenderDispatcher();
    quaternion2.conjugate();
    entityRenderDispatcher.setRotation(quaternion2);
    entityRenderDispatcher.setRenderShadows(false);
    VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
    entity.age = mc.player.age;
    entity.setCustomNameVisible(false);
    entityRenderDispatcher.render(entity, 0, 0, 0, 0.f, 1.f, matrices, immediate, 15728880);
    immediate.draw();
    entityRenderDispatcher.setRenderShadows(true);
    matrices.pop();
    DiffuseLighting.enableGuiDepthLighting();
}
Also used : SquidEntity(net.minecraft.entity.passive.SquidEntity) Quaternion(net.minecraft.util.math.Quaternion) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider)

Example 5 with EntityRenderDispatcher

use of net.minecraft.client.render.entity.EntityRenderDispatcher in project LittleMaidReBirth-Fabric by SistrScarlet.

the class IFFType method render.

@Environment(EnvType.CLIENT)
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
    TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
    textRenderer.drawWithShadow(matrices, new TranslatableText(entityType.getTranslationKey()), (float) x + 60, (float) y - textRenderer.fontHeight, 0xFFFFFFFF);
    if (renderClashed || !(entity instanceof LivingEntity))
        return;
    try {
        InventoryScreen.drawEntity(x, y, 15, mouseX, mouseY, (LivingEntity) entity);
    } catch (Exception e) {
        LOGGER.warn("描画処理がクラッシュしました。" + entityType + ":" + entity);
        e.printStackTrace();
        renderClashed = true;
        // 行われない終了処理を行う
        // ちょっと強引
        VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
        immediate.draw();
        EntityRenderDispatcher entityRenderDispatcher = MinecraftClient.getInstance().getEntityRenderDispatcher();
        entityRenderDispatcher.setRenderShadows(true);
        RenderSystem.popMatrix();
    }
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) LivingEntity(net.minecraft.entity.LivingEntity) TextRenderer(net.minecraft.client.font.TextRenderer) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) Environment(net.fabricmc.api.Environment)

Aggregations

EntityRenderDispatcher (net.minecraft.client.render.entity.EntityRenderDispatcher)6 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)4 Quaternion (net.minecraft.util.math.Quaternion)4 SquidEntity (net.minecraft.entity.passive.SquidEntity)2 IEPlayerListEntry (com.qouteall.immersive_portals.ducks.IEPlayerListEntry)1 IEWorldRenderer (com.qouteall.immersive_portals.ducks.IEWorldRenderer)1 Environment (net.fabricmc.api.Environment)1 TextRenderer (net.minecraft.client.font.TextRenderer)1 ClientPlayerEntity (net.minecraft.client.network.ClientPlayerEntity)1 PlayerListEntry (net.minecraft.client.network.PlayerListEntry)1 BlockEntityRenderDispatcher (net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 Entity (net.minecraft.entity.Entity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 TranslatableText (net.minecraft.text.TranslatableText)1 Vec3d (net.minecraft.util.math.Vec3d)1 GameMode (net.minecraft.world.GameMode)1