Jump to content

[1.7.10] Change Block on Random Tick?


TheSeaOfSpace

Recommended Posts

Hey there! I'm trying to replace a block on a random tick. However, with every attempt I always come to a crash. I've got a good hold of Forge, and this confuses me greatly.

 

Current code:

http://pastebin.com/YGbabsXr

 

I'm trying to change the block to another block called "FullGrapeVine". I don't think that should be incredibly helpful, but it's something.

 

Thanks!

Link to comment
Share on other sites

You call Random#nextInt(1-1). 1-1 == 0 and Random#nextInt(0) is not allowed (read the Javadoc).

 

I'm in awe that I missed that. Thanks!

 

I solved the rest of it by myself, though!

 

For anybody interested:

here's what should be entered:

	@Override
public void updateTick(World world, int x, int y, int z, Random ran)
    {
	super.updateTick(world, x, y, z, ran);
                world.setBlock(x,y,z, Blocks.clay); //Or whatever block you want
    }

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.