Amorphous Portal Frame Validation

Discussion in 'Programming' started by VergilPrime, Nov 7, 2018.

  1. I am trying to write some logic to detect a proper portal gate frame. The rules are:
    1. the frame must be made of one kind of block (from a list of blocks but that comes later)
    2. the inside of the frame must be AIR or CAVE_AIR only.

    I am sort of ripping off DinnerBone's Stargates plugin so the starting point will be upon editing a sign up against the frame. It's easy enough to select a starting point, but if I want the shape of the gates to be completely up to the player creating them, I need some crazy logic to detect the outer bounds of the gate for validation, and then some more crazy logic to search only the inside of the gate for air.

    I am writing this in MethodScript for use with CommandHelper, I do have some understanding of Java though so I can probably translate ideas written with Java in mind.
     
  2. If the block materials are defined eg end stone or whatever and they have to be connected then just use block#getRelative(BlockFace) and just loop through the values of BlockFace. Add the blocks to a list to see if they’ve been parsed already once you make a complete loop you know you’ve got a valid portal


    Sent from my iPhone using Tapatalk