Jump to content

[UnSolved] [1.7.2+] Porting mod to 1.7.2


Electrobob99

Recommended Posts

As the subject suggests, I would like some advice on porting a mod to 1.7.2 and possibly beyond. The mod I plan to port is open Sourced, and went by the name of Rise of The Automatons, and stopped being Officially updated in 1.2.5 minecraft. I have ideas for it that could change it drastically, which is one reason for my efforts. I may just need a push in the right direction, or the source is really jumbled. All I know is the source code is quite incoherent for me atleast. Any help will be appreciated.

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Since it dating back to 1.2.5 i recommend recoding it from scratch. so much have changed that your gonna more or less recode everything.

 

 

Naturalis - The easy way for nature.!

Esquire - A helping hand for your adventure.

Jimanju - The Random Disasters!

Link to comment
Share on other sites

Usually 1.2.5 means you have client source and server source.

Updating would need merging the two, then use packets to send appropriate data.

I already worked on Rise of the Automatons but never finished. You can see the progress on my github (Zetgeist repo).

Link to comment
Share on other sites

hmm.. welp, I tried to get the Duplex block to work, so far I have been able to replicate the 9 drop ratio. But I can't for the life of me get the old ability that occurs after it's broken to break all connecting blocks of itself and only drop 9. This is the code of it from 1.2.5 that I assume dealt with the ability, probably changed with updates:

 

 

 

public void onBlockRemoval(World world, int i, int j, int k) {

world.spawnParticle("reddust", i + 0.5F, j + 0.5F, k + 0.5F, 0, 0.2F, 0);

if (world.getBlockId(i + 1, j, k) == blockID) {

world.setBlock(i + 1, j, k, 0);

}

if (world.getBlockId(i - 1, j, k) == blockID) {

world.setBlock(i - 1, j, k, 0);

}

if (world.getBlockId(i, j, k - 1) == blockID) {

world.setBlock(i, j, k - 1, 0);

}

if (world.getBlockId(i, j, k + 1) == blockID) {

world.setBlock(i, j, k + 1, 0);

}

if (world.getBlockId(i, j - 1, k) == blockID) {

world.setBlock(i, j - 1, k, 0);

}

if (world.getBlockId(i, j + 1, k) == blockID) {

world.setBlock(i, j + 1, k, 0);

}

}

 

 

And this is what someone who ported it to 1.6.4 changed it to:

 

 

public void func_71898_d(World world, int i, int j, int k, int par5)

{

world.func_72869_a("reddust", i + 0.5F, j + 0.5F, k + 0.5F, 0.0D, 0.2000000029802322D, 0.0D);

if (world.func_72798_a(i + 1, j, k) == this.field_71990_ca) {

world.func_72832_d(i + 1, j, k, 0, 0, 3);

}

if (world.func_72798_a(i - 1, j, k) == this.field_71990_ca) {

world.func_72832_d(i - 1, j, k, 0, 0, 3);

}

if (world.func_72798_a(i, j, k - 1) == this.field_71990_ca) {

world.func_72832_d(i, j, k - 1, 0, 0, 3);

}

if (world.func_72798_a(i, j, k + 1) == this.field_71990_ca) {

world.func_72832_d(i, j, k + 1, 0, 0, 3);

}

if (world.func_72798_a(i, j - 1, k) == this.field_71990_ca) {

world.func_72832_d(i, j - 1, k, 0, 0, 3);

}

if (world.func_72798_a(i, j + 1, k) == this.field_71990_ca) {

world.func_72832_d(i, j + 1, k, 0, 0, 3);

}

}

 

 

 

also for future reference.. How would I get to setting up blocks with metadata?

any help is appreciated

 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

What version of forge are you using???

 

when updated to the latest Recommend you dont have all the func names.

and this should be enough to set it up

    public void onBlockDestroyedByPlayer(World world, int j, int k, int l, int par4)
    {
        if (world.getBlock(j, k, l) == this)
        {
            world.setBlockToAir(j, k, l);
        }
        
    }

Naturalis - The easy way for nature.!

Esquire - A helping hand for your adventure.

