1.15.2 Two questions regarding nether portals API

Discussion in 'Spigot Plugin Development' started by LEOcab, Jan 10, 2020.

  1. Hey guys, I'm working with portals over here. Most of my code is working fine (mostly thanks to you people!) now, but there are just a couple details I could improve upon.

    Question 1:
    I have a custom portal that uses a different block than obsidian. When the portal is placed along the Z axis, the portal blocks all face the wrong direction (although they still work). Is there any way to flip them? I did some research and the consensus is no, but I figured it was worth asking. I mean, regular portals can do it so...

    Question 2: Is there any way to hook into the portal placer algorithm? Like when I use a brand new nether portal and it creates a portal in the nether, I would like to borrow the algorithm that picks the nether-side portal's location. I made my own that gets the job done, but I'd rather borrow what's already there if at all possible with the API. Both my worlds are non-nether so that may or may not work.

    Thanks in advance!
  2. q1: this is how i light custom portals. this is a bit outdated code so some things might need to be changed but the general principle is there
    Code (Java):
    public boolean light() {
        if(!isFrameConstructed()) return false;
        if(isLit()) return true;
        portalBlocks.forEach(block -> {
            Orientable data = (Orientable)block.getBlockData();
            block.getWorld().getPlayers().forEach(player -> player.sendBlockChange(block.getLocation(), data));
        return true;
    q2: idk about hooking into whats already there. i doubt it would go as easy as youre hoping. creating your own is good enough.