-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve EntryClickedEvent and enable it on index mode categories
- Loading branch information
1 parent
b4704c3
commit cedc7b0
Showing
5 changed files
with
94 additions
and
30 deletions.
There are no files selected for viewing
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
36 changes: 36 additions & 0 deletions
36
common/src/main/java/com/klikli_dev/modonomicon/api/events/EntryFirstReadEvent.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-FileCopyrightText: 2024 klikli-dev | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
package com.klikli_dev.modonomicon.api.events; | ||
|
||
import com.klikli_dev.modonomicon.book.BookCommand; | ||
import com.klikli_dev.modonomicon.client.gui.book.entry.EntryDisplayState; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
/** | ||
* An event that is fired on both the client and server side, when an entry is read for the first time. | ||
* Note that resetting the book and then reading the entry again, will trigger this event again. | ||
* If you are e.g. awarding rewards based on this event you should save somewhere that the player already received the entry. | ||
* See e.g. {@link BookCommand#execute(ServerPlayer)} which stores how many times a command has been executed. | ||
*/ | ||
public class EntryFirstReadEvent extends ModonomiconEvent { | ||
protected ResourceLocation bookId; | ||
protected ResourceLocation entryId; | ||
|
||
public EntryFirstReadEvent(ResourceLocation bookId, ResourceLocation entryId) { | ||
super(false); | ||
|
||
this.bookId = bookId; | ||
this.entryId = entryId; | ||
} | ||
|
||
public ResourceLocation getBookId() { | ||
return this.bookId; | ||
} | ||
|
||
public ResourceLocation getEntryId() { | ||
return this.entryId; | ||
} | ||
} |
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
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
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