Jump to content

Recommended Posts

Posted

I've got this beam:

 

width=800 height=449https://dl.dropboxusercontent.com/u/184200482/img/beam_bug_ok.png[/img]

 

But if i look up (by the way a lose the view of the block) the beam stop rendering

 

width=800 height=449https://dl.dropboxusercontent.com/u/184200482/img/beam_bug_bad.png[/img]

 

My code

 

Block.class

package com.sackcastellon.treeoflife.block;

import java.util.Random;

import com.sackcastellon.treeoflife.TreeOfLife;
import com.sackcastellon.treeoflife.tileentity.TileEntityRoot;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;

public class BlockRoot extends BlockContainer
{
public BlockRoot()
{
	super(Material.wood);

	this.setCreativeTab(TreeOfLife.tabTol);
}

@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
	return new TileEntityRoot();
}

@Override
public boolean isOpaqueCube()
{
	return false;
}

@Override
public IIcon getIcon(int side, int meta)
{
	return Blocks.glass.getIcon(side, meta);
}

@Override
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_,
		int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
	// TODO Auto-generated method stub
	super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_,
			p_149695_5_);
}

@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_,
		int p_149650_3_) {
	// TODO Auto-generated method stub
	return super.getItemDropped(p_149650_1_, p_149650_2_, p_149650_3_);
}

@Override
public int damageDropped(int p_149692_1_) {
	// TODO Auto-generated method stub
	return super.damageDropped(p_149692_1_);
}

@Override
public void registerBlockIcons(IIconRegister p_149651_1_) {
	// TODO Auto-generated method stub
	super.registerBlockIcons(p_149651_1_);
}

@Override
public int quantityDropped(int meta, int fortune, Random random) {
	// TODO Auto-generated method stub
	return super.quantityDropped(meta, fortune, random);
}

@Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z,
		ForgeDirection direction, IPlantable plantable) {
	// TODO Auto-generated method stub
	return super.canSustainPlant(world, x, y, z, direction, plantable);
}

@Override
public void onNeighborChange(IBlockAccess world, int x, int y, int z,
		int tileX, int tileY, int tileZ) {
	// TODO Auto-generated method stub
	super.onNeighborChange(world, x, y, z, tileX, tileY, tileZ);
}

}

 

TileEntity.class

package com.sackcastellon.treeoflife.tileentity;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;

public class TileEntityRoot extends TileEntity {

    private boolean field_146015_k = true;
    
    @SideOnly(Side.CLIENT)
private long field_146016_i;
    @SideOnly(Side.CLIENT)
    private float field_146014_j;
    
    @SideOnly(Side.CLIENT)
    public double getMaxRenderDistanceSquared()
    {
        return 65536.0D;
    }

@SideOnly(Side.CLIENT)
    public float func_146002_i()
    {
        if (!this.field_146015_k )
        {
            return 0.0F;
        }
        else
        {
            int i = (int)(this.worldObj.getTotalWorldTime() - this.field_146016_i);
            this.field_146016_i = this.worldObj.getTotalWorldTime();

            if (i > 1)
            {
                this.field_146014_j -= (float)i / 40.0F;

                if (this.field_146014_j < 0.0F)
                {
                    this.field_146014_j = 0.0F;
                }
            }

            this.field_146014_j += 0.025F;

            if (this.field_146014_j > 1.0F)
            {
                this.field_146014_j = 1.0F;
            }

            return this.field_146014_j;
        }
    }

}

 

TileEntityRenderer.class

package com.sackcastellon.treeoflife.renderer;

import org.lwjgl.opengl.GL11;

import com.sackcastellon.treeoflife.tileentity.TileEntityRoot;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;

@SideOnly(Side.CLIENT)
public class TileEntityRootRenderer extends TileEntitySpecialRenderer
{
    private static final ResourceLocation field_147523_b = new ResourceLocation("textures/entity/beacon_beam.png");
    public void renderTileEntityAt(TileEntityRoot entity, double x, double y, double z, float p_147522_8_)
    {
        float f1 = entity.func_146002_i();
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);

