Spawning Falling Sand Without Rounding Coordinates

Discussion in 'Plugin Development' started by monster860, Jun 29, 2014.

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

    monster860

    I'm trying to spawn falling sand blocks with a time of 0. I have falling sand spawning, but the problem is that it "snaps" the coordinates to the block it's in when it spawns. Everything else is working except this problem.
    Code:
    private FallingBlock spawnInvalidFallingBlock(Location location, Material material, byte data) {
                FallingBlock fb = plugin.getServer().getWorld(world).spawnFallingBlock(location, material, data);
                ((CraftFallingSand)fb).getHandle().b = 0;
                fb.teleport(location);
                return fb;
               
            }
    public void run() {
                timer++;
                if (timer > 200) {
                    this.cancel();
                }
                if (timer == 0) plugin.getServer().broadcastMessage("Showing HG ANIM");
                double entx = x+0.5;
                double enty = y-0.5+(((float)timer)*.015);
                double entz = z+0.5;
                World w = plugin.getServer().getWorld(world);
                spawnInvalidFallingBlock(new Location(w,entx  ,enty,entz  ), Material.GLOWSTONE, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx-1,enty,entz-1),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx-1,enty,entz  ),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx-1,enty,entz+1),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx  ,enty,entz+1),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx+1,enty,entz+1),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx+1,enty,entz  ),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx+1,enty,entz-1),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
                spawnInvalidFallingBlock(new Location(w,entx  ,enty,entz-1),  Material.OBSIDIAN, (byte)0).setVelocity(new Vector(0d,0.415d,0d));
               
            }
     
Thread Status:
Not open for further replies.

Share This Page