Jimanju - The Random Disasters!

Link to comment
Share on other sites

would it be possible to utilize that in an if statement?

 

 

edit--

ok, seems that even with that code in the latest recommended version, it still seems that the block doesn't destroy other blocks next to it that are the same block. Other words, what I want it to be able to break other blocks that are the same as itself when they are touching, or do I just utilize similar code from old code

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

No I mean if I want to make a single class for similar blocks, like a glass type, and I want to have this ability only happen for one of the types of glass based on name, what could I do? Also how could I have a given attribute from a method go to another method in a block class?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

To make it destroy block next to it you have to change the jkl to +1 and -1, like in the if statements you brought.

 

you can try other setblocks.

 

if i understand you right you mean you want it to only works on block with the same metadata?

 

and that you want other blocks to extend this class?

Naturalis - The easy way for nature.!

Esquire - A helping hand for your adventure.

Jimanju - The Random Disasters!

Link to comment
Share on other sites

Well I was able to get it to work with this coding :P :

 

public class AM_BlockGlass extends Block{

 

 

String blockName;

public AM_BlockGlass(String name, float hardness, String blocktexture) {

super(Material.glass);

this.setBlockName(name);

this.setHardness(hardness);

this.setBlockTextureName(Strings.MODID + ":" + blocktexture);

this.setStepSound(Block.soundTypeGlass);

this.setCreativeTab(AM_CreativeTabs.tabBlock);

if(name == "Duplex"){

blockName = name;

}

}

 

public void onBlockDestroyedByPlayer(World world, int j, int k, int l, int par4)

    {

 

    if(blockName == "Duplex")

and following it with the method to run when it's destroyed, though it does seem to only break the blocks right next to it, and not every block of it that is touching

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Im not sure im following you when you say

though it does seem to only break the blocks right next to it, and not every block of it that is touching

[/Quote]

 

i mean if it only break 1 block instead of the 26 in a 3x3x3 you just have to add a setblockair for each of the location inside the if

Naturalis - The easy way for nature.!

Esquire - A helping hand for your adventure.

Jimanju - The Random Disasters!

Link to comment
Share on other sites

Thank you, I thought that would be what I had to do... Also would I do something similar to that if I wanted a certain block to break and drop itself when hit by or touching water source/still, without changing it's material to circuits? And would it be possible to allow the placement of torches on the side of a block with the material set to glass? Also another question... I'm trying to make a block mineable by Iron Pickaxe and up, but for some reason the gold pickaxe won't mine it aswell, how could I get that to work. Also for future usage, how can I utilize the ore dictionary for my blocks and items, as well as how to use metadata for blocks?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

  • 3 weeks later...

Ok, now I have figured out how to utilize metadata to create subBlocks, aswell as multisided textures for blocks. Now I need a little help in a few things. For one I wouldn't mind a bit of an explanation on how to code a block that spreads like grass and why it does it. As well as how to make a specified block texture to rotate towards the player when placed, like a furnace. I mean I could look at the vanilla codes, but some of it doesn't make sense completely. Any help is appreciated

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Ok, I've gotten the hang of making a spreading block, and wanted to make it spread in a more controlled state, i.e only turn blocks surrounding it in a 3x3 area, and the following code does work, but I would like to know if there is a way I could simplify this, since I want it to turn certain blocks into other different blocks, may use subBlocks with metadata:

 

*vanilla blocks as placeholders

 

   if (world.getBlock(x + 1, y, z) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x + 1, y, z, Blocks.glass);
                    }
                    if (world.getBlock(x - 1, y, z) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x - 1, y, z, Blocks.glass);
                    }
                    
                    if (world.getBlock(x + 1, y, z + 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x + 1, y, z + 1, Blocks.glass);
                    }      
                    
                    if (world.getBlock(x - 1, y, z - 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x - 1, y, z - 1, Blocks.glass);
                    }   
                    
                    if (world.getBlock(x + 1, y, z - 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x + 1, y, z - 1, Blocks.glass);
                    }
                    
                    if (world.getBlock(x - 1, y, z + 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x - 1, y, z + 1, Blocks.glass);
                    }     
                    
                    if (world.getBlock(x, y, z + 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x, y, z + 1, Blocks.glass);
                    }
                    if (world.getBlock(x, y, z - 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x, y, z - 1, Blocks.glass);
                    }

 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Hint: You can use [ code ] tags inside [ spoiler ] tags, or you can paste as a gist for syntax highlight and line numbers :)

 

