[FIX/MECH] BananaPortal 0.1 - create bigger, funkier nether portals [860]

Discussion in 'WIP and Development Status' started by codename_B, Jun 15, 2011.

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

    codename_B

    BananaPortal 0.1
    create bigger, funkier nether portals


    Download Link: Here
    Version: 0.1
    How to use: Just create a larger than normal portal and light the middle with flint+steel!

    Contributors: Fright01

    What works:
    • Creating the portal
    • The blocks placing
    • Using the portal
    What needs testing:
    • Wierder and whackier portal shapes
    • Lighting portals with fire (ID:51) doesn't work (yet)
    • Just more testing in general
    Why you should test for me: Anyone who helps me get this plugin ready for release will have their name mentioned under "Contributors" in the final plugin release. Also, any code feedback is more than welcome.

    [​IMG]

    Changelog:
    • 0.1 - 15/06/2011 - released to the wip-and-development forum
     
    jtjj222 likes this.
  2. Offline

    VGFreak97

  3. Offline

    codename_B

    Woot screenshots :)
     
  4. Offline

    MineDev

    im testing it right now :D

    the one on the right doesnt work! :(
    View attachment 4013

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  5. Offline

    codename_B

    That would be because it's only one block thick, portals don't work when they're only one block thick! double the thickness :) like the width.

    Minimum size is 2x2.
     
  6. Offline

    fffizzz

    any chance of adding config option to where the portal would lead and even some group whitelists per portal? :D
     
  7. Offline

    codename_B

    I believe that would be another plugin - this plugin only handles the creation of the portal in a non-normal shaped environment.
     
  8. Offline

    fffizzz

    I could hope anyway. MultiVerse author has been MIA for a while.. player whitelists broken for a couple builds..
    cool plugin none-the-less :D
     
  9. Offline

    iPhysX

    It makes things like this possible :)
    portallll.gif

    Stupid gif.
    But still..
     
  10. Offline

    codename_B

    I can't see that :( Can you upload it to tinypic?
     
  11. Offline

    Lolmewn

    This looks quite cool :p
     
  12. Offline

    iPhysX

    sure ill upload it to tinypic in a few mins :p

    http://i54.tinypic.com/2rpvd47.png

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  13. Offline

    codename_B

    iPhysX likes this.
  14. Offline

    iPhysX

    I did cheat (and use a schematic).. But its still Awesome!
    :3
     
  15. Offline

    VGFreak97

    I made a video, it's almost uploaded
     
  16. Offline

    codename_B

    Noice :D I look forward to seeing it.
     
  17. Offline

    VGFreak97

  18. Offline

    bill45

    Tested out your plugin and it works pretty well. I just told the admins of my server to have a go at making 2 random shapes and they did. Last shape almost worked but we really wanted to make the Luigi symbol so, two missing nether portal blocks aren't bad knowing there was a shape in the middle of it.
    Random huge portal test
    Random shape 1
    Luigi symbol
     
  19. Offline

    jeffadkins51

    Looks great man! Keep it up!
     
  20. Offline

    Telgar

    Well. I looked at your decompiled source to see how you made the portal blocks, and I cant figure out how you collect their locations or why you did it that way, whatever it is. I am working on a variable size portal plugin and the part I cant get working is the creation of the portal blocks. Are you still working on this?

    EDIT: Oh. You block the physics event. I found your thread asking that question. Anyway, your method of filling the portal area is confusing. Have you thought about switching to recursive?
     
  21. Offline

    codename_B

    If I knew how :p
     
  22. Offline

    Telgar

    This is much more confusing out of eclipse. But these are the two methods I use to fill a HashMap with the air blocks out to a border, from a starting block. I also fill a hashset with the border blocks. This is much more confusing than it was originally because I had to do weird stuff to Serialize my Gate object for file storage.
    Basically, it fills twice, once in each direction (North to South and East to West) out to either a border of non-Air or the size limit then takes the smaller of the two. The recursive part passes the HashMap down each time, adds the nodeBlock if it is Air and is not already in the set, then runs the method again for each block around the nodeBlock. And finally, sorry if this makes no sense. I wrote it because I like recursion (it is elegant and efficient).

    These are two arrays that store the four BlockFace directions that the method iterates through to efficiently check all the blocks around the nodeBlock:
    private static BlockFace[] EWdir = { BlockFace.UP, BlockFace.DOWN,
    BlockFace.EAST, BlockFace.WEST };
    private static BlockFace[] NSdir = { BlockFace.UP, BlockFace.DOWN,
    BlockFace.NORTH, BlockFace.SOUTH };

    Code:
    private static HashMap<Location, Integer> findPortalBlocks(PortalGate gate) {
    
            Set<Block> EWBorder = new HashSet<Block>();
            Set<Block> NSBorder = new HashSet<Block>();
            HashMap<Location, Integer> EWBlocks = fillPortalBlocks(gate.loc()
                    .getBlock(), new HashMap<Location, Integer>(), EWdir, gate,
                    EWBorder);
            HashMap<Location, Integer> NSBlocks = fillPortalBlocks(gate.loc()
                    .getBlock(), new HashMap<Location, Integer>(), NSdir, gate,
                    NSBorder);
            if (EWBlocks == null && NSBlocks == null)
                return null;
            if (EWBlocks == null) {
                gate.gateDir = NSdir;
                gate.borderBlocks(NSBorder);
                return NSBlocks;
            }
            if (NSBlocks == null) {
                gate.gateDir = EWdir;
                gate.borderBlocks(EWBorder);
                return EWBlocks;
            }
    //The smaller HashMap must be the portal area
            if (NSBlocks.size() < EWBlocks.size()) {
                gate.gateDir = NSdir;
                gate.borderBlocks(NSBorder);
                return NSBlocks;
            } else {
                gate.gateDir = EWdir;
                gate.borderBlocks(EWBorder);
                return EWBlocks;
            }
        }
        private static HashMap<Location, Integer> fillPortalBlocks(Block nodeBlock,
                HashMap<Location, Integer> hashMap, BlockFace[] dir,
                PortalGate gate, Set<Block> border) {
            if (hashMap == null || hashMap.size() > MAXSIZE)
                return null;
    //Adds the nodeBlock if it is Air, Portal, or the starting point, which I added since mine starts with a sign
    
            if (nodeBlock.getType() == Material.AIR
                    || nodeBlock.getLocation().equals(gate.loc())
                    || nodeBlock.getType() == Material.PORTAL) {
                if (!hashMap.containsKey(nodeBlock.getLocation())) {
                    hashMap.put(nodeBlock.getLocation(), new Integer(-1));
    //Iterates through the direction array containing the faces around the nodeBlock
                    for (BlockFace face : dir) {
                        hashMap = fillPortalBlocks(nodeBlock.getFace(face),
                                hashMap, dir, gate, border);
                    }
                } else
                    return hashMap;
            } else
                border.add(nodeBlock);
            return hashMap;
        }
     
  23. Offline

    DietrichXD

    wow this looks cool!
     
  24. Offline

    codename_B

    So how does that check for a complete obsidian ring?
     
  25. Offline

    Telgar

    Ooooh good point, mine does not do that right now. But, it does collect a Set of all the blocks on the border (it adds the nonair blocks to the borderBlocks Set, but does not search the blocks around them for air, thus limiting the recursion) so you could check to make sure they are all obsidian.
     
  26. Offline

    codename_B

    Hmmm, I'll give it a bash.
     
  27. Offline

    VGFreak97

    @codename_B Why isn't my video in the OP D:
     
  28. Offline

    codename_B

    You realise this is the dev post and there's an actual plugin release post? XD
     
  29. Offline

    FireFreak111

    Awesome work, nice job
     
  30. Offline

    Suembeaux

    any way to make a portal without it actually functioning as a portal?
     
Thread Status:
Not open for further replies.

Share This Page