net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher Java Examples

The following examples show how to use net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher. 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: PlayerEspHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
private void renderLines(double partialTicks)
{
	Vec3d start = RotationUtils.getClientLookVec()
		.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
		.addVector(TileEntityRendererDispatcher.staticPlayerX,
			TileEntityRendererDispatcher.staticPlayerY,
			TileEntityRendererDispatcher.staticPlayerZ);
	
	GL11.glBegin(GL11.GL_LINES);
	for(EntityPlayer e : players)
	{
		Vec3d end = e.getEntityBoundingBox().getCenter()
			.subtract(new Vec3d(e.posX, e.posY, e.posZ)
				.subtract(e.prevPosX, e.prevPosY, e.prevPosZ)
				.scale(1 - partialTicks));
		
		float f = WEntity.getDistance(WMinecraft.getPlayer(), e) / 20F;
		GL11.glColor4f(2 - f, f, 0, 0.5F);
		
		GL11.glVertex3d(WVec3d.getX(start), WVec3d.getY(start),
			WVec3d.getZ(start));
		GL11.glVertex3d(WVec3d.getX(end), WVec3d.getY(end),
			WVec3d.getZ(end));
	}
	GL11.glEnd();
}
 
Example #2
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 6 votes vote down vote up
public void render(Matrix4 mat, IRenderTypeBuffer getter, double yToCamera) {
    Vec3d projectedView = TileEntityRendererDispatcher.instance.renderInfo.getProjectedView();
    mat = mat.copy();//Defensive copy, prevent external modifications.
    randy.setSeed(31100L);
    for (int i = 0; i < 16; i++) {
        RenderType.State state = RENDER_STATES.get(i);
        EndPortalRenderType renderType = new EndPortalRenderType(i, yToCamera, projectedView, mat, state);
        IVertexBuilder builder = getter.getBuffer(renderType);
        float r = (randy.nextFloat() * 0.5F + 0.1F) * renderType.f7;
        float g = (randy.nextFloat() * 0.5F + 0.4F) * renderType.f7;
        float b = (randy.nextFloat() * 0.5F + 0.5F) * renderType.f7;
        if (i == 0) {
            r = g = b = 1.0F * renderType.f7;
        }
        builder.pos(surfaceX1, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX1, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX2, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX2, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex();
    }
}
 
Example #3
Source File: PhasedBlockRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static BufferBuilder beginRender() {
	GlStateManager.enableAlpha();
	GlStateManager.enableBlend();
	GlStateManager.disableTexture2D();
	GlStateManager.enableCull();
	GlStateManager.cullFace(GlStateManager.CullFace.BACK);
	GlStateManager.depthMask(false);
	GlStateManager.enablePolygonOffset();
	GlStateManager.doPolygonOffset(-0.1f, -1000f);
	GlStateManager.enableColorMaterial();

	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.shadeModel(GL11.GL_SMOOTH);

	GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
	GL14.glBlendEquation(GL14.GL_FUNC_SUBTRACT);

	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
	buffer.setTranslation(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ);

	return buffer;
}
 
Example #4
Source File: CapeHandler.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Post event) {
	EntityPlayer player = event.getEntityPlayer();
	float delta = event.getPartialRenderTick();
	if (ClientConfigValues.renderCape && !player.isInvisible() && !VanishTracker.isVanished(player) && !player.isElytraFlying() && !player.isPlayerSleeping() && delta != 1) {
		RenderCape cape = getCape(player);
		if (cape.isPresent(player)) {
			cape.render(
					player,
					player.posX - cape.posX - TileEntityRendererDispatcher.staticPlayerX,
					player.posY - cape.posY - TileEntityRendererDispatcher.staticPlayerY,
					player.posZ - cape.posZ - TileEntityRendererDispatcher.staticPlayerZ,
					delta
			);
		}
	}
}
 
Example #5
Source File: RenderChunkSchematicVbo.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void addTileEntity(BlockPos pos, CompiledChunk compiledChunk, Set<TileEntity> tileEntities)
{
    TileEntity te = this.schematicWorldView.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);

    if (te != null)
    {
        TileEntitySpecialRenderer<TileEntity> tesr = TileEntityRendererDispatcher.instance.<TileEntity>getRenderer(te);

        if (tesr != null)
        {
            compiledChunk.addTileEntity(te);

            if (tesr.isGlobalRenderer(te))
            {
                tileEntities.add(te);
            }
        }
    }
}
 
