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

    • So i know for a fact this has been asked before but Render stuff troubles me a little and i didnt find any answer for recent version. I have a custom nausea effect. Currently i add both my nausea effect and the vanilla one for the effect. But the problem is that when I open the inventory, both are listed, while I'd only want mine to show up (both in the inv and on the GUI)   I've arrived to the GameRender (on joined/net/minecraft/client) and also found shaders on client-extra/assets/minecraft/shaders/post and client-extra/assets/minecraft/shaders/program but I'm lost. I understand that its like a regular screen, where I'd render stuff "over" the game depending on data on the server, but If someone could point to the right client and server classes that i can read to see how i can manage this or any tip would be apreciated
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
  • Topics

×
×
  • Create New...

Important Information

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