Jump to content

Working with CBMP tile entities


KeeganDeathman

Recommended Posts

New APIs, so fun.

I'm attempting to get my ribbon cable multipart to function as a cable, but my method requires being able to access the next block, see if it's a cable, if it is, look at it's values. But thing is, neither world.getBlock or world.getTileEntity work. So how would I go about interacting with nearby multiparts and their tile entities, I have yet to find something equivalent to worlds functions

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

int side = 0
t = getMultipartTile(world, pos)
t.partMap(side)

 

Put this in some sort of Library. You will need it quite a few times...

def getMultipartTile(w:IBlockAccess, bc:BlockCoord):TileMultipart = getMultipartTile(w, bc.x, bc.y, bc.z)
def getMultipartTile(w:IBlockAccess, x:Int, y:Int, z:Int) = w.getTileEntity(x, y, z) match {
  case t:TileMultipart => t
  case _ => null
}

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

The part "block" actually is just a block with a tileentity. This TileEntity contains an array in which the parts are stored. Certain parts like cables should occupy up specific spaces. 1-6 for each side.

t.partMap() will return an instance of your part (wire) which you can access directly by type checking followed by type casting.

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

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.