Example #6
Source File: MobEspHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
private void renderTracers(double partialTicks)
{
	Vec3d start = RotationUtils.getClientLookVec()
		.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
		.addVector(TileEntityRendererDispatcher.staticPlayerX,
			TileEntityRendererDispatcher.staticPlayerY,
			TileEntityRendererDispatcher.staticPlayerZ);
	
	GL11.glBegin(GL11.GL_LINES);
	for(EntityLiving e : mobs)
	{
		Vec3d end = e.getEntityBoundingBox().getCenter()
			.subtract(new Vec3d(e.posX, e.posY, e.posZ)
				.subtract(e.prevPosX, e.prevPosY, e.prevPosZ)
				.scale(1 - partialTicks));
		
		float f = WEntity.getDistance(WMinecraft.getPlayer(), e) / 20F;
		GL11.glColor4f(2 - f, f, 0, 0.5F);
		
		GL11.glVertex3d(WVec3d.getX(start), WVec3d.getY(start),
			WVec3d.getZ(start));
		GL11.glVertex3d(WVec3d.getX(end), WVec3d.getY(end),
			WVec3d.getZ(end));
	}
	GL11.glEnd();
}
 
Example #7
Source File: TileEntityRenderHelper.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void renderByItem(ItemStack itemStack) {
    Block block = Block.getBlockFromItem(itemStack.getItem());
    Item item = itemStack.getItem();
    if (item == ItemLoader.tofumetal_shield) {
        Minecraft.getMinecraft().getTextureManager().bindTexture(SHIELD_METAL_TEXTURE);
        GlStateManager.pushMatrix();
        GlStateManager.scale(1.0F, -1.0F, -1.0F);
        this.modelShield.render();
        GlStateManager.popMatrix();
    } else if (item == ItemLoader.tofuishi_shield) {
        Minecraft.getMinecraft().getTextureManager().bindTexture(SHIELD_ISHI_TEXTURE);
        GlStateManager.pushMatrix();
        GlStateManager.scale(1.0F, -1.0F, -1.0F);
        this.modelShield.render();
        GlStateManager.popMatrix();
    } else if (block == BlockLoader.TOFUCHEST) {
        TileEntityRendererDispatcher.instance.render(this.chestRender, 0.0D, 0.0D, 0.0D, 0.0F);
    } else {
        super.renderByItem(itemStack);
    }

}
 
Example #8
Source File: PartPressureTube.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void renderDynamic(Vector3 pos, float partialTicks, int renderPass){
    if(renderPass == 0) {
        /*   GL11.glPushMatrix(); // start
           // GL11.glDisable(GL11.GL_TEXTURE_2D);
           // GL11.glEnable(GL11.GL_BLEND);
           // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
           FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());

           // GL11.glColor4f(0.82F, 0.56F, 0.09F, 1.0F);
           GL11.glTranslatef((float)pos.x + 0.5F, (float)pos.y + 1.5F, (float)pos.z + 0.5F); // size
           GL11.glRotatef(0, 0.0F, 1.0F, 0.0F);

           GL11.glScalef(1.0F, -1F, -1F);
           if(tubeModel == null) tubeModel = new ModelPressureTube();
           tubeModel.renderModel(0.0625F, tube.sidesConnected);
           GL11.glPopMatrix();*/
        TileEntityRendererDispatcher.instance.getSpecialRenderer(tube).renderTileEntityAt(tube, pos.x, pos.y, pos.z, partialTicks);

    }
}
 
