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

I have a quick question, if I have a method in the block class doesn't have a parameter I need, how can I add a parameter to it with it still getting called?

If I helped then you help, hit that Thank You button or Applaud.

  • Author

The method is

    public void updateTick(World world, int x, int y, int z, Random random)

The parameter I need is EntityPlayer. I need my block to scan for players in a radius of a few blocks.

If I helped then you help, hit that Thank You button or Applaud.

  • Author

I tough about that yesturday but I forgot to try it. Thanks for the fast help!

If I helped then you help, hit that Thank You button or Applaud.

  • Author

In:

world.getClosestVulnerablePlayer(1, x, y, z)

What does the 1 stand for? Is it the gamemode? If so, when I have it at 1, does that mean that players with gamemode 1 will be counted or anything that isn't 1?

If I helped then you help, hit that Thank You button or Applaud.

  • Author

Thanks!

If I helped then you help, hit that Thank You button or Applaud.

  • Author

Ok, so this is the code I used, and it didn't work. Nothing happend.

    public void updateTick(World world, int x, int y, int z, Random random)
    {
    	EntityPlayer player = world.getClosestVulnerablePlayer(5, x, y, z);
    	
    	if(player != null)
    	{
    		System.out.println("gf");
    	}
    }

Ohh yeah, sorry for posting this here but, when I log out and back in, my block isn't there.

If I helped then you help, hit that Thank You button or Applaud.

  • Author

It still doesn't work, it doesn't even do anything.

If I helped then you help, hit that Thank You button or Applaud.

  • Author

I have a tile entity, I also custom render my block. So should I put that code in the tileentity class?

 

If I helped then you help, hit that Thank You button or Applaud.

  • Author

But there is no method called updateTick so it won't get called in the tileentity

 

If I helped then you help, hit that Thank You button or Applaud.

  • Author

I found it but I wasn't sure will that do the job since it didn't have the parameters.

If I helped then you help, hit that Thank You button or Applaud.

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.