Cuboid

Discussion in 'Plugin Development' started by TerroDoor, Dec 6, 2019.

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

    TerroDoor

    In my cuboid I have min and max variables for the Math.min and Math.max of my XYZ cords

    I only want to change blocks on the MIN Y and create a outline of the X and Z for the Min Y, basically a platform with an outline of my cube...

    I can’t seem to fix this any tips?


    Sent from my iPhone using Tapatalk
     
  2. Offline

    timtower Moderator Moderator

    @TerroDoor Do you want to show the edges or the walls?
     
  3. Offline

    TerroDoor

    No, the rest of the cube I’m trying to keep as air


    Sent from my iPhone using Tapatalk
     
  4. Offline

    timtower Moderator Moderator

    It was a multiple choice question.
    Can you make a drawing?
     
  5. Offline

    TerroDoor

    Okay so here’s the best way I can explain

    If we were looking at this cube from Birdseye view, keeping in mind that I have two locations, loc1 and loc2.

    loc1 has a Y of 0 and
    loc2 has a Y of 20

    Here’s how I want it to look for the Y of 0:

    XXXXX
    XOOOX
    XOOOX
    XOOOX
    XXXXX

    so for this 3D cube, the X marks the border of GLASS and the O marks the platform(glow stone)


    Sent from my iPhone using Tapatalk

    @timtower

    I only want the platform one block high, so basically a platform on Y 0


    Sent from my iPhone using Tapatalk

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  6. Offline

    timtower Moderator Moderator

    @TerroDoor Start by making a loop that fills the entire platform and post that code.
     
  7. Offline

    TerroDoor

    Here’s what I got

    Code:
    For x = minx; x <= max; x++){
       For y = miny <= maxy; y++){
           For z = minz; z <= maxi; z++){
    
    So now I got all the cords inside this cube and I create a new loc with my new variables

    Loc loc = new loc(w x y z)

    Now to check the y

    If (y == miny) {

    Loc.getblock.settype(glowstone)

    Which works, but I can’t seem to create the outline of glass


    Sent from my iPhone using Tapatalk
     
  8. Offline

    timtower Moderator Moderator

    @TerroDoor Why the y loop at all? For a floor you don't need it.
    What are the conditions for the outline?

    And please post actual code that you can test. Makes it a lot easier.
     
  9. Offline

    TerroDoor

    Well if I don’t loop the Y the players cuboid won’t be between 0 and 20, I need to have the player in the cuboid so they can’t tale damage, sorry I’m not with my laptop but this problem has been bugging me all night


    Sent from my iPhone using Tapatalk
     
  10. Offline

    timtower Moderator Moderator

    @TerroDoor So you want the glass around the entire thing? On all 12 edges?
     
  11. Offline

    TerroDoor

    Only on Y 0,

    would I get the
    miny,
    min and max X and
    min, max Z?
    Correct me if I’m wrong


    Sent from my iPhone using Tapatalk
     
  12. Offline

    timtower Moderator Moderator

    @TerroDoor That is correct.
    That is the only information that you need for the platform.
     
  13. Offline

    TerroDoor

    But the way I’ve been constructing it has it making walls around the edge, I only want it on Y 0


    Sent from my iPhone using Tapatalk

    How can I properly construct this


    Sent from my iPhone using Tapatalk

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 6, 2019
  14. Offline

    timtower Moderator Moderator

  15. Offline

    TerroDoor

    Following my above code I’m using this if statement

    If (y == miny && x == minx || x == max && z == minz || z == maxi) {

    Loc.getBlock().setType(Material.GLASS):

    }


    Sent from my iPhone using Tapatalk
     
  16. Offline

    timtower Moderator Moderator

    @TerroDoor Add brackets around the x checks and the z checks
     
    TerroDoor likes this.
  17. Offline

    TerroDoor

    Thanks Tim I will get back to you shortly, I appreciate your time!


    Sent from my iPhone using Tapatalk

    @timtower I switched the && and the || and have gotten it to work, although it’s filling the entire minY, how would I hollow the inside blocks?


    Sent from my iPhone using Tapatalk

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 6, 2019
  18. Offline

    timtower Moderator Moderator

    @TerroDoor Code? And you didn't have to switch them. I said brackets.
     
  19. Offline

    TerroDoor

    Sorry I mis worded my sentence, I switched the && and || and added brackets.

    Here’s the code

    Code:
    If (y == miny && (x == minx || x == maxx) && (z == minz || z == maxx)) { 
    
    Loc.setblock glass
    }
    
    I fiddled with it again before posting so let me explain what’s happening above.

    It’s placing a glass block only on each corner, not the entire perimeter?




    Sent from my iPhone using Tapatalk
     
  20. Offline

    timtower Moderator Moderator

  21. Offline

    TerroDoor

    Copied from my phone off laptop(I’m poor af so I have a fossil as a computer). It’s correct format on my laptop however.


    Sent from my iPhone using Tapatalk

    @timtower

    Solved, Thankyou pal!!

    Here’s what I did

    Code:
    
    If (y == miny) {
    //now we know for sure it’s y0
    
    If (x == minx || x == maxx || z == minz || z == maxz){
    
    Loc.set glass
    
    

    Sent from my iPhone using Tapatalk

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 6, 2019
Thread Status:
Not open for further replies.

Share This Page