Help, player.sendBlockChange() not working.

Status
This thread has been locked.

King Archie

Java Software Development
Banned
Feedback score
6
Posts
168
Reactions
45
Resources
0
Hi, so my aim is to send a block change of a pillar to the player, here is the code;

Location loc = new Location(player.getWorld(), coord.getX(), coord.getZ(), player.getLocation().getY());
for (int y = (int) loc.getY(); y < loc.getWorld().getMaxHeight(); y++) {
if (loc.getBlock().getType() != Material.AIR) {
continue;
}

player.sendBlockChange(loc, 113, (byte) 0);
loc.add(0, 1, 0);
}
It isn't working.

Any ideas?
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

NoReach__

Feedback score
0
Posts
58
Reactions
16
Resources
0
Look up how to form a location object. It is done via new Location(world, x, y, z); not whatever way u did it
 

King Archie

Java Software Development
Banned
Feedback score
6
Posts
168
Reactions
45
Resources
0
Look up how to form a location object. It is done via new Location(world, x, y, z); not whatever way u did it
I did it that way.. duh??
 
Banned forever. Reason: Ban Evading (Archie, https://builtbybit.com/members/archie.15314/)

NoReach__

Feedback score
0
Posts
58
Reactions
16
Resources
0
I did it that way.. duh??
No you didnt, this is how you did it `Location loc = new Location(player.getWorld(), coord.getX(), coord.getZ(), player.getLocation().getY());`.

You did, new Location(world, x, z, y);
 

King Archie

Java Software Development
Banned
Feedback score
6
Posts
168
Reactions
45
Resources
0
No you didnt, this is how you did it `Location loc = new Location(player.getWorld(), coord.getX(), coord.getZ(), player.getLocation().getY());`.

You did, new Location(world, x, z, y);
Those are both the same method. What are you trying to say?
 
Banned forever. Reason: Ban Evading (Archie, https://builtbybit.com/members/archie.15314/)

King Archie

Java Software Development
Banned
Feedback score
6
Posts
168
Reactions
45
Resources
0
No their not.... Read it. You put in the location constructor (world, x, z, y) and it is meant to be (world, x, y, z)

http://prntscr.com/gtov5x
Sorry, you're right. However, that code is old, the new code is :

public void sendPillar(Player player, String world) {
Location loc = new Location(Bukkit.getWorld(world), x, 0, z);
for (int y = (int) loc.getY(); y < loc.getWorld().getMaxHeight() + 1; y++) {
if (loc.getBlock().getType() != Material.AIR) {
System.out.println("Debug 1");
continue;
}

System.out.print(1);
player.sendBlockChange(loc, Material.GLASS, (byte) Material.GLASS.getId());
loc.add(0, 1, 0);
}
}
 
Banned forever. Reason: Ban Evading (Archie, https://builtbybit.com/members/archie.15314/)

NoReach__

Feedback score
0
Posts
58
Reactions
16
Resources
0
1. Don't cast loc.getY() to an int, just use loc.getBlockY().
2. You dont need to put for the sendBlockChange method the `Material.GLASS.getId()` just put `(byte) 0)

Try those

Did it work??
 
Last edited:

Wouterg

Premium
Feedback score
15
Posts
108
Reactions
60
Resources
1
Status
This thread has been locked.
Top