-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add xpCostsFullLevels option to charge xp points instead of lev…
…els #412
- Loading branch information
1 parent
33b6e74
commit cec87a4
Showing
13 changed files
with
265 additions
and
40 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
54 changes: 54 additions & 0 deletions
54
shared/src/main/java/net/blay09/mods/waystones/api/ExperienceCost.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,54 @@ | ||
package net.blay09.mods.waystones.api; | ||
|
||
import net.blay09.mods.waystones.xp.ExperienceLevelCost; | ||
import net.blay09.mods.waystones.xp.ExperiencePointsCost; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
public interface ExperienceCost { | ||
boolean canAfford(Player player); | ||
|
||
void consume(Player player); | ||
|
||
int getCostAsLevels(Player player); | ||
|
||
Component getCostAsTooltip(Player player); | ||
|
||
boolean isEmpty(); | ||
|
||
static ExperienceCost fromLevels(int levels) { | ||
return new ExperienceLevelCost(levels); | ||
} | ||
|
||
static ExperienceCost fromExperience(int experience) { | ||
return new ExperiencePointsCost(experience); | ||
} | ||
|
||
class NoExperienceCost implements ExperienceCost { | ||
public static final ExperienceCost INSTANCE = new NoExperienceCost(); | ||
|
||
@Override | ||
public boolean canAfford(Player player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void consume(Player player) { | ||
} | ||
|
||
@Override | ||
public int getCostAsLevels(Player player) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public Component getCostAsTooltip(Player player) { | ||
return Component.translatable("gui.waystones.waystone_selection.no_xp_requirement"); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return true; | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.