Thread: PI Mithril Seeds

Results 1 to 3 of 3
  1. #1 PI Mithril Seeds 
    Registered Member
    Join Date
    Jun 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    How do you make it to where you can't plant over another flower?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jun 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    bump
    Reply With Quote  
     

  3. #3  
    Banned PI Mithril Seeds Market Banned


    Join Date
    Jan 2011
    Age
    26
    Posts
    3,112
    Thanks given
    1,198
    Thanks received
    1,479
    Rep Power
    0
    create a cache of positions then check the cache to see if it contains the position the player wants to plant over

    Code:
    // We use a set because a set cannot contain duplicate elements.
    private static final Set<Position> FLOWERS = new HashSet<>();
    
    // Planting a flower.
    public void addFlower(Flower flower) {
        if(!canPlant(flower.getPosition()))
            return;
        ...
        ...
        FLOWERS.add(flower.getPosition());
    }
    
    // Removing a planted flower.
    public void removeFlower(Flower flower) {
        ...
        ...
        FLOWERS.remove(flower.getPosition());
    }
    
    // Determining if the flower can be planted on 'position'.
    public boolean canPlant(Position position) {
        return !FLOWERS.contains(position);
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Mithril Seeds - Flowers
    By The Reason in forum Snippets
    Replies: 9
    Last Post: 06-27-2015, 07:39 PM
  2. PI - Mithril Seeds Not Showing
    By Chief Sosa in forum Help
    Replies: 6
    Last Post: 02-17-2014, 12:52 AM
  3. [Emulous/PI] Mithril Seeds/Flower game
    By Blaketon in forum Tutorials
    Replies: 6
    Last Post: 05-07-2012, 08:39 PM
  4. [Impact/Pi] Mithril Seeds
    By Linus in forum Snippets
    Replies: 30
    Last Post: 12-13-2011, 01:00 AM
  5. Replies: 5
    Last Post: 11-14-2011, 09:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •