mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Most events in Forge are not designed to be extended by mod devs but technically allowed it before this PR, leading to a risk of unintentional breaking changes for those that do. If you need to extend a Forge event, please let us know so that we can explicitly support that and design it with extending in mind. Note that this change does not affect making your own events that directly extend from EventBus' `Event` class.
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
/*
|
|
* Copyright (c) Forge Development LLC and contributors
|
|
* SPDX-License-Identifier: LGPL-2.1-only
|
|
*/
|
|
|
|
package net.minecraftforge.event;
|
|
|
|
import net.minecraft.world.Difficulty;
|
|
import net.minecraftforge.common.ForgeHooks;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.eventbus.api.Event;
|
|
|
|
/**
|
|
* DifficultyChangeEvent is fired when difficulty is changing. <br>
|
|
* <br>
|
|
* This event is fired via the {@link ForgeHooks#onDifficultyChange(Difficulty, Difficulty)}.<br>
|
|
* <br>
|
|
* This event does not have a result. {@link HasResult}<br>
|
|
* <br>
|
|
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
|
**/
|
|
public final class DifficultyChangeEvent extends Event {
|
|
private final Difficulty difficulty;
|
|
private final Difficulty oldDifficulty;
|
|
|
|
public DifficultyChangeEvent(Difficulty difficulty, Difficulty oldDifficulty) {
|
|
this.difficulty = difficulty;
|
|
this.oldDifficulty = oldDifficulty;
|
|
}
|
|
|
|
public Difficulty getDifficulty() {
|
|
return difficulty;
|
|
}
|
|
|
|
public Difficulty getOldDifficulty() {
|
|
return oldDifficulty;
|
|
}
|
|
}
|