Jump to content

[1.7.2] [UNSOLVED]how to use Events


MrNegaBlox

Recommended Posts

the minecraft src is in "Referenced Libraries/forgeSrc"

 

Break/placed(from Block.class):

    /**
     * Called right before the block is destroyed by a player.  Args: world, x, y, z, metaData
     */
    public void onBlockDestroyedByPlayer(World p_149664_1_, int p_149664_2_, int p_149664_3_, int p_149664_4_, int p_149664_5_) {}

    /**
     * Called whenever the block is added into the world. Args: world, x, y, z
     */
    public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {}

 

don't forget the thank you button.

Here could be your advertisement!

Link to comment
Share on other sites

I did those methods doing this.

@SubscribeEvent
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
	p_149726_1_.setBlockToAir(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_ - 1);

}

But nothing happened when I placed a block.

Link to comment
Share on other sites

I think I might know what the problem is. I set up a base block that use a subclass of the original block. and the block where I placed the method was a subclass of that, so I don't know if that really affects anything, but it isn't working. so I don't know

Link to comment
Share on other sites

Found them in the Block.class in 10 second:

 

public void onBlockDestroyedByPlayer(World p_149664_1_, int p_149664_2_, int p_149664_3_, int p_149664_4_, int p_149664_5_){}

 

public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) {}

 

Link to comment
Share on other sites

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.