-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
huge refactoring for easy to use API #24 and undergarden support
- still needs testing before release
- Loading branch information
Showing
59 changed files
with
1,440 additions
and
1,188 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
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 was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
common/src/main/java/terrails/colorfulhearts/api/event/HeartRegistry.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,12 @@ | ||
package terrails.colorfulhearts.api.event; | ||
|
||
import terrails.colorfulhearts.api.heart.Hearts; | ||
import terrails.colorfulhearts.api.heart.drawing.StatusEffectHeart; | ||
|
||
public class HeartRegistry { | ||
|
||
public <T extends StatusEffectHeart> T registerStatusEffectHeart(T heart) { | ||
Hearts.STATUS_EFFECT_HEARTS.put(heart.getId(), heart); | ||
return heart; | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
common/src/main/java/terrails/colorfulhearts/api/heart/Hearts.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,32 @@ | ||
package terrails.colorfulhearts.api.heart; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.player.Player; | ||
import terrails.colorfulhearts.CColorfulHearts; | ||
import terrails.colorfulhearts.api.heart.drawing.HeartDrawing; | ||
import terrails.colorfulhearts.api.heart.drawing.SpriteHeartDrawing; | ||
import terrails.colorfulhearts.api.heart.drawing.StatusEffectHeart; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public class Hearts { | ||
|
||
public static final HeartDrawing CONTAINER = SpriteHeartDrawing.build(CColorfulHearts.location("container")).finish( | ||
new ResourceLocation("hud/heart/container"), new ResourceLocation("hud/heart/container_blinking"), | ||
new ResourceLocation("colorfulhearts", "heart/container_half"), new ResourceLocation("colorfulhearts", "heart/container_half_blinking"), | ||
new ResourceLocation("hud/heart/container_hardcore"), new ResourceLocation("hud/heart/container_hardcore_blinking"), | ||
new ResourceLocation("colorfulhearts", "heart/container_hardcore_half"), new ResourceLocation("colorfulhearts", "heart/container_hardcore_half_blinking") | ||
); | ||
|
||
public static List<HeartDrawing> COLORED_HEALTH_HEARTS; | ||
public static List<HeartDrawing> COLORED_ABSORPTION_HEARTS; | ||
public static Map<ResourceLocation, StatusEffectHeart> STATUS_EFFECT_HEARTS = new HashMap<>(); | ||
|
||
public static Optional<StatusEffectHeart> getEffectHeartForPlayer(Player player) { | ||
return STATUS_EFFECT_HEARTS.values().stream().filter(heart -> heart.shouldDraw(player)).findFirst(); | ||
} | ||
|
||
} |
Oops, something went wrong.