mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-12-25 18:47:56 +01:00
Attempt to handle WildStacker spawners
This commit is contained in:
parent
a3d06ee41a
commit
336e8d47bf
@ -27,6 +27,7 @@ import org.bukkit.World.Environment;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.block.Container;
|
||||||
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.type.Slab;
|
import org.bukkit.block.data.type.Slab;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -443,8 +444,8 @@ public class IslandLevelCalculator {
|
|||||||
checkBlock(blockData.getMaterial(), belowSeaLevel);
|
checkBlock(blockData.getMaterial(), belowSeaLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Hook for Wild Stackers (Blocks Only) - this has to use the real chunk
|
// Hook for Wild Stackers (Blocks and Spawners Only) - this has to use the real chunk
|
||||||
if (addon.isStackersEnabled() && blockData.getMaterial() == Material.CAULDRON) {
|
if (addon.isStackersEnabled() && (blockData.getMaterial().equals(Material.CAULDRON) || blockData.getMaterial().equals(Material.SPAWNER))) {
|
||||||
stackedBlocks.add(new Location(chunk.getWorld(), x + chunkSnapshot.getX() * 16,y,z + chunkSnapshot.getZ() * 16));
|
stackedBlocks.add(new Location(chunk.getWorld(), x + chunkSnapshot.getX() * 16,y,z + chunkSnapshot.getZ() * 16));
|
||||||
}
|
}
|
||||||
// Scan chests
|
// Scan chests
|
||||||
@ -678,14 +679,19 @@ public class IslandLevelCalculator {
|
|||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Location v = it.next();
|
Location v = it.next();
|
||||||
Util.getChunkAtAsync(v).thenAccept(c -> {
|
Util.getChunkAtAsync(v).thenAccept(c -> {
|
||||||
Block cauldronBlock = v.getBlock();
|
Block stackedBlock = v.getBlock();
|
||||||
boolean belowSeaLevel = seaHeight > 0 && v.getBlockY() <= seaHeight;
|
boolean belowSeaLevel = seaHeight > 0 && v.getBlockY() <= seaHeight;
|
||||||
if (WildStackerAPI.getWildStacker().getSystemManager().isStackedBarrel(cauldronBlock)) {
|
if (WildStackerAPI.getWildStacker().getSystemManager().isStackedBarrel(stackedBlock)) {
|
||||||
StackedBarrel barrel = WildStackerAPI.getStackedBarrel(cauldronBlock);
|
StackedBarrel barrel = WildStackerAPI.getStackedBarrel(stackedBlock);
|
||||||
int barrelAmt = WildStackerAPI.getBarrelAmount(cauldronBlock);
|
int barrelAmt = WildStackerAPI.getBarrelAmount(stackedBlock);
|
||||||
for (int _x = 0; _x < barrelAmt; _x++) {
|
for (int _x = 0; _x < barrelAmt; _x++) {
|
||||||
checkBlock(barrel.getType(), belowSeaLevel);
|
checkBlock(barrel.getType(), belowSeaLevel);
|
||||||
}
|
}
|
||||||
|
} else if (WildStackerAPI.getWildStacker().getSystemManager().isStackedSpawner(stackedBlock)) {
|
||||||
|
int spawnerAmt = WildStackerAPI.getSpawnersAmount((CreatureSpawner) stackedBlock.getState());
|
||||||
|
for (int _x = 0; _x < spawnerAmt; _x++) {
|
||||||
|
checkBlock(stackedBlock.getType(), belowSeaLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
it.remove();
|
it.remove();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user