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

Hi !

I'm creating a custom block that recieves a redstone signal from any face.

A TileEntity implementing ITickable is created by this block.

In the ITickable::update method, I'm getting the current power using World::isBlockIndirectlyGettingPowered.

It works...a bit.

Screenshot

On this screenshot, the block on the right will receive a power of 15 whereas the block on the left will receive a power of 0. I really don't know why.

My Block class :

public class BlockRedstoneReceiver extends BlockRedstoneDevice {

	public BlockRedstoneReceiver(String name, Material mat, CreativeTabs tab, float hardness, float resistance,
			String tool, int harvest, float light) {
		super(name, mat, tab, hardness, resistance, tool, harvest, light, GuiHandler.REDSTONE_RECEIVER_GUI);
	}

	@Override
	public TileEntity createTileEntity(World world, IBlockState state) {
		return new TileEntityRedstoneReceiver();
	}

}

The block superclass overrides Block::canConnectRedstone to return true.

I'm stuck now. Maybe I forgot something on the block class but I'm not sure... if someone can help me !

Check how vanilla does it at BlockRedstoneDiode. I believe it has something to do with the fact that Block::canConnectRedstone is actually irrelevant when it comes to recieving weak power and is relevant when it comes to sending it.

Edited by V0idWa1k3r

  • Author

Yeah, that's probably that for the Block::canConnectRedstone.

I looked at  BlockRedstoneDiode::updateTick but it seems that it only checks if it has power or not - and I want to check how much power I have.

1 minute ago, Franckyi said:

I looked at  BlockRedstoneDiode::updateTick

BlockRedstoneDiode::calculateInputStrength is the method you are looking for, not it's update tick. You can adapt the code from that method to check all faces instead of just the input one.

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.