I am not sure why you call

getBlockLightValue

and

getBlockLightOpacity

with the same coordinates every time. Assuming you want to call it on the block you are spreading to, and assuming you only want one such conversion per random tick, this would be a way to do it more concisely:

 

for (int i = x-1; i <= x+1; ++i) {
    for (int j = z-1; j <= z+1; ++j) {
        if (world.getBlock(i, y, j) == Blocks.grass && world.getBlockLightValue(i, y, j) >= 4 && world.getBlockLightOpacity(i, y, j) <= 2) {
            world.setBlock(i, y, j, Blocks.glass);
        }
    }
}

 

Keep in mind that this converts horisontally exclusively.

Link to comment
Share on other sites

Ok, I may have put it in the wrong place, because for some reason it doesn't seem to spread now. I put the new code in the

 for (int l = 0; l < 97; ++l)

method where I changed the default growth speed of '4' to 97 to see effects quicker than grass growth. can I know why it doesn't spread now?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Ok this is from the updateTick Method of my block class with the code suggested:

public void updateTick(World world, int x, int y, int z, Random random)
    {
        if (!world.isRemote)
        {
            if (world.getBlockLightValue(x, y + 1, z) >= 9)
            {
                for (int l = 0; l < 97; ++l)
                {
                    /*int i1 = x + random.nextInt(3) - 1;
                    int j1 = y + random.nextInt(5) - 3;
                    int k1 = z + random.nextInt(3) - 1;
                    Block block = world.getBlock(i1, j1 + 1, k1); */

                	for (int i = x-1; i <= x+1; ++i) {
                	    for (int j = z-1; j <= z+1; ++j) {
                	        if (world.getBlock(i, y, j) == Blocks.grass && world.getBlockLightValue(i, y, j) >= 4 && world.getBlockLightOpacity(i, y, j) <= 2) {
                	            world.setBlock(i, y, j, Blocks.glass);
                	        }
                	    }
                	}
                }
            }
        }
    }

 

I also plan to use similar working code for a block to be able to "destroy" not mine blocks nearby if those blocks are the same within a 3x3x3 cube area, which would reside within a onBlockDestroyedByPlayer method.

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Your block won't tick more often just because you run a loop 97 times. Besides, since you're not using

l

, all 97 iterations are identical, with no change to the state of the world between them - the iterations are moot.

 

Also, you are comparing the light value of the block above your block.

Link to comment
Share on other sites

