Jump to content

Recommended Posts

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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...

×   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.