        if (f1 > 0.0F)
        {
            Tessellator tessellator = Tessellator.instance;
            this.bindTexture(field_147523_b);
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);
            OpenGlHelper.glBlendFunc(770, 1, 1, 0);
            float f2 = (float)entity.getWorldObj().getTotalWorldTime() + p_147522_8_;
            float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F);
            byte b0 = 1;
            double d3 = (double)f2 * 0.025D * (1.0D - (double)(b0 & 1) * 2.5D);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA(255, 60, 200, 32);
            double d5 = (double)b0 * 0.2D;
            double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5;
            double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5;
            double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5;
            double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5;
            double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5;
            double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5;
            double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5;
            double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5;
            double d23 = (double)(256.0F * f1);
            double d25 = 0.0D;
            double d27 = 1.0D;
            double d28 = (double)(-1.0F + f3);
            double d29 = (double)(256.0F * f1) * (0.5D / d5) + d28;
            double bottom = 1.0D;
            tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29);
		tessellator.addVertexWithUV(x + d7, y + bottom, z + d9, d27, d28);
            tessellator.addVertexWithUV(x + d11, y + bottom, z + d13, d25, d28);
            tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29);
            tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29);
            tessellator.addVertexWithUV(x + d19, y + bottom, z + d21, d27, d28);
            tessellator.addVertexWithUV(x + d15, y + bottom, z + d17, d25, d28);
            tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29);
            tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29);
            tessellator.addVertexWithUV(x + d11, y + bottom, z + d13, d27, d28);
            tessellator.addVertexWithUV(x + d19, y + bottom, z + d21, d25, d28);
            tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29);
            tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29);
            tessellator.addVertexWithUV(x + d15, y + bottom, z + d17, d27, d28);
            tessellator.addVertexWithUV(x + d7, y + bottom, z + d9, d25, d28);
            tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29);
            tessellator.draw();
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
            GL11.glDepthMask(false);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA(255, 255, 255, 32);
            double d30 = 0.2D;
            double d4 = 0.2D;
            double d6 = 0.8D;
            double d8 = 0.2D;
            double d10 = 0.2D;
            double d12 = 0.8D;
            double d14 = 0.8D;
            double d16 = 0.8D;
            double d18 = (double)(256.0F * f1);
            double d20 = 0.0D;
            double d22 = 1.0D;
            double d24 = (double)(-1.0F + f3);
            double d26 = (double)(256.0F * f1) + d24;
            tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
            tessellator.addVertexWithUV(x + d30, y + bottom, z + d4, d22, d24);
            tessellator.addVertexWithUV(x + d6, y + bottom, z + d8, d20, d24);
            tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
            tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
            tessellator.addVertexWithUV(x + d14, y + bottom, z + d16, d22, d24);
            tessellator.addVertexWithUV(x + d10, y + bottom, z + d12, d20, d24);
            tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
            tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
            tessellator.addVertexWithUV(x + d6, y + bottom, z + d8, d22, d24);
            tessellator.addVertexWithUV(x + d14, y + bottom, z + d16, d20, d24);
            tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
            tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
            tessellator.addVertexWithUV(x + d10, y + bottom, z + d12, d22, d24);
            tessellator.addVertexWithUV(x + d30, y + bottom, z + d4, d20, d24);
            tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
            tessellator.draw();
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDepthMask(true);
        }

        GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);
    }

    public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float par5)
    {
        this.renderTileEntityAt((TileEntityRoot)entity, x, y, z, par5);
    }
}

 

As always thanks for helping  ;)

Posted

Place a beacon next to it, that way you can compare the two to tell if your beacon disappearing is a bug in your code or a bug/issue with beacon beams in general.

Posted

You need to return the proper BoundingBox from getRenderBoundingBox in your TE (look at the method to see what it returns for TileEntityBeacon).

 

Thank you, that was the problem. Just added this, and now it works:

 

@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
	return INFINITE_EXTENT_AABB;
}

 


 

Place a beacon next to it, that way you can compare the two to tell if your beacon disappearing is a bug in your code or a bug/issue with beacon beams in general.

 

That was the first thing i thought, anyway thanks  ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello! I have been having a problem with Forgematica, Embeddium, Oculus, and create. I wanted to download litematica so I could see which blocks are in my creative mode build, so that I could collect them all in survival. However, litematica is a fabric mod. I found a port called forgematica, which I added (along with it's dependency) to my mods folder. I loaded into a new world, and built a structure. Then, I added a part from the create mod, and the game crashed instantly, with exit code -1. Thanks for any help! Crash Report and mods list: https://pastebin.com/rtzh6LAi
    • To say that losing 40,000 BTC was a devastating blow would be an understatement. It was an emotional and financial crisis that left me feeling hopeless and utterly lost. For weeks, I was trapped in a whirlwind of regret, second-guessing every decision that led me to that point. The fear that I would never be able to recover such a significant sum of cryptocurrency consumed me, and with each passing day, my despair deepened. I had all but given up on ever regaining my wealth. Then I happened to stumble onto Tech Cyber Force Recovery. In the beginning, I was hesitant. It looked too good to be true: could someone get back so much of their lost Bitcoin? After trying several different approaches and programs without success, I was hesitant to put my trust in another recovery agency. However, I changed my mind after reading Tech Cyber Force Recovery's stellar reviews and reputation. Reaching out to their team was a risk I made. They were courteous and professional from the first time I got in touch with them. I felt like I wasn't just another case to be solved by the staff at Tech Cyber Force Recovery; they truly cared about getting me my lost Bitcoin back. They listened carefully to my circumstances and guided me through each stage, giving me succinct and understandable explanations as I went. Their passion gave me new hope, and their openness instantly made me feel better. As the recovery process began, I still had my doubts, but I knew I had placed my trust in the right hands. The Tech Cyber Force Recovery team kept me informed and updated on their progress, ensuring I never felt in the dark. Despite the complexity of my case, they worked tirelessly, and their expertise became evident at every turn. The level of professionalism and attention to detail they demonstrated throughout the process was beyond impressive. And then, after what felt like an eternity of anticipation, the moment I had been waiting for arrived. I received the news that my 40,000 BTC had been successfully recovered. It was hard to believe at first—it felt like a dream. The weight that had been dragging me down for so long was suddenly lifted, and I could breathe again. The financial loss I had feared would define my future was no longer a reality. I can’t fully express the emotions I felt during that moment. It was a mix of relief, joy, and an overwhelming sense of gratitude. I had gone from a place of utter despair to a complete resurgence of wealth, both emotionally and financially. The Tech Cyber Force Recovery team didn’t just restore my Bitcoin—they restored my faith in the possibility of recovery and gave me back something far more valuable: peace of mind. I will urge anyone in this same predicament to.  
    • Have you found a modder for this vehicle project? Because it will be really hard and I want to know that hero who can create all this
    • and what?????????
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.