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

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]

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.

  • Author

Okay, according to Whov's tut, the tile entity is remade in the part class, but your function returns a TileMultipart.

Did Whov do it wrong?

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

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.

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.