Jump to content

Super jump mod


Jarle

Recommended Posts

What i want to do:

I want to make a mod, where the player can jump much higher then normal height.

The height should be 15 times higher then normal height.

This function will only be available if my position is on an slime_block.

I no this mod may be really strange, but why not?

 

The code

package jattys.mods.devox4kids;

 

import net.minecraft.block.Block;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

 

public class SuperJump {

   

@SubscribeEvent

public void BouncySlimeBlock(LivingJumpEvent event){

if(!(event.entity instanceof EntityPlayer)) {

return;

}

 

if(event.entity.worldObj.(where i get an error)getBlock(

((int) Math.floor(event.entity.posX)),

((int) Math.floor(event.entity.posY)) - 2,

((int) Math.floor(event.entity.posZ))) != Blocks.slime_block){

return;

}

 

event.entity.motionY *= 15;

}

}

 

The error

The method getBlock(int, int, int) is undefined for the type World.

 

What can i actually do?

Link to comment
Share on other sites

World#getBlock(int,int,int)

was replaced by

World#getBlockState(BlockPos)

in 1.8, which returns an

IBlockState

.

IBlockState#getBlock

will return the

Block

of the

IBlockState

.

 

You can use

Entity#getPosition

to get an

Entity

's position as a

BlockPos

and

BlockPos#down(int)

to subtract an amount from the y coordinate.

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.

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.