Jump to content

Blocks that spawn a certain of other blocks


The Great Duck

Recommended Posts

Basically, is there a way to make a block (let's say for iron) that when another block (let's say fire) is placed on one side, starts spawning iron blocks out the side until 5 (or whatever) have been placed at which it is 'empty' and breaks into nothing. Said block cannot be mined once placed so as to not get infinite materials. Any way to do this? Preferably with a containment number somehow specified in its crafting recipe.

 

This is to make self-building structures at certain points in my map when certain events are triggered, however I think the potential is endless and could bring the possibility of more ways of moving parts within minecraft.

Link to comment
Share on other sites

There are few ways to handle triggering, but you will have to make sure you won't run into infinite recursive block spawning.

 

 

"starts spawning iron blocks out the side until 5 (or whatever) have been placed at which it is 'empty' and breaks into nothing"

- Explain more (or is it me?).

 

Best shot would be to make custom block which would be "base" of something (structure), then there is Block#onNeighborBlockChanged - this would allow you to detect when something is placed near block. Then you can trigger self build-up.

 

Other way would be to use TileEntity which would build the structure in update() method in some time (in ticks).

To avoid using TileEntity you can implement some system that would utilize ServerTickEvent and invoke structure building with given shape in given location over some ticks (imagine copy-pasting schematic into world).

 

You can make block not-minable by simply setting material/harvest level. You can utilize metadata to make e.g meta = 0 - block is minable, meta = 1 - is not.

 

I have no idea what you mean when saying this last stuff about recipes...

 

What exacly are we talking about here?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Basically, is there a way to make a block (let's say for iron) that when another block (let's say fire) is placed on one side, starts spawning iron blocks out the side until 5 (or whatever) have been placed at which it is 'empty' and breaks into nothing. Said block cannot be mined once placed so as to not get infinite materials. Any way to do this? Preferably with a containment number somehow specified in its crafting recipe.

 

This is to make self-building structures at certain points in my map when certain events are triggered, however I think the potential is endless and could bring the possibility of more ways of moving parts within minecraft.

 

To find if the block has a certain block next to it you would use Block#onNeighborBlockChange and check if the neighbor is the block you want it to be, then use World#setBlock to place the block you want placed, after which you would set your block to air to get rid of it. As to determining what block is crafted, you could make several different blocks for each possible block. Otherwise you would have to use NBT data because metadata isn't large enough to cover every possibility.

 

Finally making it so you cannot mine it you can do what Ernio said, or you can let them mine it and set Block#getItemDropped to null.

 

Note that all this is for 1.7.10 there are some differences in 1.8. As you do no specify what version you are using I can only assume you are with the majority that are still using 1.7.10.

Link to comment
Share on other sites

""starts spawning iron blocks out the side until 5 (or whatever) have been placed at which it is 'empty' and breaks into nothing"

- Explain more (or is it me?)."

 

Like, lets say there is an iron spawning block. If you place fire on the left side, iron starts spawning in a line until five have been placed at which point the block will break.

 

If you put fire on the north and left, iron will spawn south and right (not diagonally. Two separate lines.). Once 5 TOTAL spawn, the block breaks.

 

 

Only the number is variable, btw, not the block type. I was already aware that different types require different block. :P

 

And no, I use 1.8.1, the latest version.

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.