pollProjectileHits
See original GitHub issueI had to use a old version of mcpi the other night. trying to use pollProjectileHits but an error that states the BlockEvent in minecraft.py file are out of the arrays range is prompted every time my arrow hits a block. Sorry, I don’t have what the error specifically says atm. Note the old mcpi has no problem with my code.
def pollProjectileHits(self):
"""Only triggered by projectiles => [BlockEvent]"""
s = self.conn.sendReceive(b"player.events.projectile.hits")
events = [e for e in s.split("|") if e]
results = []
for e in events:
info = e.split(",")
results.append(ProjectileEvent.Hit(
int(info[0]),
int(info[1]),
int(info[2]),
int(info[3]),
info[4],
info[5])<------- this is where the error is highlighted.
return results
this is a sample of my code.
def amenotejikara(): #Teleporting with arrow shots
for blockhit in mc.player.pollProjectileHits():
pos = blockhit.pos
teleport = mc.player.setPos(pos.x, pos.y, pos.z)
edited to include code blocks
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
RaspberryJuice/README.md at master - GitHub
pollProjectileHits - get events back of arrow hit for the player; player.pollBlockHits - get block hits for the player; player.
Read more >RaspberryJuice | SpigotMC - High Performance Minecraft
pollProjectileHits - get events back of arrow hit for the player; player.pollBlockHits - get block hits for the player; player.
Read more >mcScripts2(jutsu) [Minecraft: Java Edition] [Config Scripts]
pollProjectileHits (): pos = blockhit.pos teleport = mc.player.setPos(pos.x, pos.y, pos.z) def fireAShot(): #Fire arrows for blockhit in mc.player.
Read more >Custom Commands for Minecraft using python and mcpi
I've just started with mcpi and I want to have custom commands to capture chat posts starting with / . How can I...
Read more >TeachCraft: آموزش برنامهنویسی پایتون از طریق بازی ماینکرفت
pollProjectileHits (): if active_spell == "teleport": mc.player.setPos(blockhit.pos.x, blockhit.pos.y, blockhit.pos.z) elif active_spell == "lavapool": ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Tested with RaspberryJuice 1.12.1 + mcpi1.2 - I cant find any issues.
I am also confused by your comment
pollProjectileHits didnt exist in any version of mcpi before version 1.2
Closing as unable to reproduce, feel free to reopen if you can provide additional information.
The picture above is using a version of mcpi saved to my google drive from a while back, it runs the code just fine
This is what happens when I try and run the code with version 1.2.
Thanks for your help.