Jump to content

[1.7.10] How to Make Block Infinitely Burn?????


Mattkx10

Recommended Posts

I'm making a Netherrack Furnace, and would like to give the feature that would give it infinite fire! So just like regular netherrack, I would want it to be like if you lit the furnace on the top, then it would burn forever until you put it out.

 

If you could come up with somewhere to point me, or some code, that would be great!

 

~Mattkx10 (AKA: Mattkx4 or Mattkx9)

http://mattkx4.github.io/

Check out my website at:

 

http://mattkx4.github.io/

Link to comment
Share on other sites

Check the fire class.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Are you actually making a furnace that you want to burn forever, or do you mean just some standard block?  I think for furnaces you want to look at how they handle fuel.  If you look in the TileEntityFurnace class you'll see a field called currentItemBurnTime and one called furnaceBurnTime that control how long the fuel burns.  If your furnace is extending TileEntityFurnace you can @Override the updateEntity() method so it never does the decrement of the furnaceBurnTime.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Are you actually making a furnace that you want to burn forever, or do you mean just some standard block?  I think for furnaces you want to look at how they handle fuel.  If you look in the TileEntityFurnace class you'll see a field called currentItemBurnTime and one called furnaceBurnTime that control how long the fuel burns.  If your furnace is extending TileEntityFurnace you can @Override the updateEntity() method so it never does the decrement of the furnaceBurnTime.

 

Thanks, but I'm just looking for a standard block. I already have it working so that it doesn't need any fuel :)

Check out my website at:

 

http://mattkx4.github.io/

Link to comment
Share on other sites

Hi

 

Check out Block.isFireSource(), .getFlammability(), .isFlammable().

 

You can see how vanilla uses them in BlockFire.updateTick()

 

