Jump to content

Recommended Posts

Posted

I have an Block that extends BlockCrops. Is it very hard to check the dimension, say "world.provider.getDimensionID" and if it's not in, say, the nether, make it drop as if it was killed by the player?

Could someone help me with this?

“Since when did you start modding?”

“Last night"

Posted

Hi

 

It's not difficult.

 

BlockLeaves does something similar if the leaves are unsupported.

 

in updateTick:

 

if (!par1World.isRemote) --> this.removeLeaves

 

this.removeLeaves:     

        this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);

        par1World.setBlockToAir(par2, par3, par4);

 

And also need to set

        this.setTickRandomly(true);

in the constructor, so that updateTick gets called occasionally.

 

-TGG

 

Posted

I’m fairly new to modding, could you please explain to me more thoroughly?

I have a basic tick handler, but I do not know what to do from there.

“Since when did you start modding?”

“Last night"

Posted

Hi

 

Thanks EP :-)

 

// Im not quite sure why you only would want this to get done on the server side

// Since we need the visual as well?

 

I think the vanilla code does that because changing the block and dropping the item on the server automatically syncs with the clients, so it's not necessary to do it on the client as well.  Sometimes it is important to do something on the server only, otherwise you get "ghost" items on the client, but in this case I think the setBlock and Drop methods check for that.  So I reckon it would probably work fine either way.

 

-TGG

Posted

It works. Thanks, I now know how to do this stuff. This is also how minecraft Grass spreads, right? On random tick?

“Since when did you start modding?”

“Last night"

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.