-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
25 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
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
17 changes: 15 additions & 2 deletions
17
projects/core/src/main/kotlin/site/siredvin/turtlematic/api/ISoulFeedableItem.kt
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 |
---|---|---|
@@ -1,13 +1,26 @@ | ||
package site.siredvin.turtlematic.api | ||
|
||
import net.minecraft.nbt.CompoundTag | ||
import net.minecraft.world.entity.LivingEntity | ||
import net.minecraft.world.entity.player.Player | ||
import net.minecraft.world.item.ItemStack | ||
import net.minecraft.world.level.ItemLike | ||
import site.siredvin.peripheralium.util.Pair | ||
import site.siredvin.turtlematic.common.recipe.SoulHarvestRecipe | ||
import site.siredvin.turtlematic.common.recipe.SoulHarvestRecipeRegistry | ||
|
||
interface ISoulFeedableItem { | ||
interface ISoulFeedableItem : ItemLike { | ||
fun consumeEntitySoul(stack: ItemStack, player: Player, entity: LivingEntity): Pair<ItemStack?, String?> | ||
fun getActiveRecipe(stack: ItemStack): SoulHarvestRecipe? | ||
fun getActiveRecipe(stack: ItemStack): SoulHarvestRecipe? { | ||
val tag: CompoundTag? = stack.tag | ||
if (tag != null && !tag.isEmpty) { | ||
val consumedData = tag.getCompound(SoulHarvestRecipeRegistry.CONSUMER_ENTITY_COMPOUND) | ||
if (!consumedData.isEmpty) { | ||
val recipeName = consumedData.allKeys.firstOrNull() ?: return null | ||
return SoulHarvestRecipeRegistry.searchRecipe(this.asItem(), recipeName) | ||
} | ||
} | ||
return null | ||
} | ||
fun getEntityRepresentation(stack: ItemStack, recipe: SoulHarvestRecipe): List<RecipeEntityRepresentation> | ||
} |
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