net.minecraft.client.renderer.RenderGlobal Java Examples

The following examples show how to use net.minecraft.client.renderer.RenderGlobal. 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: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void markSchematicChunkForRenderUpdate(BlockPos pos)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks();
        Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks();
        long key = ChunkPos.asLong(pos.getX() >> 4, pos.getZ() >> 4);

        if (schematicChunks.containsKey(key) && clientChunks.containsKey(key))
        {
            RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer();
            rg.markBlockRangeForRenderUpdate(pos.getX() - 1, pos.getY() - 1, pos.getZ() - 1,pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
        }
    }
}
 
Example #2
Source File: BuildersWandRenderer.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderBlockOutlines(Mode mode, EntityPlayer player, BlockPosEU posStart, BlockPosEU posEnd, float partialTicks)
{
    GlStateManager.glLineWidth(2.0f);
    float expand = mode == Mode.REPLACE ? 0.001f : 0f;

    for (int i = 0; i < this.positions.size(); i++)
    {
        BlockPosEU pos = this.positions.get(i);

        if (pos.equals(posStart) == false && pos.equals(posEnd) == false)
        {
            AxisAlignedBB aabb = createAABB(pos.getX(), pos.getY(), pos.getZ(), expand, partialTicks, player);
            RenderGlobal.drawSelectionBoundingBox(aabb, 1.0f, 1.0f, 1.0f, 1.0f);
        }
    }
}
 
Example #3
Source File: RulerRenderer.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderPositions(EntityPlayer clientPlayer, BlockPosEU posStart, BlockPosEU posEnd, int color, float partialTicks)
{
    GlStateManager.glLineWidth(2.0f);

    for (int a = 0; a < 3; a++)
    {
        List<BlockPosEU> column = this.positions.get(a);

        if (column != null)
        {
            final int size = column.size();

            for (int i = 0; i < size; i++)
            {
                BlockPosEU pos = column.get(i);
                //if (pos.equals(posStart) == false && (posEnd == null || posEnd.equals(pos) == false))
                {
                    AxisAlignedBB aabb = BuildersWandRenderer.createAABB(pos.getX(), pos.getY(), pos.getZ(), 0, partialTicks, clientPlayer);
                    RenderGlobal.drawSelectionBoundingBox(aabb, ((color >>> 16) & 0xFF) / 255f, ((color >>> 8) & 0xFF) / 255f, (color & 0xFF) / 255f, 1.0f);
                }
            }
        }
    }
}
 
Example #4
Source File: RenderChunkSchematicVbo.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public RenderChunkSchematicVbo(World worldIn, RenderGlobal renderGlobalIn, int indexIn)
{
    super(worldIn, renderGlobalIn, indexIn);

    this.renderGlobal = (RenderGlobalSchematic) renderGlobalIn;
    this.chunkRenderDataLock = new ReentrantLock();
    this.schematicChunkRenderData = CompiledChunkSchematic.EMPTY;

    if (OpenGlHelper.useVbo())
    {
        for (int i = 0; i < OverlayRenderType.values().length; ++i)
        {
            this.vertexBufferOverlay[i] = new VertexBuffer(DefaultVertexFormats.POSITION_COLOR);
        }
    }
}
 
Example #5
Source File: DebugScreenMessages.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void update(Minecraft mc)
{
    if (mc.gameSettings.showDebugInfo)
    {
        WorldSchematic world = SchematicWorldHandler.getSchematicWorld();

        if (world != null)
        {
            RenderGlobal render = LitematicaRenderer.getInstance().getWorldRenderer();

            String pre = GuiBase.TXT_GOLD;
            String rst = GuiBase.TXT_RST;

            MESSAGE_RENDERER.setMessage(String.format("%s[Litematica]%s %s", pre, rst, render.getDebugInfoRenders()));

            String str = String.format("E %s TE: %d", world.getDebugLoadedEntities(), world.loadedTileEntityList.size());
            MESSAGE_ENTITIES.setMessage(String.format("%s[Litematica]%s %s %s", pre, rst, render.getDebugInfoEntities(), str));
        }
    }
}
 
