Jump to content

Recommended Posts

Posted (edited)

I know this is probably a really dumb question, but it seems like everything has changed since I last programmed a mod (in 2012).  Albeit, that should not be suprising.

I'm having a hard time setting a block to a vanilla minecraft block. I know how to reference my own mods blocks.  For this example, a dirt block will be fine.

 

Minecraft.getMinecraft().world.setBlockState(new BlockPos(0,0,0), /*somehow reference a dirt block*/ ,0);

 

I think you have to do something with getDefualtState().  But I have been googling around for a while and can't find a modern (a way that works with the modern version of minecraft), that will allow me to create a dirt block.  I tried new DirtBlock() and it gives me an error with no way of actually fixing it.

 

I had to use PLURAL Blocks not block.

 

Edited by bobwilicer
I changed blockPos to BlockPos(0,0,0) so there isn't confusion regarding if I know how to use BlockPos.
Posted

In addition to calling the method on the server side, the piece you are missing needs to be an IBlockState. For vanilla dirt, it would probably be Blocks.DIRT.getDefaultState(). If you're looking for podzol or something, you'll need to get that state instead.

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.