orphu / mcdungeon

A procedural dungeon generator for Minecraft
Other
84 stars 18 forks source link

Use TileTickEntity to make BigTree landmark appear immediately on load #268

Open sshipway opened 9 years ago

sshipway commented 9 years ago

The BigTree landmark (which is disabled in the default config) is created by planting 4 saplings in a square and clearing the surrounding and above tiles, so that the actual tree is automatically generated by Minecraft shortly after the chunk becomes active. This is suboptimal because the player may potentially reach the location before the big tree has actually grown, depending on light levels, weather, speed of running, etc.

Investigation into the Minecraft format indicates that what is required is a 'TileTickEntity' http://minecraft.gamepedia.com/Chunk_format#Tile_tick_format definition for the tree tile, which can be set to a value of t=-1 meaning 'perform the action as soon as possible'; this would make the tree grow immediately the chunk is activated.

I've not been able to work out how to create one of these using the existing pymc and mcdungeon functions. Can anyone provide more insight into how to define one of these?

(TileTickEntities sound useful for autogenerated maps as they allow you to build things with water or lava ready to flow; without a tick entity, they would not flow until the player gets close enough to trigger a test. With a tick entity, they will start flowing immediately. I think they are particularly useful for growing trees, though, as manually creating a tree is a pain when you can use the built-in generator.)

orphu commented 9 years ago

So, it appears the pymclevel we have doesn't support TileTicks. The MCEdit-Unified version appears to though. I don't see an easy way to support this until we move to that version of pymclevel.

sshipway commented 9 years ago

Might be able to hack the current pymclevel code to allow ticks to be pushed in, but I think that's a bad idea as it would make it incompatible with the new MCEdit-unified. Not really worth the risk. Once the main code is moved to use the new MCEdit-Unified libraries it will be much better.

The TileTickEntity seems to be primarily used for water and lava flowing, and plant growth. I'm trying to think of any specific use cases for it - the instant-tree-creation was the first one to come to mind. Another thought is a room with a 'door' made by a single flowing lava block above the door that flows down to block it. An action elsewhere can either move a piston or use a cmd block to block/delete the source lava, so the column of flowing lava dries up. This would require the top lava block to have the tiletickentity so that it immediately starts flowing and blocks the door.

orphu commented 9 years ago

I agree, it's a bad idea. Effort is better spent trying to move to the supported pymclevel.

sshipway commented 6 years ago

Looks like the version of pymclevel we are currently linking against does not yet support timeTickEntities

JiFish commented 6 years ago

We are probably going to be forced to update to update to support the changes to the chunk format mentioned in #426

In fact it might be worth holding off on all fixes until that happens. Goodness knows how many things it might break.