Example #6
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void markSchematicChunksForRenderUpdate(ChunkPos chunkPos)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks();
        Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks();
        long key = ChunkPos.asLong(chunkPos.x, chunkPos.z);

        if (schematicChunks.containsKey(key) && clientChunks.containsKey(key))
        {
            RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer();
            rg.markBlockRangeForRenderUpdate((chunkPos.x << 4) - 1,   0, (chunkPos.z << 4) - 1,
                                             (chunkPos.x << 4) + 1, 255, (chunkPos.z << 4) + 1);
        }
    }
}
 
Example #7
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void markSchematicChunkForRenderUpdate(SubChunkPos chunkPos)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks();
        Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks();
        long key = ChunkPos.asLong(chunkPos.getX(), chunkPos.getZ());

        if (schematicChunks.containsKey(key) && clientChunks.containsKey(key))
        {
            RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer();
            rg.markBlockRangeForRenderUpdate((chunkPos.getX() << 4) - 1, (chunkPos.getY() << 4) - 1, (chunkPos.getZ() << 4) - 1,
                                             (chunkPos.getX() << 4) + 1, (chunkPos.getY() << 4) + 1, (chunkPos.getZ() << 4) + 1);
        }
    }
}
 
Example #8
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void updateBetweenY(int minY, int maxY)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer();
        Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks();
        Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks();

        for (Chunk chunk : schematicChunks.values())
        {
            // Only mark chunks that are actually rendered (if the schematic world contains more chunks)
            if (chunk.isEmpty() == false && clientChunks.containsKey(ChunkPos.asLong(chunk.x, chunk.z)))
            {
                rg.markBlockRangeForRenderUpdate((chunk.x << 4) - 1, minY, (chunk.z << 4) - 1, (chunk.x << 4) + 16, maxY, (chunk.z << 4) + 16);
            }
        }
    }
}
 
Example #9
Source File: ItemESP.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
private void renderDebugBoundingBox(Entity p_85094_1_, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_) {
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    float f2 = p_85094_1_.width / 2.0F;
    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(p_85094_2_ - f2, p_85094_4_, p_85094_6_ - f2, p_85094_2_ + f2, p_85094_4_ + p_85094_1_.height, p_85094_6_ + f2);
    GL11.glLineWidth(1f);
    RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}
 
Example #10
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void updateBetweenZ(int minZ, int maxZ)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        final int zMin = Math.min(minZ, maxZ);
        final int zMax = Math.max(minZ, maxZ);
        final int czMin = (zMin >> 4);
        final int czMax = (zMax >> 4);
        RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer();
        Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks();
        Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks();

        for (Chunk chunk : schematicChunks.values())
        {
            // Only mark chunks that are actually rendered (if the schematic world contains more chunks)
            if (chunk.z >= czMin && chunk.z <= czMax && chunk.isEmpty() == false &&
                clientChunks.containsKey(ChunkPos.asLong(chunk.x, chunk.z)))
            {
                minZ = Math.max( chunk.z << 4      , zMin);
                maxZ = Math.min((chunk.z << 4) + 15, zMax);
                rg.markBlockRangeForRenderUpdate((chunk.x << 4), 0, minZ, (chunk.x << 4) + 15, 255, maxZ);
            }
        }
    }
}
 
Example #11
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void updateBetweenX(int minX, int maxX)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        final int xMin = Math.min(minX, maxX);
        final int xMax = Math.max(minX, maxX);
        final int cxMin = (xMin >> 4);
        final int cxMax = (xMax >> 4);
        RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer();
        Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks();
        Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks();

        for (Chunk chunk : schematicChunks.values())
        {
            // Only mark chunks that are actually rendered (if the schematic world contains more chunks)
            if (chunk.x >= cxMin && chunk.x <= cxMax && chunk.isEmpty() == false &&
                clientChunks.containsKey(ChunkPos.asLong(chunk.x, chunk.z)))
            {
                minX = Math.max( chunk.x << 4      , xMin);
                maxX = Math.min((chunk.x << 4) + 15, xMax);
                rg.markBlockRangeForRenderUpdate(minX, 0, (chunk.z << 4), maxX, 255, (chunk.z << 4) + 15);
            }
        }
    }
}
 
