Jump to content

[1.5] World.setBlock removed?


pmardle

Recommended Posts

I have been using...

 

world.setBlock(blockX, blockY, blockZ + 3,Block.dirt.blockID);

 

Successfully as part of a worldgen.class for a structure build in Forge 6.6.2.533, however now with 7.7.0.575 it is throwing an error, and the ability to set a block has disappeared??

 

Any Advice?

 

Thanks,

 

Link to comment
Share on other sites

is there any kind of clever line of code that could be used to avoid having to rename and edit every single file of a mod to fix this?

 

If you use eclipse, then you can simply make a search/replace.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

But why if it was .setBlock in 1.4.7 would they not include it in the 1.5 version.. Seems backward to me, to make your software WORSE on a new release.. :(

They have to manually rename methods after major updates. It takes time to get them all caught up. Chill, mon.
Link to comment
Share on other sites

I think it's actually func_96440_m

 

Thanks, was wondering why the "Function_xxxxx_a wasn't working lol"

 

I still don't understand why if they figured out that was .setBlock in the last version and it hasn't changed then why not just rename the thing for this version :P

 

Also is the renaming a Forge or MCP thing ?

 

(Sorry only started modding for 1.4.7 so this is my first version update :D)

Link to comment
Share on other sites

I think it's actually func_96440_m

MMMM I disagree, that method is different from the "setBlock" in the 1.4.7.

[spoiler=func_96440_m from Forge for 1.5]public void func_96440_m(int par1, int par2, int par3, int par4)

    {

        for (int i1 = 0; i1 < 4; ++i1)

        {

            int j1 = par1 + Direction.offsetX[i1];

            int k1 = par3 + Direction.offsetZ[i1];

            int l1 = this.getBlockId(j1, par2, k1);

 

            if (l1 != 0)

            {

                Block block = Block.blocksList[l1];

 

                if (Block.field_94346_cn.func_94487_f(l1))

                {

                    block.onNeighborBlockChange(this, j1, par2, k1, par4);

                }

                else if (Block.isNormalCube(l1))

                {

                    j1 += Direction.offsetX[i1];

                    k1 += Direction.offsetZ[i1];

                    l1 = this.getBlockId(j1, par2, k1);

                    block = Block.blocksList[l1];

 

                    if (Block.field_94346_cn.func_94487_f(l1))

                    {

                        block.onNeighborBlockChange(this, j1, par2, k1, par4);

                    }

                }

            }

        }

    }

 

[spoiler=setBlock from Forge for 1.4.7]public boolean setBlock(int par1, int par2, int par3, int par4)

    {

        if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000)

        {

            if (par2 < 0)

            {

                return false;

            }

            else if (par2 >= 256)

            {

                return false;

            }

            else

            {

                Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);

                boolean var6 = var5.setBlockID(par1 & 15, par2, par3 & 15, par4);

                this.theProfiler.startSection("checkLight");

                this.updateAllLightTypes(par1, par2, par3);

                this.theProfiler.endSection();

 

                if (var6 && (this.isRemote || var5.deferRender))

                {

                    this.markBlockForUpdate(par1, par2, par3);

                }

 

                return var6;

            }

        }

        else

        {

            return false;

        }

    }

 

 

EDIT:

The only solution I've got is using the setBlockAndMetadataWithNotify.

Example:

 

setBlockAndMetadataWithNotify(xCoord,yCoord,zCoord,blockID,metadata,notify)

I THINK THAT metadata should be 0 if you're not using metadata in the block. The notify is an integer and is used in a bitwise operation:

((par6 & 1) != 0)

SO, every integer different to 1 wil return 0. Again, I THINK THAT it shoul be 0 to be equal to the setBlock method. So a real example would be:

setBlockAndMetadataWithNotify(xCoord,yCoord,zCoord,blockID,0,0) to be equal to the setBlock method in 1.4.7

 

 

Hope this helps :3

Link to comment
Share on other sites

OMG guys just search in the minecraft code, setblock is func_94575_c

It's not. func_94575_c only uses the setBlockAndMetadataWithNotify:

[spoiler=func_94575_c]public boolean func_94575_c(int par1, int par2, int par3, int par4)

    {

        return this.setBlockAndMetadataWithNotify(par1, par2, par3, par4, 0, 3);

    }

 

 

As I said, the setBlockAndMetadataWithNotify:

[spoiler=setBlockAndMetadataWithNotify]public boolean setBlockAndMetadataWithNotify(int par1, int par2, int par3, int par4, int par5, int par6)

    {

        if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000)

        {

            if (par2 < 0)

            {

                return false;

            }

            else if (par2 >= 256)

            {

                return false;

            }

            else

            {

                Chunk chunk = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);

                int k1 = 0;

 

                if ((par6 & 1) != 0)

                {

                    k1 = chunk.getBlockID(par1 & 15, par2, par3 & 15);

                }

 

                boolean flag = chunk.setBlockIDWithMetadata(par1 & 15, par2, par3 & 15, par4, par5);

                this.theProfiler.startSection("checkLight");

                this.updateAllLightTypes(par1, par2, par3);

                this.theProfiler.endSection();

 

                if (flag)

                {

                    if ((par6 & 2) != 0 && (!this.isRemote || (par6 & 4) == 0))

                    {

                        this.markBlockForUpdate(par1, par2, par3);

                    }

 

                    if (!this.isRemote && (par6 & 1) != 0)

                    {

                        this.notifyBlockChange(par1, par2, par3, k1);

                        Block block = Block.blocksList[par4];

 

                        if (block != null && block.func_96468_q_())

                        {

                            this.func_96440_m(par1, par2, par3, par4);

                        }

                    }

                }

 

                return flag;

            }

        }

        else

        {

            return false;

        }

    }

 

The red text is the part where the notify is used, with func_94575_c it enters the if. (3 & 1 returns 1)

Searching more I found that the function called is: setBlockIDWithMetadata (in green), and in the old "setBlock" use setBlockID. Searching in the Chunk class I've found that... there is no setBlockID method anymore. So setBlock method in the World class doesn't exist. I think that now we can only use the setBlockAndMetadataWithNotify.

 

BUT WELL, we can use that function, the only bad thing is that is weird to use a method named func_94575_c and remember what it do.

Link to comment
Share on other sites

I have been using...

 

world.setBlock(blockX, blockY, blockZ + 3,Block.dirt.blockID);

 

Successfully as part of a worldgen.class for a structure build in Forge 6.6.2.533, however now with 7.7.0.575 it is throwing an error, and the ability to set a block has disappeared??

 

Any Advice?

 

Thanks,

 

 

Use setBlockAndMetadataWithNotify(). It's a pain to convert it all...

You'll have to add two args(world, x,y,z, blockid, meta, notify);

meta is the metadata that goes along with your block, usually 0.

notify is critical here... it appears that it in most cases it should be a 2,

otherwise the block doesn't get updated to the client.

 

Don't use eclipse to make your changes. Use a real editor, then restart eclipse.

I used 'vim'. Much faster!

Good luck!

 

Odds are good I've been programming since before you were born. Yeah. I'm OLD school.

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin88 adalah bocoran slot rekomendasi gacor dari Ligawin88 yang bisa anda temukan di SLOT Ligawin88. Situs SLOT Ligawin88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin88 merupakan SLOT Ligawin88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin88 hari ini yang telah disediakan SLOT Ligawin88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin88 di link SLOT Ligawin88.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
  • Topics

×
×
  • Create New...

Important Information

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