Jump to content

Recommended Posts

Posted

This will be my first mod, I have no experience at all with java or forge. I'm trying to teach myself some stuff trough tutorials on-line. But i can't seem to find the specific information i need. I feel it shouldn't be such a difficult thing to achieve, altough it probably is. Any help would be greatly appreciated :)

Posted

If you have no experience with Java, go on youtube, watch several tutorial and program in java for a weekend before starting at a minimum.  If you have no programming experience at all, take longer.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Thanks, both of you. I realize i should follow a few tutorials first before starting with this, because right now i don't even know how to start :P I'm not going to give up though i'll see this trough until i have something i'm happy with.

 

I'll explain a little better what my goal is.

I'd like to make a mod in which for example a custom mob starts spawning from x=500 to x=1000 and then have another custom mob spawn from x=1000 to x=1500 and so on.

 

The idea is that the further you are away from spawn the more difficult the mobs will be to kill.

Posted

yeah sorry, i meant spawnpoint. I thought they were the same, but that probabbly will make it more difficult.

 

To control where the mob spawns, override getCanSpawnHere and return wheter it should spawn (true) or not (false)

 

To check a radius, do this:

Math.abs(spawnX - entityX) >= 500 && Math.abs(spawnZ - entityZ) >= 500

will check if it's not in a 500x500 squared perimeter around the spawn

Math.sqrt(Math.pow(spawnX - entityX, 2) >= 500 && Math.pow(spawnZ - entityZ, 2)) >= 500

will check if it's not in a circle perimeter with radius 500 around the spawn (I think the math is right, don't count me on that, though)

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.

Posted

Rather than invoking library code to compute limits, just use:

boolean farEnough(int entityX, int entityY, int spawnX, int spawnY) {
    int dx = spawnX - entityX, dy = spawnY - entityY;
    return (dx*dx + dy*dy > 500*500);
}

Posted

Rather than invoking library code to compute limits, just use:

boolean farEnough(int entityX, int entityY, int spawnX, int spawnY) {
    int dx = spawnX - entityX, dy = spawnY - entityY;
    return (dx*dx + dy*dy > 500*500);
}

 

That works, too and is less resource-intensive.

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.

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.