Jump to content

issue with detecting blocks


dontrell94

Recommended Posts

I'm going to say this:

 

Any person who can help me program this correctly will have their name on the credits of this mod for coding.

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Link to comment
Share on other sites

It works to a point..... just that it makes the blocks like they are invisible non solids, but when you walk into them its like the player has a continuous, sand fall in place disorder..... :o

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Link to comment
Share on other sites

im trying to code it for a 3X3X4 square this block being on the top row.

 

essentially 3 blocks below this plus the row its on

 

You have < 2 right now.  Which means it will do 0 and 1, but not 2.

 

Also, it's not centered on your pit trap.

 

for(i=-1;i<=1;i++) {
  for(j=-1;j<=1;j++) {
    for(k=0;k<=3;k++ {

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

where does that go?

 

...in place of your current loop..?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

how do you handle the x, y, and z variables?

 

seriously? :|

 

x+i

y-j

z+k

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

public class PitfallHandler

    public World world; // the world you are using

    public int i, j, k; // X, Y, and Z axis variables

    public int x, y, z;

 

i had to add the last line for it to not error

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Link to comment
Share on other sites

This is when I facepalm myself to death...

 

Can you tell we and/or show screenshots of the "null" blocks (blocks that are invisible and glitch the game. My name for 'em :D)?a

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

Upon further investigation, my code only errors when I take out the

 

this.world = world;

 

line......

 

Anybody have ideas?

 

 

package huntingTraps.Resources;

 

import net.minecraft.world.World;

 

public class PitfallHandler

    public World world; // the world you are using

    public int i, j, k; // X, Y, and Z axis variables

    private int x, y, z;

   

    public PitfallHandler(World world, int x, int y, int z)

    {

        this.world = world; // the world

        this.x = i; // X axis

        this.y = j; // Y axis

        this.z = k; // Z axis

    }

 

    public void generatePitfall()

    {

        // this nested for loop will make a 'block' of air to the dimensions specified in numOfBlocksOn***

        for(i=-1;i<=1;i++)

        {

            for(j=-1;j<=1;j++)

            {

              for(k=0;k<=3;k++)

                      {

                        //if(world.getBlockId(i+x, j-y, k+z) == Block.stone.blockID)

                      // {

                            world.setBlock(

                                i + x, // this makes blocks of air go out however many numOfBlocksOnXAxis was

                                j - y, // this makes blocks of air go out however many numOfBlocksOnYAxis was

                                k + z, // this makes blocks of air go out however many numOfBlocksOnZAxis was

                                00 // the block of air

                                );

                      //  }

                }

            }

        }

    }

}

 

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Link to comment
Share on other sites

change your constructor from this:

public PitfallHandler(World world, int x, int y, int z)
    {
        this.world = world; // the world
        this.x = i; // X axis
        this.y = j; // Y axis
        this.z = k; // Z axis
    }

 

to this:

public PitfallHandler(World world, int x, int y, int z)
    {
        this.world = world; // the world
        this.x = x; // X axis
        this.y = y; // Y axis
        this.z = z; // Z axis
    }

 

because at the moment you are still using null variables. but only with the location variables. the world variable is correct though xD

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

I wouldn't mind if it even showed any indication of what it's even doing tho....... it does absolutely nothing now...no block change, no error, nothing....

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Link to comment
Share on other sites

I wouldn't mind if it even showed any indication of what it's even doing tho....... it does absolutely nothing now...no block change, no error, nothing....

 

... what are you developing your code with? Eclipse alike many other IDEs come with a debugger. You should use that. It helps a lot finding out why your code doesn't work at all anymore.

Link to comment
Share on other sites

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I don't even know if its the loop

 

My point is:

 

You need to learn the basics before you can mod minecraft.

 

By not understanding that you needed to replace one set of loops with another set of loops and how to convert the pseudocode I posted into actual code, you have demonstrated that you have no idea what your doing.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I don't even know if its the loop

 

My point is:

 

You need to learn the basics before you can mod minecraft.

 

By not understanding that you needed to replace one set of loops with another set of loops and how to convert the pseudocode I posted into actual code, you have demonstrated that you have no idea what your doing.

 

^^^ Agreed...

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

naw, my brain has been dead for a day or so now cuz of this problem......I can't even talk straight to my friends at this point. leave me alone about the "basics"

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Link to comment
Share on other sites

naw, my brain has been dead for a day or so now cuz of this problem......I can't even talk straight to my friends at this point. leave me alone about the "basics"

 

Okay. (Sorry about that, had a run in with a teacher at school :S) Do you have your source code anywhere? That way we can help a lot more. Can I see your Block code (where you activate the trap), and your current Pitfall generator?

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

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



×
×
  • Create New...

Important Information

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