Example #12
Source File: RenderUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void renderBlockOutline(BlockPos pos, float expand, float lineWidth,
        Color4f color, Entity renderViewEntity, float partialTicks)
{
    GlStateManager.glLineWidth(lineWidth);

    AxisAlignedBB aabb = createAABB(pos.getX(), pos.getY(), pos.getZ(), expand, partialTicks, renderViewEntity);
    RenderGlobal.drawSelectionBoundingBox(aabb, color.r, color.g, color.b, color.a);
}
 
Example #13
Source File: RenderChunkSchematicList.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public RenderChunkSchematicList(World worldIn, RenderGlobal renderGlobalIn, int index)
{
    super(worldIn, renderGlobalIn, index);

    this.baseDisplayList = GLAllocation.generateDisplayLists(LIST_SIZE);
    this.baseOverlay = this.baseDisplayList + BLOCK_LAYERS;
}
 
Example #14
Source File: MixinEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Redirect(
    method = "Lnet/minecraft/client/renderer/EntityRenderer;orientCamera(F)V",
    at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/client/renderer/RenderGlobal;hasCloudFog(DDDF)Z"
    ))
private boolean fixHasCloudFogCoordinates(RenderGlobal renderGlobal, double x, double y,
    double z, float partialTicks) {
    return renderGlobal
        .hasCloudFog(x + this.eyeVector.X, y + this.eyeVector.Y, z + this.eyeVector.Z,
            partialTicks);
}
 
Example #15
Source File: WorldView.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
public WorldView(WorldClient worldObj, ChunkCoordinates coords, int width, int height) {
	this.width = width;
	this.height = height;
	this.worldObj = worldObj;
	this.coords = coords;
	this.camera = new EntityCamera(worldObj, coords);
	this.camerawrapper = new ViewCameraImpl(camera);
	this.renderGlobal = new RenderGlobal(Minecraft.getMinecraft());
	this.effectRenderer = new EffectRenderer(worldObj, Minecraft.getMinecraft().getTextureManager());
	// Technically speaking, this is poor practice as it leaks a reference to the view before it's done constructing.
	this.fbo = FrameBufferContainer.createNewFramebuffer(this, width, height);
}
 
Example #16
Source File: WrenchOverlayRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void onDrawBlockHighlight(DrawBlockHighlightEvent event) {
    EntityPlayer player = event.getPlayer();
    World world = player.world;
    RayTraceResult target = event.getTarget();

    if (target.typeOfHit != RayTraceResult.Type.BLOCK) {
        return; //magically, draw block highlight is called not only for blocks (see forge issues)
    }

    BlockPos pos = target.getBlockPos();
    IBlockState blockState = world.getBlockState(pos);
    TileEntity tileEntity = world.getTileEntity(pos);
    ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);

    if (tileEntity != null && shouldDrawOverlayForItem(heldItem, tileEntity) && useGridForRayTraceResult(target)) {
        EnumFacing facing = target.sideHit;
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        GlStateManager.glLineWidth(2.0F);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);

        if (world.getWorldBorder().contains(pos)) {
            double d3 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) event.getPartialTicks();
            double d4 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.getPartialTicks();
            double d5 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) event.getPartialTicks();
            AxisAlignedBB box = blockState.getSelectedBoundingBox(world, pos).grow(0.002D).offset(-d3, -d4, -d5);
            RenderGlobal.drawSelectionBoundingBox(box, 0.0F, 0.0F, 0.0F, 0.4F);
            drawOverlayLines(facing, box);
        }

        GlStateManager.depthMask(true);
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();

        event.setCanceled(true);
    }
}
 
Example #17
Source File: StenciledTextureRenderer.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void render(RenderGlobal context, float partialTickTime) {
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();

	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();

	GL11.glOrtho(-1, +1, -1, +1, -1, +1);

	GL11.glEnable(GL11.GL_STENCIL_TEST);
	GL11.glStencilMask(stencilMask);
	GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP);
	GL11.glStencilFunc(GL11.GL_EQUAL, stencilMask, stencilMask);

	TextureUtils.bindTextureToClient(texture);

	RenderUtils.disableLightmap();
	GlStateManager.disableLighting();

	GlStateManager.color(1, 1, 1);

	GL11.glBegin(GL11.GL_QUADS);
	GL11.glTexCoord2f(0, 0);
	GL11.glVertex3f(-1, -1, 0);

	GL11.glTexCoord2f(1, 0);
	GL11.glVertex3f(+1, -1, 0);

	GL11.glTexCoord2f(1, 1);
	GL11.glVertex3f(+1, +1, 0);

	GL11.glTexCoord2f(0, 1);
	GL11.glVertex3f(-1, +1, 0);

	GL11.glEnd();

	// mask should prevent this command from clearing other bits
	GL11.glClearStencil(0);
	GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);

	GL11.glDisable(GL11.GL_STENCIL_TEST);

	RenderUtils.enableLightmap();
	GlStateManager.enableLighting();

	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glPopMatrix();

	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glPopMatrix();

}
 
