Walk through blocks?

Discussion in 'Plugin Development' started by Hotshot, Dec 28, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Hotshot

    Is there any way to set a block so that a player can walk through it?
     
  2. You could change the blocks to air for that player (still not sure if this will work)
    player.sendBlockChange(location, Material.AIR, 0);

    //EDIT: Or teleport the player to the other side of the wall as soon as he touches it.
     
  3. Offline

    Hotshot

    Whats the event to see if the player is touching it?

    //EDIT: I like the set to air idea though, I think I might go with that. Dont think theres any way to do this without client editing.
     
  4. Offline

    theguynextdoor

    A pretty bad way i suppose, would be to use onPlayerMove, and each time check the blocks infront of them and if the blocks are not air, set there type to air. But save there data in a hashmap or something. That way you can replace them once the player has passed. Tbh i would put them in a hashmap and just use a bukkit scheduler to replace them, because i wouldnt know any other way.

    The teleporting the player sounds a wee bit easier.
     
  5. Offline

    Hotshot

    Also how do you get the location of where the players crosshairs are? I cant find anything in the java docs. getCompassTarget() sounds like it, but im pretty sure that its not it.

    EDIT: Nvm, I found it. Its a method inherited from LivingEntity class. getTargetBlock()
     
  6.  
  7. Offline

    Hotshot

    I meant I didnt think there was a way to walk through walls without client editing.
     
  8. Tricking the client into thinking the block would be air isn't enough. Even though the player is then able to walk into that block, but the server side noclip-check automatically teleports them back because the block is - in fact - still a solid one.
    Teleporting would be a ton easier. If you want to stick to that solution, you'd have to do it the other way: Set the actual block to air, and send the block that was previously there to all other players. Then have fun with keeping it updated with new players joining, teleports, chunk unloads/loads and stuff ;)

    And the ultra-pr0 g4ng5ta way would be to hack into the server noclip check and take control over that, now have fun with that :p
     
Thread Status:
Not open for further replies.

Share This Page