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

Minecraft version: 1.12.2

Forge version: 1.12.2-14.23.5.2824

Java version: Version 8 Update 211 (build 1.8.0_211-b12)

 

When there was IInventory and ISidedInventory, inventory names were simple to use (getInventoryName, hasCustomInventoryName), but now there are capabilities and they don't have anything like inventory name.

How Am I supposed to change name of inventory of TileEntity in GuiContainer ? I want to display in GUI the name of block renamed in anvil. I know how to save it in NBT, I just want to know if there is some way to retrieve it.

Edited by Dipo

  • Author

I know how to tell client about change, but i mean how to retrieve the name of it on the server side. I want to do exactly what is in chest. When u rename chest block in anvil and place it, then open it, the name of the item chest is shown above the inventory. But I don't know how to "move" the name of the ItemStack to the tileentity.

 

But I've figured it out by overriding onBlockPlacedBy in my block class:

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
	TileEntity atm = world.getTileEntity(pos);

	if (atm instanceof TileEntityATM)
		((TileEntityATM) atm).setCustomName(stack.getDisplayName());
}

 

But thanks anyway

Edited by Dipo

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.