Ok, so in der Erstellung eines Plugins für Minecraft, fand ich ein Problem, das ich nicht in der Lage zu überwinden scheinen. Das Problem ist also, dass ich die Position des platzierten Diamantblocks bekommen möchte, damit ich den Block für andere Blöcke überprüfen kann. Ich möchte ein automatisiertes Farming-Plugin erstellen.
‚Bis jetzt habe ich versucht, es mit
Wie Blockposition von BlockEvent in Minecraft bekommen - Spigot
public void OnDiaBlockPlace(BlockPlaceEvent e){
Block b = e.getBlock();
b.getPosition();
}
und mit
public void onPlantGrow(BlockGrowEvent e){
Block b = e.getBlock();
b.getPosition();
}
Aber die b.getPosition();
nicht in Zapfen/CraftBukkit API existieren zu tun.
Ich möchte nur wissen, ob es ein Problem gibt und wie ich das lösen könnte.
TL/DR: Wie kann ich eine Blockposition vom BlockPlaceEvent oder BlockGrowEvent in einem x, y, z Format erhalten?
Vielen Dank an alle im Voraus.
EDIT: Arbeits Stück Code:
public void onPlantGrow(BlockGrowEvent e){
Block b = e.getBlock();
int x = b.getLocation().getBlockX();
int y = b.getLocation().getBlockY();
int z = b.getLocation().getBlockZ();
}
Versuchen 'Ort blockLocation = b.getLocation()', die in 'RegionCoordinates.fromLocation gedreht werden und kann (blockLocation) '. – dly
Können Sie Ihren Kommentar in eine Antwort umwandeln, damit ich sie akzeptieren kann? –
in Ordnung ... fertig – dly