Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.