Fills up cauldrons with snow.
Fixes https://github.com/BentoBoxWorld/Greenhouses/issues/82
This commit is contained in:
parent
47bead9145
commit
354806c060
|
@ -16,6 +16,9 @@ import org.bukkit.event.weather.WeatherChangeEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import com.google.common.base.Enums;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
import world.bentobox.greenhouses.Greenhouses;
|
import world.bentobox.greenhouses.Greenhouses;
|
||||||
import world.bentobox.greenhouses.data.Greenhouse;
|
import world.bentobox.greenhouses.data.Greenhouse;
|
||||||
|
@ -65,7 +68,8 @@ public class SnowTracker implements Listener {
|
||||||
if (Math.random() < addon.getSettings().getSnowDensity()
|
if (Math.random() < addon.getSettings().getSnowDensity()
|
||||||
&& !b.isLiquid()
|
&& !b.isLiquid()
|
||||||
&& b.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
&& b.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||||
b.getRelative(BlockFace.UP).setType(Material.SNOW);
|
placeSnow(b);
|
||||||
|
|
||||||
createdSnow = true;
|
createdSnow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +90,15 @@ public class SnowTracker implements Listener {
|
||||||
return createdSnow;
|
return createdSnow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void placeSnow(Block b) {
|
||||||
|
Optional<Material> snowCauldron = Enums.getIfPresent(Material.class, "POWDER_SNOW_CAULDRON");
|
||||||
|
if (b.getType().equals(Material.CAULDRON) && snowCauldron.isPresent()) {
|
||||||
|
b.setType(snowCauldron.get());
|
||||||
|
} else {
|
||||||
|
b.getRelative(BlockFace.UP).setType(Material.SNOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO finish
|
* TODO finish
|
||||||
* @param e block form event
|
* @param e block form event
|
||||||
|
|
Loading…
Reference in New Issue