Problem with block data

Discussion in 'Plugin Development' started by EeZeeRo, Apr 12, 2021.

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

    EeZeeRo

    Hello, I need some help. I tried to find information in Google, but I didn't find it. How do I set the "Age" value for the "End_gateway" block ?
    This doesn't work (Lights up gray):
    Code:
    Location loc = new Location(world, bx, by, bz);
    loc.getBlock().setType(Material.END_GATEWAY);
    world.getBlockAt(loc).setData((Age) 5000);
     
  2. Offline

    davidclue

    Sorry, I've never used this but what is the age supposed to do?
     
  3. Offline

    EeZeeRo

    At the End Gateway, the ray disappears after a while, and "Age" should increase the "life" time of this ray.
     
  4. Offline

    davidclue

    I read the docs here and it seems that to make the beam light up magenta you need to set the age to <=200 ticks. If you set the age to a multiple of 2400 ticks it will make the beam light up purple.
     
    EeZeeRo likes this.
  5. Offline

    EeZeeRo

    Do you know if I'm using this part of the code correctly?
    Code:
    world.getBlockAt(loc).setData((Age) 2400);
    Eclipse highlights this part of the code in gray

    I use this code

    Code:
    Location loc = new Location(world, bx, by, bz);
                loc.getBlock().setType(Material.END_GATEWAY);
                Block block = world.getBlockAt(loc);
                Ageable ageable = (Ageable) block;
                ageable.setAge(2400);
    And this don't give some results.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 13, 2021
  6. Offline

    davidclue

    Code:
    import org.bukkit.block.EndGateway;
    
    ((EndGateway) world.getBlockAt(loc).getState()).setAge(200);
    I haven't tested this but I believe it should work, lmk if it doesn't.
     
    Last edited: Apr 13, 2021
Thread Status:
Not open for further replies.

Share This Page