net.minecraft.util.EnumBlockRenderType Java Examples

The following examples show how to use net.minecraft.util.EnumBlockRenderType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityBlockRenderer.java    From OpenModsLib with MIT License 6 votes vote down vote up
@Override
public void doRender(EntityBlock entity, double x, double y, double z, float yaw, float partialTicks) {
	final IBlockState blockState = entity.getBlockState();

	if (blockState.getRenderType() != EnumBlockRenderType.INVISIBLE) {
		GlStateManager.pushMatrix();
		GlStateManager.translate(x - 0.5, y, z + 0.5);
		GlStateManager.disableLighting();

		bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

		Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(blockState, entity.getBrightness());

		GlStateManager.enableLighting();
		GlStateManager.popMatrix();
		super.doRender(entity, x, y, z, yaw, partialTicks);
	}
}
 
Example #2
Source File: FacadeHelper.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static boolean isValidFacade(ItemStack itemStack) {
    IBlockState rawBlockState = lookupBlockForItemUnsafe(itemStack);
    return rawBlockState != null &&
        !rawBlockState.getBlock().hasTileEntity(rawBlockState) &&
        !rawBlockState.getBlock().hasTileEntity() &&
        rawBlockState.getRenderType() == EnumBlockRenderType.MODEL &&
        rawBlockState.isFullCube();
}
 
Example #3
Source File: RenderFallTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityFallTofu entity, double x, double y, double z, float entityYaw, float partialTicks) {

    IBlockState iblockstate = BlockLoader.tofuTerrain.getDefaultState();

    if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL) {
        World world = entity.getWorldObj();

        if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) {
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            GlStateManager.pushMatrix();
            GlStateManager.disableLighting();
            Tessellator tessellator = Tessellator.getInstance();
            BufferBuilder bufferbuilder = tessellator.getBuffer();

            if (this.renderOutlines) {
                GlStateManager.enableColorMaterial();
                GlStateManager.enableOutlineMode(this.getTeamColor(entity));
            }

            bufferbuilder.begin(7, DefaultVertexFormats.BLOCK);
            BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, 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(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, bufferbuilder, false);
            tessellator.draw();

            if (this.renderOutlines) {
                GlStateManager.disableOutlineMode();
                GlStateManager.disableColorMaterial();
            }

            GlStateManager.enableLighting();
            GlStateManager.popMatrix();
            super.doRender(entity, x, y, z, entityYaw, partialTicks);
        }
    }

}
 
Example #4
Source File: RenderGlobalSchematic.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder bufferBuilderIn)
{
    try
    {
        EnumBlockRenderType renderType = state.getRenderType();

        if (renderType == EnumBlockRenderType.INVISIBLE)
        {
            return false;
        }
        else
        {
            switch (renderType)
            {
                case MODEL:
                    return this.blockModelRenderer.renderModel(blockAccess, this.getModelForState(state), state, pos, bufferBuilderIn);
                case ENTITYBLOCK_ANIMATED:
                    return false;
                case LIQUID:
                    return this.fluidRenderer.renderFluid(blockAccess, state, pos, bufferBuilderIn);
                default:
                    return false;
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
        CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
        throw new ReportedException(crashreport);
    }
}
 
Example #5
Source File: BlockScanner.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #6
Source File: BlockSpeedTelegraph.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example #7
Source File: BlockCharger.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #8
Source File: BlockSurgery.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #9
Source File: BlockBeacon.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #10
Source File: BlockSurgeryChamber.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #11
Source File: BlockComponentBox.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #12
Source File: BlockEngineeringTable.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #13
Source File: BlockPhysicsInfuserDummy.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example #14
Source File: BlockBeaconLarge.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #15
Source File: BlockBlueprintArchive.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return EnumBlockRenderType.MODEL;
}
 
Example #16
Source File: BlockBeaconPost.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return state.getValue(TRANSFORMED) > 0 ? EnumBlockRenderType.INVISIBLE : EnumBlockRenderType.MODEL;
}
 
Example #17
Source File: BlockToroSpawner.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example #18
Source File: BlockDummyTelegraph.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example #19
Source File: NumericalExtendedBlockState.java    From VanillaFix with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType() {
    return normalState.getBlock().getRenderType(this);
}
 
Example #20
Source File: BlockPhysicsInfuser.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example #21
Source File: BlockGenericPipe.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.MODEL;
}
 
Example #22
Source File: PipeChassisMkI.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.MODEL;
}
 
Example #23
Source File: PipeBlocking.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.MODEL;
}
 
Example #24
Source File: PipeBasic.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.MODEL;
}
 
Example #25
Source File: BlockInfestedLeaves.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
 
Example #26
Source File: BlockBase.java    From Signals with GNU General Public License v3.0 4 votes vote down vote up
/**
 * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
 */
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
    return EnumBlockRenderType.MODEL;
}
 
Example #27
Source File: BlockLightSource.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example #28
Source File: RenderFallingBlockEU.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void doRender(EntityFallingBlockEU entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    IBlockState state = entity.getBlockState();

    if (state != null && state.getRenderType() == EnumBlockRenderType.MODEL)
    {
        World world = entity.getEntityWorld();

        if (state != world.getBlockState(new BlockPos(entity)) && state.getRenderType() != EnumBlockRenderType.INVISIBLE)
        {
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            GlStateManager.pushMatrix();
            GlStateManager.disableLighting();
            Tessellator tessellator = Tessellator.getInstance();
            BufferBuilder buffer = tessellator.getBuffer();

            if (this.renderOutlines)
            {
                GlStateManager.enableColorMaterial();
                GlStateManager.enableOutlineMode(this.getTeamColor(entity));
            }

            buffer.begin(7, DefaultVertexFormats.BLOCK);
            BlockPos pos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
            GlStateManager.translate((float)(x - pos.getX() - 0.5D), (float)(y - pos.getY()), (float)(z - pos.getZ() - 0.5D));
            BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
            dispatcher.getBlockModelRenderer().renderModel(
                world, dispatcher.getModelForState(state), state, pos, buffer, 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);
        }
    }
}
 
Example #29
Source File: BlockBackpack.java    From WearableBackpacks with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.INVISIBLE; }
 
Example #30
Source File: BlockBetterChest.java    From BetterChests with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}