Added overloaded-alternative-method searchForMaterial

master
Ruakij 4 years ago
parent fdc17aad0f
commit 1ab17c1ab6

@ -7,10 +7,7 @@ import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.Arrays; import java.util.*;
import java.util.InvalidPropertiesFormatException;
import java.util.List;
import java.util.Random;
public class Function { public class Function {
public static String serialiseBlockLocation(Location loc){ public static String serialiseBlockLocation(Location loc){
@ -129,6 +126,9 @@ public class Function {
Material.STONE_SLAB, Material.STONE_SLAB,
Material.WARPED_SLAB Material.WARPED_SLAB
); );
public static Block searchForMaterial(Location startLoc, Vector searchDirection, Material searchMaterial){
return searchForMaterial(startLoc, searchDirection, searchMaterial, new ArrayList<>());
}
public static Block searchForMaterial(Location startLoc, Vector searchDirection, Material searchMaterial, List<Material> ignoreMaterials){ public static Block searchForMaterial(Location startLoc, Vector searchDirection, Material searchMaterial, List<Material> ignoreMaterials){
Location loc = new Location(startLoc.getWorld(), startLoc.getBlockX(), startLoc.getBlockY(), startLoc.getBlockZ()); Location loc = new Location(startLoc.getWorld(), startLoc.getBlockX(), startLoc.getBlockY(), startLoc.getBlockZ());
for(int i=0; loc.getBlockY()>=0 && loc.getBlockY()<=255; loc.add(searchDirection)){ for(int i=0; loc.getBlockY()>=0 && loc.getBlockY()<=255; loc.add(searchDirection)){

Loading…
Cancel
Save