Custom paste system math

Discussion in 'Plugin Development' started by Lightspeed, Mar 28, 2016.

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

    Lightspeed

    Now I need to create a custom pasting system which I can do except for one thing.
    Im splitting a region into 4 parts to slowly build them all using seperate threads.
    I usally always think of everything that may happen before doing it and thought of "What would I do when theres unequal sections?"

    2016-03-29_01.12.54.png

    So if you look above you'll see an area marked out by glass with colours of wool inside.

    What I would like to do is use some math to figure out how to create a zipper like pattern to let both sides be created equally no one faster no one slower.

    I can easily create a flat all sides equal function but, I really need help or ideas on how to do this.

    >I can do math I just can't think of what to do to figure out the solution to get it<

    Any ideas?

    Edit: Of course this can't be all sides equal but, both opposite corners will be equal which is the best/what I can do.
     
  2. Offline

    mine-care

    That isn't going to work... Asynchronous block places are not allowed, and although you can bypass the feature that 'catches' them, it is not recomended because it may lead to chunk corruption...

    You can do that, by spliting the region in half, (x axis or z axis) and every time your loop or task runs, you will place one line of either side. So this will gradually build each side and they will look as if they are built the same time. That can be done synchronously, but it will (as with all block changes) cause server lag.
     
  3. Offline

    Lightspeed

    AHERM I mean seperate bukkit runnables AHEM im not doing any multithreadeding AHEM cause I don't know how to disable async catcher

    Anyway how do I disable the async catcher(For testing I'm not going to ruin my world `-`)

    Edit: 1 Thread bukkitrunnable AHEM AHEM
     
  4. Offline

    mine-care

    @Lightspeed Hehehehe :D
    Well do it, but keep a backup of your world fist.
    Its actually pretty simple, all you need to do is turn the boolean 'enabled' (which very conviniently is public static) to false. So "AsyncCatcher.enable = false;" will do. :p Do that onEnable or somewhere there.
     
  5. Offline

    Lightspeed

    @mine-care Ok well I now have another problem!
    I need to build from the center out equally too.

    So how will I build out keeping the zipper pattern that is possible to do with math.

    Maybe create a small gif following the shape of my example?

    Pixl by pixl gif different colors?
    Still possible to see tho.

    4 Blocks at a time.
    1 Block will be placed per section.
     
  6. Offline

    mine-care

    Well im not sure how to do that, but.. How about you get one dimention (the longest one) and you devide it by 2, (find the center) and then start placing blocks to the right and left equally. So:

    | <center
    ||<Line 1
    |||<Line 1 and 2.
    ||||<Line 3
    ....
     
  7. Offline

    Lightspeed

    @mine-care I got a video of what I would like done in a few mins.
    (Me replacing blocks to show the pattern I would like to be done with math.)

    Different block = new cycle(Ehh the 4 blocks placed per loop)

    @mine-care
    So heres the video that shows what I would like the code to do for me.
    Again different block = another cycle.



    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Mar 28, 2016
  8. Offline

    mine-care

    Hmm im not sure how that is possible, i had something completely different in mind :S
    I dont think i can help with that :(
     
  9. Offline

    mythbusterma

    @Lightspeed

    That isn't really a pattern it doesn't look like. Also, never disable the AysncCatcher. There's absolutely no reason to do it, and it's right. It wouldn't cause any lag at all to change blocks like that. You don't start running into issues with lag unless you're doing 10k+ blocks per tick.

    If you're going for the weird block shapes like that, you might be better off just hardcoding those blocks and their offsets.
     
  10. Offline

    Lightspeed

    @mythbusterma Theres a pattern thats the best I could come up with.

    I don't care about no lagg I just don't like the main thread freezing/I want it to building slowly.

    Hardcoding the offsets UMMMMMM This is a copy/paste system.

    The pattern is 4 blocks in a zigzag pattern then 4 blocks filling in the odd space repeat.

    NOTE: Odd blocks also in a zigzag pattern.

    So theres no math to do this with very small amount of code to figure out the position?
     
  11. Offline

    mythbusterma

    @Lightspeed

    Then use a repeating task. There's a schedule repeating task.

    So you want to cut and paste arbitrary regions of blocks?
     
  12. Offline

    Lightspeed

    @mythbusterma Yes I'm going to use a repeating task I just wanted to know how. :p

    Erm I guess yeas.

    Simply trying to make the pasting as even as possible.

    While keeping it 4 blocks 1 per each section. Simple enough eh?

    I just need the system to fill each section 1 block from the center out on an uneven region.

    EDIT>
    Very sorry mods for all the mutiple post instead of editing I've been on sites that don't allow edits after 5 mins.
    <EDIT

    Edit #1: New idea how do I have a cube region build diagnaly from 1 corner to another but, in a diagnal.

    I can use this and turn it into 4 if I just get a base idea on how.

    Edit #2: I got a new idea!
    I have the system I want above 1 region building in a diagnal but, every time it finished the diagnal it continue but build from the other direction.

    Any ideas?

    Should I simply have this
    reverse every time it's done?
     
    Last edited: Mar 29, 2016
Thread Status:
Not open for further replies.

Share This Page