Jump to content

Recommended Posts

Posted

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/

Posted

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
Posted

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/

Posted

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/

Posted

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);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

 

 

Posted

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/

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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