Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//https://www.reddit.com/r/minecraftsuggestions/comments/3d5l3p/jumping_into_water_while_on_fire_plays_a/
@Listener(order = Order.POST)
public void onPlayerExtinguish(final IgniteEntityEvent event) {
logger.log(Level.WARNING, "Entity Ignited: "+event.getTargetEntity());
int ticksToGo = event.getFireTicks();
Entity entity = event.getTargetEntity();
Sponge.getScheduler().createTaskBuilder()
.intervalTicks(1)
.execute(task -> trackFireEntities(task, entity))
.submit(this);
}
final static Set<BlockType> WATER = Sets.newHashSet(BlockTypes.FLOWING_WATER, BlockTypes.WATER);
public void trackFireEntities(final Task task, final Entity entity){
boolean onFireStill = entity.get(Keys.IS_AFLAME).get();
if(!onFireStill){
logger.log(Level.WARNING, "Extinguished");
task.cancel();
Location<World> location = entity.getLocation();
//if(WATER.contains(location.getBlockType())){
location.getExtent().playSound(SoundTypes.FIZZ, location.getPosition(), 2);
location.getExtent().playSound(SoundTypes.FIZZ, location.getPosition(), 2);
location.getExtent().playSound(SoundTypes.FIZZ, location.getPosition(), 2);
location.getExtent().playSound(SoundTypes.FIZZ, location.getPosition(), 2);
//}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment