TNT in Minecraft usually need to be lit by flint and steel. When lighting TNT, the data value of the TNT is changed to 1 and then a punch is simulated. We can reproduce this by actually changing the data value and then punching the TNT.
Get the data spanner script for the Python API here:
import mcpi.minecraft
import time
mc = mcpi.minecraft.Minecraft.create();
while True:
hits = mc.events.pollBlockHits()
for hit in hits:
block = mc.getBlockWithData(hit.pos.x, hit.pos.y, hit.pos.z);
block.data = (block.data + 1) & 0xf;
mc.setBlock(hit.pos.x, hit.pos.y, hit.pos.z, block.id, block.data)
mc.postToChat("Block data is now " + str(block.data))
time.sleep(0.1)
To use:
- start the script
- Place some TNT
- Right click one block of TNT with a sword
- the chat should read "Block data is now 1"
- punch that one block of TNT
- BOOM!
The data spanner script is also useful for, say, changing the colour of wool. That's a lesson for another day.
I've only tested this with RaspberryJuice on Desktop, but the concept should work, as I changed a block of TNT in Minecraft PE to data value 1, and it lit when punched.
i am currently a raspberry pi user ( i am in fact commenting on a pi top!) this is very interesting code and it helped me destroy my world! thanks to all for helping out with this issue!
Get the data spanner script for the Python API here:
Credits to http://www.voxelwiki.com/minecraft/Data_Spanner for inspiration.
To use:
- start the script
- Place some TNT
- Right click one block of TNT with a sword
- the chat should read "Block data is now 1"
- punch that one block of TNT
- BOOM!
The data spanner script is also useful for, say, changing the colour of wool. That's a lesson for another day.
I've only tested this with RaspberryJuice on Desktop, but the concept should work, as I changed a block of TNT in Minecraft PE to data value 1, and it lit when punched.
Pi is forced into creative mode; there is no flint and steel in creative mode nor redstone.
Put it in apis/python folder and try again.
i am currently a raspberry pi user ( i am in fact commenting on a pi top!) this is very interesting code and it helped me destroy my world! thanks to all for helping out with this issue!