Search in sources :

Example 6 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project ImmersiveEngineering by BluSunrize.

the class ClientProxy method draw3DBlockCauldron.

@Override
public void draw3DBlockCauldron() {
    final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    IBlockState state = Blocks.CAULDRON.getDefaultState();
    IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();
    if (Minecraft.isAmbientOcclusionEnabled())
        GlStateManager.shadeModel(7425);
    else
        GlStateManager.shadeModel(7424);
    blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, .75f, false);
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 7 with BlockRendererDispatcher

use of net.minecraft.client.renderer.BlockRendererDispatcher in project ImmersiveEngineering by BluSunrize.

the class ClientProxy method drawSpecificFluidPipe.

@Override
public void drawSpecificFluidPipe(String configuration) {
    final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    IBlockState state = IEContent.blockMetalDevice1.getStateFromMeta(BlockTypes_MetalDevice1.FLUID_PIPE.getMeta());
    IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state);
    if (state instanceof IExtendedBlockState)
        state = ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, TileEntityFluidPipe.getStateFromKey(configuration));
    GlStateManager.pushMatrix();
    GlStateManager.translate(0, 0, 1);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();
    if (Minecraft.isAmbientOcclusionEnabled())
        GlStateManager.shadeModel(7425);
    else
        GlStateManager.shadeModel(7424);
    //		if(model instanceof ISmartBlockModel)
    //			model = ((ISmartBlockModel) model).handleBlockState(state);
    blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, .75f, false);
    GlStateManager.popMatrix();
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 8 with BlockRendererDispatcher

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

the class RenderBouncingBetty method doRender.

@Override
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;
    this.bindEntityTexture(entity);
    GlStateManager.translate(-0.5F, -0.5F, 0.5F);
    blockrendererdispatcher.renderBlockBrightness(mod_SecurityCraft.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(mod_SecurityCraft.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 9 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 10 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)

Aggregations

BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)10 IBlockState (net.minecraft.block.state.IBlockState)6 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)4 BlockPos (net.minecraft.util.math.BlockPos)4 Tessellator (net.minecraft.client.renderer.Tessellator)3 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)3 Block (net.minecraft.block.Block)2 TileEntity (net.minecraft.tileentity.TileEntity)2 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 ComparableItemStack (blusunrize.immersiveengineering.api.ComparableItemStack)1 IPlantHandler (blusunrize.immersiveengineering.api.tool.BelljarHandler.IPlantHandler)1 IOException (java.io.IOException)1 BlockChest (net.minecraft.block.BlockChest)1 BlockEnderChest (net.minecraft.block.BlockEnderChest)1 BlockSign (net.minecraft.block.BlockSign)1 BlockSkull (net.minecraft.block.BlockSkull)1 IProperty (net.minecraft.block.properties.IProperty)1 PropertyInteger (net.minecraft.block.properties.PropertyInteger)1 DestroyBlockProgress (net.minecraft.client.renderer.DestroyBlockProgress)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1