Jump to content

[1.8] Double jumping like they do on those server (ex: mineplex), and dmg help


Recommended Posts

Posted

So I have 2 things, one, I want to be able to add double jumping like on those servers for my mod, also, I have an ability that completely ignores armor and what mode you are in (meaning it kills people in creative). I could not find an entity.damge thing, here is the code for my ability

 

@Override

public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn,

EntityPlayer playerIn) {

playerIn.swingItem();

//System.out.println("swung");

for (int x = playerIn.getPosition().getX() - 3; x < playerIn.getPosition().getX() + 3; x++){

//System.out.println("inside x");

for (int y = playerIn.getPosition().getY() - 3; y < playerIn.getPosition().getY() + 3;y++){

for (int z = playerIn.getPosition().getZ() - 3; z < playerIn.getPosition().getZ() + 3; z++){

//System.out.println("Inside z");

for (Object o: worldIn.getLoadedEntityList()){

EntityLiving e;

//System.out.println("Inside entity check");

try {

e = (EntityLiving)o;

} catch (Exception ex){

continue;

}

if (e.equals(playerIn)) continue;

if (e.getPosition().getX() == x && e.getPosition().getY() == y && e.getPosition().getZ() == z){

e.performHurtAnimation();

e.setHealth(e.getHealth() - 8 );

Posted

Sticks don't have their own class, so DamageTypes don't.  In fact, many damage types in Minecraft don't have a separate class.  However, the damage sources caused by entities are dynamic objects, created as needed based on the entity causing the damage and what (simple type) of damage it is.

 

You're free to create a new class if you want, it gives you a little extra flexibility such as being able to customize the death-by message,

func_151519_b

.  But the existing classes should be sufficient for your needs.

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.

Posted

also nvm again, made custom dmg source, but it does no dmg? Instead I get a long error in console.

It's hard to help you without seeing your latest code and the error. Post them on Gist or Pastebin and link them here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

I understand what you are doing but that is not exactly what I am going for, basically I intend on using something to test if they are airborne (and yes I know there already is something for that), then let them fly for a short amount of time when they double tab space bar and then boost them where they are looking, but I hit a wall and deleted all my code like an idiot because where I was going was not going to work, I had a friend who worked with bukkit servers and that is how he said to do it, but he never explained how, so now I am stuck :P

Posted

I understand what you are doing but that is not exactly what I am going for, basically I intend on using something to test if they are airborne (and yes I know there already is something for that), then let them fly for a short amount of time when they double tab space bar and then boost them where they are looking, but I hit a wall and deleted all my code like an idiot because where I was going was not going to work, I had a friend who worked with bukkit servers and that is how he said to do it, but he never explained how, so now I am stuck :P

Well you should have said that from the beginning, rather than just 'double-jump'.

 

What exactly do you mean by 'let them fly'? Like in Creative Mode, or only in a certain direction? Doesn't seem much like a double-jump if they can fly... What about this boost, does it trigger automatically after their fly-time is over, or is it another button press?

 

Anyway, the basic premise is exactly the same:

if (jump key pressed and entity already in air) { allow flying for short time; }

each tick:

if (fly time > 0) {decrement fly time; if (fly time is now zero) { boost in direction player is facing; }}

 

'Boosting' a player in a certain direction can be done simply by getting their look vector and then adding some multiple of that to their current motion values.

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.