Creating an Inactive Portal Block

Discussion in 'Plugin Development' started by Paradox, Apr 12, 2012.

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

    Paradox

    I'm looking for a way to make a block that you can walk through but cannot be modified.
    I was thinking either a portal block that won't bring you to the nether when you stand in it, or else a water block that won't "disperse" and cannot be picked up by a bucket would work.

    Any ideas on how I could implement something like that?

    Thanks in advanced!
     
  2. Offline

    Father Of Time

    Short answer, BlockPhysicsEvent...

    I do this in my RiftCraft plugin, I create 2 tile tall portals that allow players to walk through to their destination and back... It's possible, but a bit difficult to do because you need to disable a great deal of the portals natural functionality; such as dispelling when surrounded by air, initiating the nether teleporting on MoveOver, etc.

    I can say that it's very doable, but also hard to get right; and if not done right it behaves very very poorly, like crapping people out in the nether on accident.
     
  3. Offline

    Paradox

    Well that... is quite unfortunate. I couldn't do some sort bit changing with the blockId or blockData to break the portal functionality could I? Unless there is another block that might work?
     
  4. Offline

    Father Of Time

    No no, nothing like that; I don't know for sure but I believe a portals data is used to determine it's direction (because it's a flat object, not square).

    Instead you handle your request with events; such as BlockPhysicsEvent, PlayerPortalEvent, etc. Almost every part of a portals functionality triggers events, so it's just a matter of identifying all of the different events associated with portals and disabling/re-purposing them... Personally the hardest part for me was to get the games default portal handler to F-off... It is very aggressive, and even when literally disabled will often perform it's function anyways...

    Don't be discouraged it's very doable, it just takes a bit of creative thinking and elbow grease compared to the average plugin. Check out a plug-in made by bergerkiller, he has a portal system that does something similar to my RiftCraft system, so you should be able to find some useful code samples from the source on GitHub; I'd provide you mine but sadly it's a close community project.

    Anyways, good luck with your project!
     
  5. Offline

    Paradox

    Haha, well my plugin would only be using this block as a nicety and normal portals would still need to function as normal so the effort to go through and set that all up isn't really worth the small improvement it would make in the functioning of my plugin.

    Thanks anyway!
     
Thread Status:
Not open for further replies.

Share This Page