Example #9
Source File: MobSpawnEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	for(ChunkScanner scanner : new ArrayList<>(scanners.values()))
	{
		if(scanner.displayList == 0)
			continue;
		
		GL11.glCallList(scanner.displayList);
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example #10
Source File: TileEntityRenderHelper.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void renderByItem(ItemStack itemStack) {
    Block block = Block.getBlockFromItem(itemStack.getItem());
    if (block == BlockLoader.STONEMORTAR) {
        TileEntityRendererDispatcher.instance.render(this.mortarRender, 0.0D, 0.0D, 0.0D, 0.0F);
    } else {
        super.renderByItem(itemStack);
    }

}
 
Example #11
Source File: ShipStorage.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setTESRs() {
	tesrs.clear();
	for (BlockStorage bs : blockMap.values()) {
		if (bs.tileentity != null) {
			@SuppressWarnings("rawtypes")
			TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.renderers
					.get(bs.tileentity.getClass());
			if (renderer != null)
				tesrs.add(bs.tileentity);
		}
	}
}
 
Example #12
Source File: BaseVehicleRender.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void doRender(BaseVehicleEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
	this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

	BufferBuilder buf = Tessellator.getInstance().getBuffer();

	GlStateManager.pushMatrix();
	
	buf.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

	BlockPos offset = entity.getOffset();
	GlStateManager.translate(x - offset.getX(), y - offset.getY(), z - offset.getZ());

	if (entity.getStorage().bufferstate == null || entity.getStorage().updateRequired) {
		for (BlockPos bp : entity.getBlocks().keySet()) {
			if (bp == null)
				continue;
			Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(entity.getStorage().getBlockState(bp),
					bp, entity.getStorage(), buf);
		}
		entity.getStorage().bufferstate = buf.getVertexState();
	} else {
		buf.setVertexState(entity.getStorage().bufferstate);
	}

	Tessellator.getInstance().draw(); 

	for (TileEntity t : entity.getStorage().getTESRs()) {
		if (t != null) {
			TileEntityRendererDispatcher.instance.render(t, t.getPos().getX(), t.getPos().getY(), t.getPos().getZ(),
					partialTicks);
		}
	}
	GlStateManager.popMatrix();
}
 
Example #13
Source File: MixinRenderGlobal.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @reason Adds subsections to the "root.gameRenderer.level.entities.blockentities"
 * profiler, using the tile entity ID, or the class name if the id is null.
 */
@Redirect(method = "renderEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher;render(Lnet/minecraft/tileentity/TileEntity;FI)V"))
private void tileEntityRender(TileEntityRendererDispatcher renderDispatcher, TileEntity tileEntity, float partialTicks, int destroyStage) {
    world.profiler.func_194340_a(() -> { // func_194340_a = startSection(Supplier<String>)
        final ResourceLocation tileEntityId = TileEntity.getKey(((TileEntity) tileEntity).getClass());
        return tileEntityId == null ? tileEntity.getClass().getSimpleName() : tileEntityId.toString();
    });
    renderDispatcher.render(tileEntity, partialTicks, destroyStage);
    world.profiler.endSection();
}
 
Example #14
Source File: ItemBannerRenderer.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
private void renderBanner(float x, float y, float z, float angle, float scale) {
	OpenGLHelper.pushMatrix();
	OpenGLHelper.rotate(angle, 0, 1, 0);
	OpenGLHelper.scale(scale, scale, scale);
	OpenGLHelper.translate(x, y, z);

	TileEntityRendererDispatcher.instance.renderTileEntityAt(banner, 0, 0, 0, 0);

	OpenGLHelper.popMatrix();
}
 
Example #15
Source File: MobEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	double partialTicks = event.getPartialTicks();
	
	if(style.getSelected().boxes)
		renderBoxes(partialTicks);
	
	if(style.getSelected().lines)
		renderTracers(partialTicks);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example #16
Source File: PlayerEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	double partialTicks = event.getPartialTicks();
	
	if(style.getSelected().boxes)
		renderBoxes(partialTicks);
	
	if(style.getSelected().lines)
		renderLines(partialTicks);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example #17
