MinecraftForge icon indicating copy to clipboard operation
MinecraftForge copied to clipboard

WorldInfo.setDifficulty(EnumDifficulty newDifficulty) event

Open wshadow opened this issue 10 years ago • 7 comments

Currently I don't see a way to detect when the game difficulty is changed (besides polling every tick). To change the difficulty setting, the WorldInfo.setDifficulty(EnumDifficulty newDifficulty) is called. Would it be possible to add an event that is fired every time the difficulty is changed with that method?

Why do I want this? My idea was to add the current difficulty as a 'task' to the BetterQuesting mod. With this I'd be able to react to the (currently) set difficulty level and offer different quests/rewards based on that. Making use of dynamically changing difficulty in the same adventure map would also be possible (hard dungeon, peaceful town center).

wshadow avatar Jul 13 '16 17:07 wshadow

@williewillus added labels [Feature]

Actuarius avatar Jul 23 '16 14:07 Actuarius

PR sent #3525

0f-0b avatar Oct 02 '16 04:10 0f-0b

@mezz For #3525, is this use case a good one? Or @sjx233 would not send a pull request for this.

liach avatar Dec 10 '16 05:12 liach

@liach this is a good use-case, and the part of the PR that supports this case is good. The part of the PR that is not good: changing the difficulty using the event.

mezz avatar Dec 10 '16 05:12 mezz

The use case for changing difficulty, e.g. during a task in an RPG-style modification, you cannot change difficulty during the task; if you change, you are likely to receive a punishment--an increased difficulty. You can only change after you have done the task.

liach avatar Dec 10 '16 05:12 liach

Ok that's a better use-case. Can you write that in the PR discussion?

mezz avatar Dec 10 '16 05:12 mezz

https://github.com/MinecraftForge/MinecraftForge/pull/3525

LexManos avatar Feb 24 '17 02:02 LexManos