Example #18
Source File: ClientProxy.java    From NBTEdit with GNU General Public License v3.0 4 votes vote down vote up
private void drawBoundingBox(RenderGlobal r, float f, AxisAlignedBB aabb) {
	if (aabb == null)
		return;

	EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;

	double var8 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)f;
	double var10 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)f;
	double var12 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)f;

	aabb = aabb.getOffsetBoundingBox(-var8, -var10, -var12);

	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glColor4f(1.0F, 0.0F, 0.0F, .5F);
	GL11.glLineWidth(3.5F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDepthMask(false);

	Tessellator var2 = Tessellator.instance;

	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.draw();
	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.draw();
	var2.startDrawing(1);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.draw();

	GL11.glDepthMask(true);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);

}
 
Example #19
Source File: StencilRendererHandler.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void render(RenderGlobal context, float partialTickTime) {}
 
Example #20
Source File: RenderUtils.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void renderEntityDebugBoundingBox(Entity entityIn, float partialTicks, boolean renderLook, boolean renderEyeHeight)
{
    Entity renderViewEntity = Minecraft.getMinecraft().getRenderViewEntity();
    double x = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double y = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double z = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
    x -= renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * (double)partialTicks;
    y -= renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * (double)partialTicks;
    z -= renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * (double)partialTicks;

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    GlStateManager.glLineWidth(1.0F);

    double entityRadius = entityIn.width / 2.0D;
    AxisAlignedBB bb = entityIn.getEntityBoundingBox();

    RenderGlobal.drawBoundingBox(bb.minX - entityIn.posX + x,
                                 bb.minY - entityIn.posY + y,
                                 bb.minZ - entityIn.posZ + z,
                                 bb.maxX - entityIn.posX + x,
                                 bb.maxY - entityIn.posY + y,
                                 bb.maxZ - entityIn.posZ + z,
                                 1.0F, 1.0F, 1.0F, 1.0F);

    if (renderEyeHeight && entityIn instanceof EntityLivingBase)
    {
        RenderGlobal.drawBoundingBox(x - entityRadius,
                                     y + entityIn.getEyeHeight() - 0.01D,
                                     z - entityRadius,
                                     x + entityRadius,
                                     y + entityIn.getEyeHeight() + 0.01D,
                                     z + entityRadius, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    if (renderLook)
    {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder vertexbuffer = tessellator.getBuffer();
        Vec3d look = entityIn.getLook(partialTicks);
        vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
        vertexbuffer.pos(x, y + entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
        vertexbuffer.pos(x + look.x * 2.0D, y + entityIn.getEyeHeight() + look.y * 2.0D, z + look.z * 2.0D).color(0, 0, 255, 255).endVertex();
        tessellator.draw();
    }

    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
Example #21
Source File: HolesModule.java    From seppuku with GNU General Public License v3.0 4 votes vote down vote up
@Listener
public void onRender(EventRender3D event) {
    final Minecraft mc = Minecraft.getMinecraft();

    for (Hole hole : this.holes) {
        final AxisAlignedBB bb = new AxisAlignedBB(
                hole.getX() - mc.getRenderManager().viewerPosX,
                hole.getY() - mc.getRenderManager().viewerPosY,
                hole.getZ() - mc.getRenderManager().viewerPosZ,
                hole.getX() + 1 - mc.getRenderManager().viewerPosX,
                hole.getY() + (hole.isTall() ? 2 : 1) - mc.getRenderManager().viewerPosY,
                hole.getZ() + 1 - mc.getRenderManager().viewerPosZ);

        camera.setPosition(mc.getRenderViewEntity().posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ);

        if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(bb.minX + mc.getRenderManager().viewerPosX,
                bb.minY + mc.getRenderManager().viewerPosY,
                bb.minZ + mc.getRenderManager().viewerPosZ,
                bb.maxX + mc.getRenderManager().viewerPosX,
                bb.maxY + mc.getRenderManager().viewerPosY,
                bb.maxZ + mc.getRenderManager().viewerPosZ))) {
            GlStateManager.pushMatrix();
            GlStateManager.enableBlend();
            GlStateManager.disableDepth();
            GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
            GlStateManager.disableTexture2D();
            GlStateManager.depthMask(false);
            glEnable(GL_LINE_SMOOTH);
            glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
            glLineWidth(1.5f);

            final double dist = mc.player.getDistance(hole.getX() + 0.5f, hole.getY() + 0.5f, hole.getZ() + 0.5f) * 0.75f;

            float alpha = MathUtil.clamp((float) (dist * 255.0f / (this.radius.getValue()) / 255.0f), 0.0f, 0.3f);

            RenderGlobal.renderFilledBox(bb, 0, 1, 0, this.fade.getValue() ? alpha : 0.25f);
            RenderGlobal.drawBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, 0, 1, 0, this.fade.getValue() ? alpha : 0.25f);
            glDisable(GL_LINE_SMOOTH);
            GlStateManager.depthMask(true);
            GlStateManager.enableDepth();
            GlStateManager.enableTexture2D();
            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
        }
    }
}
 
Example #22
Source File: BuildersWandRenderer.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void renderStackedArea(Area3D area, EntityPlayer player, BlockPosEU posStart, BlockPosEU posEnd, float partialTicks)
{
    if (posStart == null || posEnd == null)
    {
        return;
    }

    int xp = area.getXPos();
    int yp = area.getYPos();
    int zp = area.getZPos();
    int xn = area.getXNeg();
    int yn = area.getYNeg();
    int zn = area.getZNeg();
    int sx = Math.abs(posEnd.getX() - posStart.getX()) + 1;
    int sy = Math.abs(posEnd.getY() - posStart.getY()) + 1;
    int sz = Math.abs(posEnd.getZ() - posStart.getZ()) + 1;
    AxisAlignedBB originalBox = createEnclosingAABB(posStart, posEnd, player, partialTicks);

    GlStateManager.glLineWidth(2.0f);

    // Non-empty area on at least one axis
    if ((xp + xn + yp + yn + zp + zn) != 0)
    {
        for (int y = -yn; y <= yp; y++)
        {
            for (int x = -xn; x <= xp; x++)
            {
                for (int z = -zn; z <= zp; z++)
                {
                    AxisAlignedBB aabb = originalBox.offset(x * sx, y * sy, z * sz);

                    if (x != 0 || y != 0 || z != 0)
                    {
                        RenderGlobal.drawSelectionBoundingBox(aabb, 1f, 1f, 1f, 0xCC / 255f);
                    }
                    else
                    {
                        RenderGlobal.drawSelectionBoundingBox(aabb, 0.5f, 1f, 0.5f, 0xCC / 255f);
                    }
                }
            }
        }
    }
}
 
Example #23
Source File: WorldView.java    From LookingGlass with GNU General Public License v3.0 4 votes vote down vote up
public RenderGlobal getRenderGlobal() {
	return this.renderGlobal;
}
 
Example #24
Source File: RenderChunkFactoryList.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public RenderChunk create(World worldIn, RenderGlobal renderGlobalIn, int index)
{
    return new RenderChunkSchematicList(worldIn, renderGlobalIn, index);
}
 
Example #25
Source File: RenderChunkFactoryVbo.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public RenderChunk create(World worldIn, RenderGlobal renderGlobalIn, int index)
{
    return new RenderChunkSchematicVbo(worldIn, renderGlobalIn, index);
}
 
Example #26
Source File: RenderWorldEvent.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public RenderGlobal getContext() {
    return context;
}
 
Example #27
Source File: RenderWorldEvent.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public RenderWorldEvent(RenderGlobal context, float partialTicks) {
    this.context = context;
    this.partialTicks = partialTicks;
}
 
Example #28
Source File: StencilRendererHandler.java    From OpenModsLib with MIT License votes vote down vote up
public abstract void render(RenderGlobal context, float partialTickTime);