-TGG

 

    public void updateTick(World par1World, int wx, int wy, int wz, Random par5Random)
    {
        if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
        {
            Block base = Block.blocksList[par1World.getBlockId(wx, wy - 1, wz)];
            boolean blockBelowIsFireSource = (base != null && base.isFireSource(par1World, wx, wy - 1, wz, par1World.getBlockMetadata(wx, wy - 1, wz), UP));

            if (!this.canPlaceBlockAt(par1World, wx, wy, wz))
            {
                par1World.setBlockToAir(wx, wy, wz);
            }

            if (!blockBelowIsFireSource && par1World.isRaining() && (par1World.canLightningStrikeAt(wx, wy, wz) || par1World.canLightningStrikeAt(wx - 1, wy, wz) || par1World.canLightningStrikeAt(wx + 1, wy, wz) || par1World.canLightningStrikeAt(wx, wy, wz - 1) || par1World.canLightningStrikeAt(wx, wy, wz + 1)))
            {
                par1World.setBlockToAir(wx, wy, wz);
            }
            else
            {
                int l = par1World.getBlockMetadata(wx, wy, wz);

                if (l < 15)
                {
                    par1World.setBlockMetadataWithNotify(wx, wy, wz, l + par5Random.nextInt(3) / 2, 4);
                }

                par1World.scheduleBlockUpdate(wx, wy, wz, this.blockID, this.tickRate(par1World) + par5Random.nextInt(10));

                if (!blockBelowIsFireSource && !this.canNeighborBurn(par1World, wx, wy, wz))
                {
                    if (!par1World.doesBlockHaveSolidTopSurface(wx, wy - 1, wz) || l > 3)
                    {
                        par1World.setBlockToAir(wx, wy, wz);
                    }
                }
                else if (!blockBelowIsFireSource && !this.canBlockCatchFire(par1World, wx, wy - 1, wz, UP) && l == 15 && par5Random.nextInt(4) == 0)
                {
                    par1World.setBlockToAir(wx, wy, wz);
                }
                else
                {
                    boolean flag1 = par1World.isBlockHighHumidity(wx, wy, wz);
                    byte b0 = 0;

                    if (flag1)
                    {
                        b0 = -50;
                    }

                    this.tryToCatchBlockOnFire(par1World, wx + 1, wy, wz, 300 + b0, par5Random, l, WEST );
                    this.tryToCatchBlockOnFire(par1World, wx - 1, wy, wz, 300 + b0, par5Random, l, EAST );
                    this.tryToCatchBlockOnFire(par1World, wx, wy - 1, wz, 250 + b0, par5Random, l, UP   );
                    this.tryToCatchBlockOnFire(par1World, wx, wy + 1, wz, 250 + b0, par5Random, l, DOWN );
                    this.tryToCatchBlockOnFire(par1World, wx, wy, wz - 1, 300 + b0, par5Random, l, SOUTH);
                    this.tryToCatchBlockOnFire(par1World, wx, wy, wz + 1, 300 + b0, par5Random, l, NORTH);

                    for (int i1 = wx - 1; i1 <= wx + 1; ++i1)
                    {
                        for (int j1 = wz - 1; j1 <= wz + 1; ++j1)
                        {
                            for (int k1 = wy - 1; k1 <= wy + 4; ++k1)
                            {
                                if (i1 != wx || k1 != wy || j1 != wz)
                                {
                                    int l1 = 100;

                                    if (k1 > wy + 1)
                                    {
                                        l1 += (k1 - (wy + 1)) * 100;
                                    }

                                    int i2 = this.getChanceOfNeighborsEncouragingFire(par1World, i1, k1, j1);

                                    if (i2 > 0)
                                    {
                                        int j2 = (i2 + 40 + par1World.difficultySetting * 7) / (l + 30);

                                        if (flag1)
                                        {
                                            j2 /= 2;
                                        }

                                        if (j2 > 0 && par5Random.nextInt(l1) <= j2 && (!par1World.isRaining() || !par1World.canLightningStrikeAt(i1, k1, j1)) && !par1World.canLightningStrikeAt(i1 - 1, k1, wz) && !par1World.canLightningStrikeAt(i1 + 1, k1, j1) && !par1World.canLightningStrikeAt(i1, k1, j1 - 1) && !par1World.canLightningStrikeAt(i1, k1, j1 + 1))
                                        {
                                            int k2 = l + par5Random.nextInt(5) / 4;

                                            if (k2 > 15)
                                            {
                                                k2 = 15;
                                            }

                                            par1World.setBlock(i1, k1, j1, this.blockID, k2, 3);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

 

 

Link to comment
Share on other sites

Hi

 

Check out Block.isFireSource(), .getFlammability(), .isFlammable().

 

You can see how vanilla uses them in BlockFire.updateTick()

 

-TGG

 

    public void updateTick(World par1World, int wx, int wy, int wz, Random par5Random)
    {
        if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
        {
            Block base = Block.blocksList[par1World.getBlockId(wx, wy - 1, wz)];
            boolean blockBelowIsFireSource = (base != null && base.isFireSource(par1World, wx, wy - 1, wz, par1World.getBlockMetadata(wx, wy - 1, wz), UP));

            if (!this.canPlaceBlockAt(par1World, wx, wy, wz))
            {
                par1World.setBlockToAir(wx, wy, wz);
            }

            if (!blockBelowIsFireSource && par1World.isRaining() && (par1World.canLightningStrikeAt(wx, wy, wz) || par1World.canLightningStrikeAt(wx - 1, wy, wz) || par1World.canLightningStrikeAt(wx + 1, wy, wz) || par1World.canLightningStrikeAt(wx, wy, wz - 1) || par1World.canLightningStrikeAt(wx, wy, wz + 1)))
            {
                par1World.setBlockToAir(wx, wy, wz);
            }
            else
            {
                int l = par1World.getBlockMetadata(wx, wy, wz);

                if (l < 15)
                {
                    par1World.setBlockMetadataWithNotify(wx, wy, wz, l + par5Random.nextInt(3) / 2, 4);
                }

                par1World.scheduleBlockUpdate(wx, wy, wz, this.blockID, this.tickRate(par1World) + par5Random.nextInt(10));

                if (!blockBelowIsFireSource && !this.canNeighborBurn(par1World, wx, wy, wz))
                {
                    if (!par1World.doesBlockHaveSolidTopSurface(wx, wy - 1, wz) || l > 3)
                    {
                        par1World.setBlockToAir(wx, wy, wz);
                    }
                }
                else if (!blockBelowIsFireSource && !this.canBlockCatchFire(par1World, wx, wy - 1, wz, UP) && l == 15 && par5Random.nextInt(4) == 0)
                {
                    par1World.setBlockToAir(wx, wy, wz);
                }
                else
                {
                    boolean flag1 = par1World.isBlockHighHumidity(wx, wy, wz);
                    byte b0 = 0;

                    if (flag1)
                    {
                        b0 = -50;
                    }

                    this.tryToCatchBlockOnFire(par1World, wx + 1, wy, wz, 300 + b0, par5Random, l, WEST );
                    this.tryToCatchBlockOnFire(par1World, wx - 1, wy, wz, 300 + b0, par5Random, l, EAST );
                    this.tryToCatchBlockOnFire(par1World, wx, wy - 1, wz, 250 + b0, par5Random, l, UP   );
                    this.tryToCatchBlockOnFire(par1World, wx, wy + 1, wz, 250 + b0, par5Random, l, DOWN );
                    this.tryToCatchBlockOnFire(par1World, wx, wy, wz - 1, 300 + b0, par5Random, l, SOUTH);
                    this.tryToCatchBlockOnFire(par1World, wx, wy, wz + 1, 300 + b0, par5Random, l, NORTH);

                    for (int i1 = wx - 1; i1 <= wx + 1; ++i1)
                    {
                        for (int j1 = wz - 1; j1 <= wz + 1; ++j1)
                        {
                            for (int k1 = wy - 1; k1 <= wy + 4; ++k1)
                            {
                                if (i1 != wx || k1 != wy || j1 != wz)
                                {
                                    int l1 = 100;

                                    if (k1 > wy + 1)
                                    {
                                        l1 += (k1 - (wy + 1)) * 100;
                                    }

                                    int i2 = this.getChanceOfNeighborsEncouragingFire(par1World, i1, k1, j1);

                                    if (i2 > 0)
                                    {
                                        int j2 = (i2 + 40 + par1World.difficultySetting * 7) / (l + 30);

                                        if (flag1)
                                        {
                                            j2 /= 2;
                                        }

                                        if (j2 > 0 && par5Random.nextInt(l1) <= j2 && (!par1World.isRaining() || !par1World.canLightningStrikeAt(i1, k1, j1)) && !par1World.canLightningStrikeAt(i1 - 1, k1, wz) && !par1World.canLightningStrikeAt(i1 + 1, k1, j1) && !par1World.canLightningStrikeAt(i1, k1, j1 - 1) && !par1World.canLightningStrikeAt(i1, k1, j1 + 1))
                                        {
                                            int k2 = l + par5Random.nextInt(5) / 4;

                                            if (k2 > 15)
                                            {
                                                k2 = 15;
                                            }

                                            par1World.setBlock(i1, k1, j1, this.blockID, k2, 3);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

 

Thanks this helped a lot!

Check out my website at:

 

http://mattkx4.github.io/

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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