Jump to content

[1.8] How to check if a block is in front of a tileentity?


Termin8or

Recommended Posts

How would i check if a certain block is in directly front of a Tile Entity? My Tile Entity is a generator and has a specific front? How would I go about checking if a block is in that direction?

 

Here's my code for looking for this block currently http://pastebin.com/hvDQhXK2

 

I want to make it so that machine[?] is only equal to that block if its not in front of the generator as I don't want to output power to it, if it is!

Currently making a voxel game.

Link to comment
Share on other sites

public EnumFacing getNearbyMachine(World world, BlockPos pos) {
   for (EnumFacing facing : EnumFacing.values) {
     TileEntity te = world.getTileEntity(pos.offset(facing, 1));
     if (te instanceof IEnergyAccepter) return facing;
  }
  return null;
}

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.