Source File: EnderChestRenderer.java    From EnderStorage with MIT License 5 votes vote down vote up
public static void renderChest(int rotation, int freq, boolean owned, double x, double y, double z, int offset, float lidAngle) {
    TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance;
    renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e);
    GL11.glColor4f(1, 1, 1, 1);

    CCRenderState.changeTexture("enderstorage:textures/enderchest.png");
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glTranslated(x, y + 1.0, z + 1.0F);
    GL11.glScalef(1.0F, -1F, -1F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    model.chestLid.rotateAngleX = lidAngle;
    model.render(owned);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    renderButtons(freq, rotation, lidAngle);
    GL11.glPopMatrix();

    double time = ClientUtils.getRenderTime() + offset;
    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
            new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + EnderStorageClientProxy.getPearlBob(time), z + 0.5),
            new Rotation(time / 3, new Vector3(0, 1, 0)),
            0.04);

    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.changeTexture("enderstorage:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example #18
Source File: ItemEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private void renderTracers(double partialTicks)
{
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glColor4f(1, 1, 0, 0.5F);
	
	Vec3d start = RotationUtils.getClientLookVec()
		.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
		.addVector(TileEntityRendererDispatcher.staticPlayerX,
			TileEntityRendererDispatcher.staticPlayerY,
			TileEntityRendererDispatcher.staticPlayerZ);
	
	GL11.glBegin(GL11.GL_LINES);
	for(EntityItem e : items)
	{
		Vec3d end = e.getEntityBoundingBox().getCenter()
			.subtract(new Vec3d(e.posX, e.posY, e.posZ)
				.subtract(e.prevPosX, e.prevPosY, e.prevPosZ)
				.scale(1 - partialTicks));
		
		GL11.glVertex3d(WVec3d.getX(start), WVec3d.getY(start),
			WVec3d.getZ(start));
		GL11.glVertex3d(WVec3d.getX(end), WVec3d.getY(end),
			WVec3d.getZ(end));
	}
	GL11.glEnd();
}
 
Example #19
Source File: ItemEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// GL settings
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	double partialTicks = event.getPartialTicks();
	
	renderBoxes(partialTicks);
	
	if(style.getSelected().lines)
		renderTracers(partialTicks);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example #20
Source File: MobileChunkRenderer.java    From archimedes-ships with MIT License 5 votes vote down vote up
/**
 * Render this TileEntity at its current position from the player
 */
public void renderTileEntity(TileEntity tileentity, float partialticks)
{
	int i = chunk.getLightBrightnessForSkyBlocks(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, 0);
	int j = i % 65536;
	int k = i / 65536;
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
	GL11.glColor4f(1F, 1F, 1F, 1F);
	TileEntityRendererDispatcher.instance.renderTileEntityAt(tileentity, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, partialticks);
}
 
Example #21
Source File: TileEntityRendererBase.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void renderByItem(ItemStack stack, float partialTicks) {
    IBlockState renderState = Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getMetadata());
    tileEntityInstance.setBlockState(renderState);
    TileEntityRendererDispatcher.instance.render(tileEntityInstance, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
}
 
Example #22
Source File: GuiComponentSideSelector.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void render(int offsetX, int offsetY, int mouseX, int mouseY) {
	if (isInInitialPosition == false || Mouse.isButtonDown(2)) {
		final Entity rve = parent.getMinecraft().getRenderViewEntity();
		trackball.setTransform(MathUtils.createEntityRotateMatrix(rve));
		isInInitialPosition = true;
	}

	final int width = getWidth();
	final int height = getWidth();
	// assumption: block is rendered in (0,0,0) - (1,1,1) coordinates
	GL11.glPushMatrix();
	GL11.glTranslatef(offsetX + x + width / 2, offsetY + y + height / 2, diameter);
	GL11.glScaled(scale, -scale, scale);
	trackball.update(mouseX - width, -(mouseY - height));

	parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
	GlStateManager.enableTexture2D();

	if (te != null) TileEntityRendererDispatcher.instance.render(te, -0.5, -0.5, -0.5, 0.0F);

	parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
	if (blockState != null) drawBlock();

	SidePicker picker = new SidePicker(0.5);

	List<Pair<Side, Integer>> selections = Lists.newArrayListWithCapacity(6 + 1);
	final HitCoord coord = picker.getNearestHit();
	if (coord != null) selections.add(Pair.of(coord.side, 0x444444));

	if (highlightSelectedSides) {
		for (EnumFacing dir : selectedSides)
			selections.add(Pair.of(Side.fromForgeDirection(dir), 0xCC0000));
	}

	if (selections != null) drawHighlight(selections);

	lastSideHovered = coord == null? null : coord.side.toForgeDirection();

	GL11.glPopMatrix();
}
 
Example #23
Source File: RenderUtils.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static void translateToPlayer(Entity e, float partialTickTime) {
	GL11.glTranslated(
			interpolateValue(e.posX, e.prevPosX, partialTickTime) - TileEntityRendererDispatcher.staticPlayerX,
			interpolateValue(e.posY, e.prevPosY, partialTickTime) - TileEntityRendererDispatcher.staticPlayerY,
			interpolateValue(e.posZ, e.prevPosZ, partialTickTime) - TileEntityRendererDispatcher.staticPlayerZ);
}
 
Example #24
Source File: TileEntityFancySkullRenderer.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public void func_147497_a(TileEntityRendererDispatcher dispatcher) {
	super.func_147497_a(dispatcher);
	instance = this;
}
 
Example #25
Source File: ItemJarExtendedNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
    if (item.getItem() == RegisteredItems.itemExtendedNodeJar) {
        if (type == IItemRenderer.ItemRenderType.ENTITY) {
            GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
        } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
            GL11.glTranslatef(0.0F, 0.0F, -0.5F);
        }
        TileJarNode tjf = new TileJarNode();
        if (item.hasTagCompound()) {
            AspectList aspects = ((ItemExtendedNodeJar) item.getItem()).getAspects(item);
            if (aspects != null) {
                tjf.setAspects(aspects);
                tjf.setNodeType(((ItemExtendedNodeJar) item.getItem()).getNodeType(item));
                tjf.setNodeModifier(((ItemExtendedNodeJar) item.getItem()).getNodeModifier(item));
            }
        }
        tjf.blockType = ConfigBlocks.blockJar;
        tjf.blockMetadata = 2;
        GL11.glPushMatrix();
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileJar(), 0.0D, 0.0D, 0.0D, 0.0F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glTranslated(0.5D, 0.4D, 0.5D);
        ItemNodeRenderer.renderItemNode(tjf);
        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        ItemNodeRenderer.renderItemNode(tjf);
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        ItemNodeRenderer.renderItemNode(tjf);
        GL11.glPopMatrix();


        GL11.glPushMatrix();
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        this.rb.useInventoryTint = true;
        this.rb.renderBlockAsItem(RegisteredBlocks.blockExtendedNodeJar, item.getItemDamage(), 1.0F);
        GL11.glPopMatrix();


        GL11.glEnable(32826);
    }
}
 
