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

How do I make this if it isn't equal to air?

 

if (worldIn.isAirBlock(pos.up())){}

 

I have this but it doesn't seem to work. Is there a different block declaration or do I need to test for both air and null?

 

world.getBlockState(positionNumber)!=Blocks.AIR

I don't optimize my code before it works.

you're comparing a blockstate to a block. add

..... != Blocks.AIR.getDefaultState()

or you can get the block from world.getBlockState(positionNumber).getBlock()

 

so:

 

world.getBlockState(positionNumber) != Blocks.AIR.getDefaultState()

 

or

 

world.getBlockState(positionNumber).getBlock() != Blocks.AIR

 

EDIT:

I take this is something to do with 1.11? as in 1.10.2 there still is a worldObj.isAirBlock(pos);

 

Please don't check against the air block.  Many mods use "technical" blocks for various things (usually lighting), but which should be treated like air.

 

I'd suggest checking the block's material against Material.AIR

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.

World.isAirBlock is the way to go. As it bounces getBlockState->getBlock->isAir for you.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

Also one last thing, I still don't understand why my method for players clicking on the block isn't working. Could someone give me a correction of the code?

 

public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ){}

I don't optimize my code before it works.

Also one last thing, I still don't understand why my method for players clicking on the block isn't working. Could someone give me a correction of the code?

 

public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ){}

You parameters match is it not running at all? Try adding an @Override above it.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

method does not override or implement a method from a supertype

This is the error I get when I put the Override there.

I don't optimize my code before it works.

Your method signature is wrong.

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.

Open up the Block class.

Ctrl-F "onBlockActivated"

Copy-paste

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.

Guys... We live in 2016. IDEs are a thing.

 

While I know I can do this with Eclipse, I prefer not to for very large classes like Block because the list is very very large and often I'm already looking at the method I want to override.

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.

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.