hmm, so how do I fix it? because I just modified the code that worked from the BlockGrass class, and it did seem to speed up when I changed the basic code from 4 to 97?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Basically I want it to be able to spread to certain blocks that are next to each of it's sides except for direct top and direct bottom of the block that does this. And possibly turn other blocks into a block of a different metadata. Like block B turns into Block A.0, block C turns into block A.1, etc 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

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

    • 🚀Link Daftar Klik Disini🚀 Tips Bermain Slot Bank Jago agar Meraih Maxwin dan Jackpot di MAXWINBET77 Bermain slot online Bank jago adalah cara yang seru dan mengasyikkan untuk mencari keuntungan besar di MAXWINBET77. Jika kamu ingin meningkatkan peluangmu untuk meraih maxwin dan jackpot secara terus-menerus, ada beberapa tips dan strategi yang bisa kamu terapkan. Berikut adalah panduan lengkapnya: Pilih Slot dengan RTP Tinggi: RTP (Return to Player) adalah persentase rata-rata dari total taruhan yang dikembalikan kepada pemain sebagai kemenangan. Pilihlah mesin slot Bank jago yang memiliki RTP tinggi, karena ini meningkatkan peluangmu untuk meraih kemenangan dalam jangka panjang. Kenali Fitur Bonus: Setiap slot Bank jago memiliki fitur bonus yang berbeda, seperti putaran gratis, simbol liar (wild), dan bonus game. Pelajari dengan baik fitur-fitur ini karena mereka dapat membantu meningkatkan peluang meraih kemenangan besar. Kelola Taruhan dengan Bijak: Tentukan batasan taruhan yang sesuai dengan budget dan jangan tergoda untuk bertaruh melebihi kemampuan finansialmu. Terapkan strategi taruhan yang bijak untuk memaksimalkan penggunaan saldo. Mainkan Slot Bank jago Progresif: Jika tujuanmu adalah meraih jackpot besar, coba mainkan slot Bank jago progresif di MAXWINBET77. Jackpot pada jenis slot Bank ini terus bertambah seiring dengan taruhan pemain lainnya, sehingga dapat mencapai jumlah yang sangat besar. Manfaatkan Promosi dan Bonus: MAXWINBET77 sering kali menawarkan promosi dan bonus kepada pemainnya. Manfaatkan bonus-bonus ini untuk meningkatkan peluangmu meraih kemenangan tanpa menggunakan modal tambahan. Berkonsentrasi dan Bersabar: Fokuslah saat bermain slot bank jago dan jangan terburu-buru. Bersabarlah meskipun tidak langsung mendapatkan hasil yang diharapkan. Kadang-kadang diperlukan waktu dan keberuntungan untuk mencapai maxwin atau jackpot. Baca Aturan Permainan: Sebelum bermain, pastikan untuk membaca aturan dan pembayaran pada slot Bank Jago yang dipilih. Mengetahui cara kerja mesin slot akan membantu mengoptimalkan strategi bermainmu. Dengan menerapkan tips-tips di atas dan tetap bermain secara bertanggung jawab, kamu dapat meningkatkan peluang meraih maxwin dan jackpot di Slot Bank Jago MAXWINBET77. Selamat bermain dan semoga sukses meraih kemenangan besar Anda Hari Ini.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 SLOT BCA 10K adalah bocoran slot rekomendasi gacor dari RATUASIA77 yang bisa anda temukan di SLOT BCA 10K. Situs SLOT BCA 5K hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT BSI 5K terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT BCA 10K merupakan SLOT BCA 10K 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 BSI 10K. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT BCA 10K hari ini yang telah disediakan SLOT BCA 10K. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs RATUASIA77 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 BCA 10K terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT BCA 10K di link SLOT BCA RATUASIA77.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 SLOT BSI 10K adalah bocoran slot rekomendasi gacor dari RATUASIA77 yang bisa anda temukan di SLOT BSI 10K. Situs SLOT BSI 5K hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT BSI 5K terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT BSI 10K merupakan SLOT BSI 10K 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 BSI 10K. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT BSI 10K hari ini yang telah disediakan SLOT BSI 10K. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs RATUASIA77 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 BSI 10K terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT BSI 10K di link SLOT BSI RATUASIA77.
    • DAFTAR SCATTER HITAM MAHJONG WAYS DISINI DAFTAR SCATTER HITAM MAHJONG WAYS DISINI DAFTAR SCATTER HITAM MAHJONG WAYS DISINI Mencari scatter hitam dalam permainan slot demo mahjong ways server thailand adalah salah satu jalan menuju kemenangan melalui bentuk kombinasi pola. Mengetahui bocoran pola scatter dapat meningkatkan peluang kemenangan jackpot maxwin yang cukup besar. TAG : Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam
    • DAFTAR SCATTER HITAM MAHJONG DISINI DAFTAR SCATTER HITAM MAHJONG DISINI DAFTAR SCATTER HITAM MAHJONG DISINI Scatter Hitam merupakan salah satu provider Pg Soft dari game slot mahjong ways terpopuler dan terkenal saat ini dengan inovasi terbaru scatter hitam bisa menghasilkan kemenangan maxwin jackpot yang luar biasa sangat besar. TAG : Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam Scatter Hitam
  • Topics

×
×
  • Create New...

Important Information

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