Solved Look for block with x and z location and make circle

Discussion in 'Plugin Development' started by Dreeass, Jul 5, 2013.

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

    Dreeass

    What I'm trying to do is look for all of the blocks in a vertical line, if the block is the same as the given block, draw a circle. When the circleMaterial and circleCenterMaterial objects are null, use the material stored in the HashMap to reset back to the materials there were before.

    Code: click here. Here is the output.

    This is what I'm using to test with, what happens is that only the block I selected changes to the surroundBlock material. There is a lapis block in the middle of every floor.
    [​IMG]
    What happens is that it changes the first time but when it has to reset those circles, it only resets the center of every circle.
     
  2. Offline

    AmShaegar

    .distance() is very slow because of the square root. use
    Code:
    l.distanceSquared(location) <= radiusSquared
    with
    Code:
    radiusSquared = radius*radius;
     
  3. Offline

    Dreeass

    The server kicked me out but didn't crash this time.

    This is the output when it shuts down when I don't use your method:
    Code:
    06.07 09:20:54 [Server] SEVERE sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
    06.07 09:20:54 [Server] SEVERE sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    06.07 09:20:54 [Server] SEVERE Stack:
    06.07 09:20:54 [Server] SEVERE Locked on:sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    06.07 09:20:54 [Server] SEVERE Locked on:sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    06.07 09:20:54 [Server] SEVERE Locked on:sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    06.07 09:20:54 [Server] SEVERE Thread is waiting on monitor(s):
    06.07 09:20:54 [Server] SEVERE PID: 20 | Suspended: false | Native: true | State: RUNNABLE
    06.07 09:20:54 [Server] SEVERE Current Thread: Netty IO Thread - 2
    06.07 09:20:54 [Server] SEVERE ------------------------------
    06.07 09:20:54 [Server] SEVERE Current Thread State:
    06.07 09:20:54 [Server] SEVERE Spigot version: git-Spigot-979 (MC: 1.6.1)
    06.07 09:20:54 [Server] SEVERE Be sure to include ALL relevant console errors and Minecraft crash reports
    06.07 09:20:54 [Server] SEVERE Please report this to http://www.spigotmc.org/
    06.07 09:20:54 [Server] SEVERE The server has stopped responding!
    
    I just rewrote the whole thing and added debug, I really don't know why it's not changing the blocks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  4. Offline

    Dreeass

    Anyone? I still can't figure it out.
     
  5. do you want a circle or a sphere? I haven't read all of your code yet, but this came to mind.
     
  6. Offline

    Dreeass

    I want a circle on the same level as the block given in in the void method. It looks for every block on those x and z coordinates and draws a circle around the block that has been found every time.

    Edit: I have added a lot of comments to help you get through the code
    Edit2: I have added the whole class.
    Edit3: Solved, but another bug has appeared. See thread.
     
Thread Status:
Not open for further replies.

Share This Page