Search in sources :

Example 21 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project Galacticraft by micdoodle8.

the class LayerEvolvedEndermanHeldBlock method doRenderLayer.

@Override
public void doRenderLayer(EntityEvolvedEnderman entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    IBlockState iblockstate = entity.getHeldBlockState();
    if (iblockstate != null) {
        BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
        GlStateManager.enableRescaleNormal();
        GlStateManager.pushMatrix();
        GlStateManager.translate(0.0F, 0.6875F, -0.75F);
        GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(0.25F, 0.1875F, 0.25F);
        float f7 = 0.5F;
        GlStateManager.scale(-f7, -f7, f7);
        int i = entity.getBrightnessForRender();
        int j = i % 65536;
        int k = i / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        blockrendererdispatcher.renderBlockBrightness(iblockstate, 1.0F);
        GlStateManager.popMatrix();
        GlStateManager.disableRescaleNormal();
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 22 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EntityCannonBasicRender method renderBase.

private void renderBase(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) {
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
    BlockPos blockpos = new BlockPos(entity.posX, entity.posY, entity.posZ);
    // GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY()), (float)(z - (double)blockpos.getZ() - 0.5D));
    BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
    blockrendererdispatcher.getBlockModelRenderer().renderModel(entity.worldObj, blockrendererdispatcher.getModelForState(baseState), baseState, blockpos, vertexbuffer, false, 0);
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) BlockPos(net.minecraft.util.math.BlockPos) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 23 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class CallRunnerClient method onDrawBlockDamageTexture.

public static void onDrawBlockDamageTexture(RenderGlobal renderGlobal, Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks) {
    double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double) partialTicks;
    double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double) partialTicks;
    double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double) partialTicks;
    if (!renderGlobal.damagedBlocks.isEmpty()) {
        renderGlobal.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        renderGlobal.preRenderDamagedBlocks();
        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
        worldRendererIn.setTranslation(-d0, -d1, -d2);
        worldRendererIn.noColor();
        Iterator<DestroyBlockProgress> iterator = renderGlobal.damagedBlocks.values().iterator();
        while (iterator.hasNext()) {
            DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress) iterator.next();
            BlockPos blockpos = destroyblockprogress.getPosition();
            double d3 = (double) blockpos.getX() - d0;
            double d4 = (double) blockpos.getY() - d1;
            double d5 = (double) blockpos.getZ() - d2;
            Block block = renderGlobal.theWorld.getBlockState(blockpos).getBlock();
            TileEntity te = renderGlobal.theWorld.getTileEntity(blockpos);
            boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
            if (!hasBreak)
                hasBreak = te != null && te.canRenderBreaking();
            if (!hasBreak) {
                PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(renderGlobal.theWorld, blockpos);
                if (wrapper == null && (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)) {
                    iterator.remove();
                } else {
                    IBlockState iblockstate = renderGlobal.theWorld.getBlockState(blockpos);
                    if (wrapper != null) {
                        wrapper.wrapping.renderer.setupTranslation(partialTicks);
                        worldRendererIn.setTranslation(-wrapper.wrapping.renderer.offsetPos.getX(), -wrapper.wrapping.renderer.offsetPos.getY(), -wrapper.wrapping.renderer.offsetPos.getZ());
                    }
                    if (iblockstate.getMaterial() != Material.AIR) {
                        int i = destroyblockprogress.getPartialBlockDamage();
                        TextureAtlasSprite textureatlassprite = renderGlobal.destroyBlockIcons[i];
                        BlockRendererDispatcher blockrendererdispatcher = renderGlobal.mc.getBlockRendererDispatcher();
                        try {
                            blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, renderGlobal.theWorld);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    worldRendererIn.setTranslation(-d0, -d1, -d2);
                    // TODO: Reverse the Matrix Transforms here
                    if (wrapper != null) {
                        tessellatorIn.draw();
                        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
                        wrapper.wrapping.renderer.inverseTransform(partialTicks);
                    }
                }
            }
        }
        tessellatorIn.draw();
        worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
        renderGlobal.postRenderDamagedBlocks();
    }
}
Also used : BlockSkull(net.minecraft.block.BlockSkull) IBlockState(net.minecraft.block.state.IBlockState) BlockChest(net.minecraft.block.BlockChest) BlockEnderChest(net.minecraft.block.BlockEnderChest) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) IOException(java.io.IOException) TileEntity(net.minecraft.tileentity.TileEntity) DestroyBlockProgress(net.minecraft.client.renderer.DestroyBlockProgress) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) BlockSign(net.minecraft.block.BlockSign) Block(net.minecraft.block.Block) EnumSkyBlock(net.minecraft.world.EnumSkyBlock) BlockPos(net.minecraft.util.math.BlockPos) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 24 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project SecurityCraft by Geforce132.

the class RenderBouncingBetty method doRender.

public void doRender(EntityBouncingBetty entity, double x, double y, double z, float p_76986_8_, float partialTicks) {
    BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
    float f2;
    if (entity.fuse - partialTicks + 1.0F < 10.0F) {
        f2 = 1.0F - (entity.fuse - partialTicks + 1.0F) / 10.0F;
        f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F);
        f2 *= f2;
        f2 *= f2;
        float f3 = 1.0F + f2 * 0.3F;
        GlStateManager.scale(f3, f3, f3);
    }
    f2 = (1.0F - (entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
    bindEntityTexture(entity);
    GlStateManager.translate(-0.5F, -0.5F, 0.5F);
    blockrendererdispatcher.renderBlockBrightness(SCContent.bouncingBetty.getDefaultState(), entity.getBrightness(partialTicks));
    GlStateManager.translate(0.0F, 0.0F, 1.0F);
    if (entity.fuse / 5 % 2 == 0) {
        GlStateManager.disableTexture2D();
        GlStateManager.disableLighting();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(770, 772);
        GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
        GlStateManager.doPolygonOffset(-3.0F, -3.0F);
        GlStateManager.enablePolygonOffset();
        blockrendererdispatcher.renderBlockBrightness(SCContent.bouncingBetty.getDefaultState(), 1.0F);
        GlStateManager.doPolygonOffset(0.0F, 0.0F);
        GlStateManager.disablePolygonOffset();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableBlend();
        GlStateManager.enableLighting();
        GlStateManager.enableTexture2D();
    }
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
}
Also used : BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 25 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project MorePlanets by SteveKunG.

the class RenderFallingKoentusMeteor method doRender.

@Override
public void doRender(EntityFallingKoentusMeteor entity, double x, double y, double z, float entityYaw, float partialTicks) {
    IBlockState state = KoentusBlocks.FALLEN_KOENTUS_METEOR.getDefaultState();
    if (state.getRenderType() == EnumBlockRenderType.MODEL) {
        World world = entity.getWorldObj();
        if (state != world.getBlockState(new BlockPos(entity)) && state.getRenderType() != EnumBlockRenderType.INVISIBLE) {
            this.bindEntityTexture(entity);
            GlStateManager.pushMatrix();
            GlStateManager.disableLighting();
            Tessellator tessellator = Tessellator.getInstance();
            BufferBuilder vertexbuffer = tessellator.getBuffer();
            if (this.renderOutlines) {
                GlStateManager.enableColorMaterial();
                GlStateManager.enableOutlineMode(this.getTeamColor(entity));
            }
            vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
            BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
            GlStateManager.translate((float) (x - blockpos.getX() - 0.5D), (float) (y - blockpos.getY()), (float) (z - blockpos.getZ() - 0.5D));
            BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
            blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(state), state, blockpos, vertexbuffer, false, MathHelper.getPositionRandom(entity.getOrigin()));
            tessellator.draw();
            if (this.renderOutlines) {
                GlStateManager.disableOutlineMode();
                GlStateManager.disableColorMaterial();
            }
            GlStateManager.enableLighting();
            GlStateManager.popMatrix();
            super.doRender(entity, x, y, z, entityYaw, partialTicks);
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Aggregations

BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)44 IBlockState (net.minecraft.block.state.IBlockState)20 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)15 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)13 BlockPos (net.minecraft.util.math.BlockPos)13 Tessellator (net.minecraft.client.renderer.Tessellator)12 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 World (net.minecraft.world.World)5 Block (net.minecraft.block.Block)4 BlockModelShapes (net.minecraft.client.renderer.BlockModelShapes)4 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)3 IBakedModel (net.minecraft.client.renderer.model.IBakedModel)3 TileEntity (net.minecraft.tileentity.TileEntity)3 EnumFacing (net.minecraft.util.EnumFacing)3 IBlockAccess (net.minecraft.world.IBlockAccess)3 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)2 Nullable (javax.annotation.Nullable)2 BlockChest (net.minecraft.block.BlockChest)2 BlockEnderChest (net.minecraft.block.BlockEnderChest)2 BlockSign (net.minecraft.block.BlockSign)2