Example #26
Source File: EnderTankRenderer.java    From EnderStorage with MIT License 4 votes vote down vote up
public static void renderTank(int rotation, float valve, int freq, boolean owned, double x, double y, double z, int offset)
{
    TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance;
    renderEndPortal.render(x, y, z, 0, info.field_147560_j, info.field_147560_j, info.field_147561_k, info.field_147553_e);
    GL11.glColor4f(1, 1, 1, 1);
    
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glPushMatrix();
        GL11.glTranslated(x+0.5, y, z+0.5);
        GL11.glRotatef(-90*(rotation+2), 0, 1, 0);
        
        CCRenderState.changeTexture("enderstorage:textures/endertank.png");
        CCRenderState.startDrawing(4);
        tankModel.render();
        CCRenderState.draw();

        CCRenderState.changeTexture("enderstorage:textures/buttons.png");
        CCRenderState.startDrawing(7);
        for(int i = 0; i < 3; i++)
        {
            int colour = EnderStorageManager.getColourFromFreq(freq, i);
            buttons[i].render(new UVTranslation(0.25 * (colour % 4), 0.25 * (colour / 4)));
        }
        CCRenderState.draw();
        
        new Rotation(valve, new Vector3(0, 0, 1)).at(new Vector3(0, 0.4165, 0)).glApply();

        CCRenderState.changeTexture("enderstorage:textures/endertank.png");
        CCRenderState.startDrawing(4);
        valveModel.render(new UVTranslation(0, owned ? 13/64D : 0));
        CCRenderState.draw();
    GL11.glPopMatrix();
        
    double time = ClientUtils.getRenderTime()+offset;
    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
        new Vector3(x+0.5, y+0.45+EnderStorageClientProxy.getPearlBob(time)*2, z+0.5),
        new Rotation(time/3, new Vector3(0, 1, 0)),
        0.04);
    
    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.changeTexture("enderstorage:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example #27
Source File: RenderTileStickyJar.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    if(tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
        TileStickyJar stickyJar = (TileStickyJar) tile;

        TileJarFillable parent = stickyJar.getParent();
        World world = tile.getWorldObj();
        Block block = stickyJar.getParentBlock();

        GL11.glPushMatrix();

        GL11.glTranslated(x, y, z);
        rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing));

        //TESR
        TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent);
        if(renderer != null) {
            stickyJar.syncToParent();

            renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks);

            stickyJar.syncFromParent();
        }

        //ISimpleBlockHandler
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        bindTexture(TextureMap.locationBlocksTexture);

        RENDER_BLOCKS.blockAccess = world;

        Tessellator tess = Tessellator.instance;
        tess.startDrawingQuads();

        tess.setNormal(0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX));

        tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord);

        RENDER_BLOCKS.renderBlockByRenderType(block, tile.xCoord, tile.yCoord, tile.zCoord);

        tess.setTranslation(0, 0, 0);
        tess.draw();

        GL11.glPopAttrib();
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }
}
 
Example #28
Source File: DryingRackRenderer.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public DryingRackRenderer(TileEntityRendererDispatcher p_i226006_1_)
{
    super(p_i226006_1_);
}
 
Example #29
Source File: ChoppingBlockRenderer.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public ChoppingBlockRenderer(TileEntityRendererDispatcher p_i226006_1_)
{
    super(p_i226006_1_);
}
 
Example #30
Source File: RenderTileEnderTank.java    From EnderStorage with MIT License 4 votes vote down vote up
public RenderTileEnderTank(TileEntityRendererDispatcher dispatcher) {
    super(dispatcher);
}