Jump to content

Recommended Posts

Posted

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

Posted

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!

Posted

I thought that was what I had to do, I just have to hope that I can figure out some of the stuff the original modder added.

Member of Aerotech Networks, a Multi-Gaming server.

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

Posted

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).

Posted

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

Posted

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!

Posted

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

Posted

did you not see the if?

 

i made the first if you have.

Naturalis - The easy way for nature.!

Esquire - A helping hand for your adventure.

Jimanju - The Random Disasters!

Posted

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

Posted

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!

Posted

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

Posted

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!

Posted

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

  • 3 weeks later...
Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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

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



×
×
  • Create New...

Important Information

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