Created
December 8, 2015 19:56
-
-
Save ryantheleach/b51c50f03eb4058ab714 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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