Posted August 14, 201510 yr 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?
August 14, 201510 yr 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.
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.