294 posts
Posted 24 August 2012 - 08:27 PM
Currently there is a minor problem with a turtle - it is unable to compare blocks that cannot be legitimately obtained in the game like diamond ore or grass.
So instead, why not comparing a drop of a block? So if turtle would have diamond gem in inventory and compare it to diamond ore, it would return true.
179 posts
Posted 25 August 2012 - 01:10 AM
cannot be legitimately obtained in the game like diamond ore or grass.
Silk Touch!
294 posts
Posted 25 August 2012 - 01:13 AM
Okay, bad example (still forgetting about that enchantment). What about wheat, seeds and all other items that are items in hand, but gets placed as block with different id?
524 posts
Location
Cambridge, England
Posted 02 September 2012 - 05:40 PM
Okay, bad example (still forgetting about that enchantment). What about wheat, seeds and all other items that are items in hand, but gets placed as block with different id?
Blocks drop different items under different conditions (including random chance). ie: wheat can drop seeds, wheat, nothing or both. Gravel can drop gravel or flint. Certain inventory blocks will drop everything inside them. Which should we compare against?
294 posts
Posted 02 September 2012 - 08:36 PM
Simple. If block in front of you have any chance to drop currently selected item, it will return true. Otherwise false. Maybe it could be named turtle.canDrop() to be less confusing.
Btw, nice to see you on the forums, dan200 :D/>/>
1604 posts
Posted 02 September 2012 - 08:52 PM
Simple. If block in front of you have any chance to drop currently selected item, it will return true. Otherwise false. Maybe it could be named turtle.canDrop() to be less confusing.
Btw, nice to see you on the forums, dan200 :D/>/>
Thing is there's no way to know if a block has a chance to drop a block/item, at least not a reliable way (that I know of).
2447 posts
Posted 02 September 2012 - 08:53 PM
Simple. If block in front of you have any chance to drop currently selected item, it will return true. Otherwise false. Maybe it could be named turtle.canDrop() to be less confusing.
Btw, nice to see you on the forums, dan200 :D/>/>
Except there is no way to find what items the block could drop - for instance, gravel can drop flint, or gravel. You could compare gravel against the gravel in the inventory, and get false, because one of them decides to return flint.
Edit: Damn ninja's!
294 posts
Posted 02 September 2012 - 08:54 PM
Oh, so there is no something like a drop table? Sorry then, I have no idea how minecraft works internally.
6 posts
Posted 09 September 2012 - 09:17 PM
I'd be happy if compare could return true for leaves placed by the world when checked against leaves obtained by the player…