mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-24 16:16:24 -04:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dccacf3c8e | ||
|
|
e567c5fd15 |
@@ -389,40 +389,30 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
val SWEET_HEART = noSettingsItem("sweet_heart") // todo make a SweetHeartItem class for breeding purposes
|
||||
|
||||
@JvmField
|
||||
val TASTY_TAIL = noSettingsItem("tasty_tail")
|
||||
val TASTY_TAIL = compostableItem("tasty_tail", foodItem(3, 1.8f), 0.85f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val PEWTER_CRUNCHIES = regionalFoodItem("pewter_crunchies", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f, false)
|
||||
@JvmField
|
||||
val PEWTER_CRUNCHIES = regionalFoodItem("pewter_crunchies", 16, 7, 4.8f, false)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val RAGE_CANDY_BAR = regionalFoodItem("rage_candy_bar", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f, false)
|
||||
@JvmField
|
||||
val RAGE_CANDY_BAR = regionalFoodItem("rage_candy_bar", 16, 8, 3.2f, false)
|
||||
@JvmField
|
||||
val LAVA_COOKIE = regionalFoodItem("lava_cookie", 16, 7, 4.8f, false)
|
||||
@JvmField
|
||||
val OLD_GATEAU = regionalFoodItem("old_gateau", 16, 9, 2.4f, false)
|
||||
@JvmField
|
||||
val CASTELIACONE = regionalFoodItem("casteliacone", 16, 5, 2.8f, false)
|
||||
@JvmField
|
||||
val LUMIOSE_GALETTE = regionalFoodItem("lumiose_galette", 16, 8, 3.2f, false)
|
||||
@JvmField
|
||||
val BIG_MALASADA = regionalFoodItem("big_malasada", 16, 7, 4.8f, false)
|
||||
@JvmField
|
||||
val SMOKED_TAIL_CURRY = regionalFoodItem("smoked_tail_curry", 16, 10, 12f, false, ItemStack(Items.BOWL, 1))
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val LAVA_COOKIE = regionalFoodItem("lava_cookie", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val OLD_GATEAU = regionalFoodItem("old_gateau", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val CASTELIACONE = regionalFoodItem("casteliacone", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val SHALOUR_SABLE = regionalFoodItem("shalour_sable", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val LUMIOSE_GALETTE = regionalFoodItem("lumiose_galette", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val BIG_MALASADA = regionalFoodItem("big_malasada", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val SMOKED_TAIL_CURRY = regionalFoodItem("smoked_tail_curry", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f, false, ItemStack(Items.BOWL, 1))
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val JUBILIFE_MUFFIN = regionalFoodItem("jubilife_muffin", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
|
||||
@JvmField // todo get final values for this from vera
|
||||
val OPEN_FACED_SANDWICH = regionalFoodItem("open_faced_sandwich", 16, 10, 1.2f, MobEffectInstance(MobEffects.ABSORPTION, 900, 0), 1f)
|
||||
@JvmField
|
||||
val JUBILIFE_MUFFIN = regionalFoodItem("jubilife_muffin", 16, 8, 3.2f, false)
|
||||
@JvmField
|
||||
val OPEN_FACED_SANDWICH = regionalFoodItem("open_faced_sandwich", 16, 13, 13.2f, false)
|
||||
|
||||
// todo we might need to wait on these for later? These impact battles and may be harder to do
|
||||
/*@JvmField
|
||||
@@ -435,9 +425,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val POTATO_MOCHI = create("potato_mochi", CobblemonItem(Properties().stacksTo(16)
|
||||
.food(FoodProperties.Builder()
|
||||
.nutrition(10) // todo get final values for this from vera
|
||||
.saturationModifier(1.2F) // todo get final values for this from vera
|
||||
.alwaysEdible()
|
||||
.nutrition(8)
|
||||
.saturationModifier(3.8F)
|
||||
.build())))
|
||||
@JvmField
|
||||
val FRIED_RICE = create("fried_rice", CobblemonItem(Properties().stacksTo(16)
|
||||
@@ -449,16 +438,14 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val CANDIED_APPLE = create("candied_apple", CobblemonItem(Properties().stacksTo(16)
|
||||
.food(FoodProperties.Builder()
|
||||
.nutrition(10) // todo get final values for this from vera
|
||||
.saturationModifier(1.2F) // todo get final values for this from vera
|
||||
.alwaysEdible()
|
||||
.nutrition(6)
|
||||
.saturationModifier(2.8F)
|
||||
.build())))
|
||||
@JvmField
|
||||
val CANDIED_BERRY = create("candied_berry", CobblemonItem(Properties().stacksTo(16)
|
||||
.food(FoodProperties.Builder()
|
||||
.nutrition(10) // todo get final values for this from vera
|
||||
.saturationModifier(1.2F) // todo get final values for this from vera
|
||||
.alwaysEdible()
|
||||
.nutrition(5)
|
||||
.saturationModifier(2.2F)
|
||||
.build())))
|
||||
|
||||
//@JvmField
|
||||
@@ -1544,8 +1531,6 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
stacksTo: Int,
|
||||
nutrition: Int,
|
||||
saturationModifier: Float,
|
||||
effect: MobEffectInstance? = null,
|
||||
effectChance: Float? = null,
|
||||
alwaysEdible: Boolean = false,
|
||||
convertsToOnUse: ItemStack? = null
|
||||
): RegionalFoodItem {
|
||||
@@ -1553,10 +1538,6 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
.nutrition(nutrition)
|
||||
.saturationModifier(saturationModifier)
|
||||
|
||||
if (effect != null && effectChance != null) {
|
||||
foodPropertiesBuilder.effect(effect, effectChance)
|
||||
}
|
||||
|
||||
if (alwaysEdible == true) {
|
||||
foodPropertiesBuilder.alwaysEdible()
|
||||
}
|
||||
|
||||
@@ -11,19 +11,25 @@ package com.cobblemon.mod.common.api.cooking
|
||||
import com.cobblemon.mod.common.item.components.FoodComponent
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
data class Food(
|
||||
val hunger: Int = 0,
|
||||
val saturation: Float = 0f,
|
||||
val hunger: Int = 0,
|
||||
val saturation: Float = 0f,
|
||||
val mobEffects: List<SerializableMobEffectInstance>? = null
|
||||
) {
|
||||
companion object {
|
||||
val CODEC: Codec<Food> = RecordCodecBuilder.create { builder ->
|
||||
builder.group(
|
||||
Codec.INT.optionalFieldOf("hunger", 0).forGetter { it.hunger },
|
||||
Codec.FLOAT.optionalFieldOf("saturation", 0f).forGetter { it.saturation },
|
||||
).apply(builder, ::Food)
|
||||
Codec.INT.optionalFieldOf("hunger", 0).forGetter { it.hunger },
|
||||
Codec.FLOAT.optionalFieldOf("saturation", 0f).forGetter { it.saturation },
|
||||
SerializableMobEffectInstance.CODEC.listOf().optionalFieldOf("mobEffects").forGetter { Optional.ofNullable(it.mobEffects) }
|
||||
).apply(builder) { hunger, saturation, mobEffects ->
|
||||
Food(hunger, saturation, mobEffects.getOrNull())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun toComponent(): FoodComponent = FoodComponent(hunger, saturation)
|
||||
fun toComponent(): FoodComponent = FoodComponent(hunger, saturation, mobEffects?.map { it.toInstance() })
|
||||
}
|
||||
@@ -51,7 +51,6 @@ object Seasonings : JsonDataRegistry<Seasoning> {
|
||||
}
|
||||
|
||||
override fun reload(data: Map<ResourceLocation, Seasoning>) {
|
||||
// this needs to sideload the berry data so we don't get duplicate JSONs.
|
||||
val finalData = Berries.all().associate {
|
||||
it.identifier to Seasoning(
|
||||
ingredient = RegistryLikeIdentifierCondition(it.identifier),
|
||||
@@ -62,7 +61,16 @@ object Seasonings : JsonDataRegistry<Seasoning> {
|
||||
mobEffects = emptyList()
|
||||
)
|
||||
}.toMutableMap()
|
||||
finalData.putAll(data)
|
||||
|
||||
data.forEach { (id, seasoning) ->
|
||||
try {
|
||||
finalData[id] = seasoning
|
||||
} catch (e: Exception) {
|
||||
System.err.println("Failed to parse seasoning: $id")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
seasonings.addAll(finalData.values)
|
||||
}
|
||||
|
||||
|
||||
+21
-14
@@ -15,31 +15,38 @@ import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.effect.MobEffect
|
||||
import net.minecraft.world.effect.MobEffectInstance
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
data class SerializableMobEffectInstance(
|
||||
val effect: ResourceLocation,
|
||||
val duration: Int,
|
||||
val amplifier: Int = 0,
|
||||
val ambient: Boolean = false,
|
||||
val visible: Boolean = true,
|
||||
val showIcon: Boolean = true
|
||||
val effect: ResourceLocation,
|
||||
val duration: Int,
|
||||
val amplifier: Int = 0,
|
||||
val ambient: Boolean = false,
|
||||
val visible: Boolean = true,
|
||||
val showIcon: Boolean = true,
|
||||
val food: Food? = null
|
||||
) {
|
||||
fun toInstance(): MobEffectInstance {
|
||||
val holder = BuiltInRegistries.MOB_EFFECT.getHolder(effect)
|
||||
.orElseThrow { IllegalArgumentException("Unknown MobEffect: $effect") }
|
||||
.orElseThrow { IllegalArgumentException("Unknown MobEffect: $effect") }
|
||||
return MobEffectInstance(holder, duration, amplifier, ambient, visible, showIcon)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val CODEC: Codec<SerializableMobEffectInstance> = RecordCodecBuilder.create { builder ->
|
||||
builder.group(
|
||||
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
|
||||
Codec.INT.fieldOf("duration").forGetter { it.duration },
|
||||
Codec.INT.fieldOf("amplifier").forGetter { it.amplifier },
|
||||
Codec.BOOL.optionalFieldOf("ambient", false).forGetter { it.ambient },
|
||||
Codec.BOOL.optionalFieldOf("visible", true).forGetter { it.visible },
|
||||
Codec.BOOL.optionalFieldOf("showIcon", true).forGetter { it.showIcon }
|
||||
).apply(builder, ::SerializableMobEffectInstance)
|
||||
ResourceLocation.CODEC.fieldOf("effect").forGetter { it.effect },
|
||||
Codec.INT.fieldOf("duration").forGetter { it.duration },
|
||||
Codec.INT.fieldOf("amplifier").forGetter { it.amplifier },
|
||||
Codec.BOOL.optionalFieldOf("ambient", false).forGetter { it.ambient },
|
||||
Codec.BOOL.optionalFieldOf("visible", true).forGetter { it.visible },
|
||||
Codec.BOOL.optionalFieldOf("showIcon", true).forGetter { it.showIcon },
|
||||
Food.CODEC.optionalFieldOf("food").forGetter { Optional.ofNullable(it.food) }
|
||||
).apply(builder) { effect, duration, amplifier, ambient, visible, showIcon, food ->
|
||||
SerializableMobEffectInstance(effect, duration, amplifier, ambient, visible, showIcon, food.getOrNull())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ class AprijuiceItem(val type: Apricorn): CobblemonItem(Properties().stacksTo(16)
|
||||
val hasFlavour = stack.get(CobblemonItemComponents.FLAVOUR)?.flavours?.any { it.value > 0 } == true
|
||||
|
||||
if (!hasFlavour && user is Player && !world.isClientSide) {
|
||||
user.foodData.eat(1, 0.1f)
|
||||
user.foodData.eat(4, 1.2f)
|
||||
stack.consume(1, user)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,26 +13,34 @@ import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import io.netty.buffer.ByteBuf
|
||||
import net.minecraft.network.codec.ByteBufCodecs
|
||||
import net.minecraft.network.codec.StreamCodec
|
||||
import net.minecraft.world.effect.MobEffectInstance
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
data class FoodComponent(
|
||||
val hunger: Int,
|
||||
val saturation: Float
|
||||
val hunger: Int,
|
||||
val saturation: Float,
|
||||
val mobEffects: List<MobEffectInstance>? = null
|
||||
) {
|
||||
companion object {
|
||||
val CODEC: Codec<FoodComponent> = RecordCodecBuilder.create { builder ->
|
||||
builder.group(
|
||||
Codec.INT.fieldOf("hunger").forGetter { it.hunger },
|
||||
Codec.FLOAT.fieldOf("saturation").forGetter { it.saturation }
|
||||
).apply(builder, ::FoodComponent)
|
||||
Codec.INT.fieldOf("hunger").forGetter { it.hunger },
|
||||
Codec.FLOAT.fieldOf("saturation").forGetter { it.saturation },
|
||||
MobEffectInstance.CODEC.listOf().optionalFieldOf("mob_effects").forGetter { Optional.ofNullable(it.mobEffects) }
|
||||
).apply(builder) { hunger, saturation, mobEffects ->
|
||||
FoodComponent(hunger, saturation, mobEffects.getOrNull())
|
||||
}
|
||||
}
|
||||
|
||||
val PACKET_CODEC: StreamCodec<ByteBuf, FoodComponent> = ByteBufCodecs.fromCodec(CODEC)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is FoodComponent &&
|
||||
hunger == other.hunger &&
|
||||
saturation == other.saturation
|
||||
other is FoodComponent &&
|
||||
hunger == other.hunger &&
|
||||
saturation == other.saturation &&
|
||||
mobEffects == other.mobEffects
|
||||
|
||||
override fun hashCode(): Int = 31 * hunger + saturation.hashCode()
|
||||
}
|
||||
override fun hashCode(): Int = 31 * hunger + saturation.hashCode() + (mobEffects?.hashCode() ?: 0)
|
||||
}
|
||||
|
||||
+13
-5
@@ -15,22 +15,30 @@ import io.netty.buffer.ByteBuf
|
||||
import net.minecraft.network.codec.ByteBufCodecs
|
||||
import net.minecraft.network.codec.StreamCodec
|
||||
import net.minecraft.world.effect.MobEffectInstance
|
||||
import java.util.Optional
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
data class MobEffectsComponent(
|
||||
val mobEffects: List<MobEffectInstance>
|
||||
val mobEffects: List<MobEffectInstance>,
|
||||
val food: FoodComponent? = null
|
||||
) {
|
||||
companion object {
|
||||
val CODEC: Codec<MobEffectsComponent> = RecordCodecBuilder.create { builder ->
|
||||
builder.group(
|
||||
MobEffectInstance.CODEC.listOf().fieldOf("mob_effects").forGetter { it.mobEffects }
|
||||
).apply(builder, ::MobEffectsComponent)
|
||||
MobEffectInstance.CODEC.listOf().fieldOf("mob_effects").forGetter { it.mobEffects },
|
||||
FoodComponent.CODEC.optionalFieldOf("food").forGetter { Optional.ofNullable(it.food) }
|
||||
).apply(builder) { effects, food ->
|
||||
MobEffectsComponent(effects, food.getOrNull())
|
||||
}
|
||||
}
|
||||
|
||||
val PACKET_CODEC: StreamCodec<ByteBuf, MobEffectsComponent> = ByteBufCodecs.fromCodec(CODEC)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is MobEffectsComponent && mobEffects == other.mobEffects
|
||||
other is MobEffectsComponent &&
|
||||
mobEffects == other.mobEffects &&
|
||||
food == other.food
|
||||
|
||||
override fun hashCode(): Int = 31 * mobEffects.hashCode()
|
||||
override fun hashCode(): Int = 31 * mobEffects.hashCode() + (food?.hashCode() ?: 0)
|
||||
}
|
||||
+25
-7
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.item.crafting
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonItemComponents
|
||||
import com.cobblemon.mod.common.api.cooking.FoodUtils
|
||||
import com.cobblemon.mod.common.api.cooking.MobEffectUtils
|
||||
import com.cobblemon.mod.common.api.cooking.Seasonings
|
||||
import com.cobblemon.mod.common.item.components.FoodComponent
|
||||
import net.minecraft.core.component.DataComponents
|
||||
@@ -25,18 +26,35 @@ object FoodSeasoningProcessor : SeasoningProcessor {
|
||||
val baseSaturation = foodData?.saturation ?: 0f
|
||||
|
||||
val foodComponents = seasoning.mapNotNull {
|
||||
Seasonings.getFromItemStack(it)?.food?.toComponent()
|
||||
Seasonings.getFromItemStack(it)?.food
|
||||
}
|
||||
|
||||
if (foodComponents.isNotEmpty()) {
|
||||
val merged = FoodUtils.merge(foodComponents, extraHunger = baseHunger, extraSaturation = baseSaturation)
|
||||
result.set(CobblemonItemComponents.FOOD, merged)
|
||||
} // we still want there to be food data on the output item still? To be conistent? idk
|
||||
else {
|
||||
result.set(CobblemonItemComponents.FOOD, FoodComponent(baseHunger, baseSaturation))
|
||||
val mergedFood = FoodUtils.merge(
|
||||
foodComponents.map { it.toComponent() },
|
||||
extraHunger = baseHunger,
|
||||
extraSaturation = baseSaturation
|
||||
)
|
||||
|
||||
val allEffects = foodComponents
|
||||
.mapNotNull { it.mobEffects }
|
||||
.flatMap { it }
|
||||
|
||||
val mergedEffects = if (allEffects.isNotEmpty()) {
|
||||
MobEffectUtils
|
||||
.mergeEffects(allEffects)
|
||||
.map { it.toInstance() }
|
||||
} else null
|
||||
|
||||
val finalComponent = if (mergedEffects != null && mergedEffects.isNotEmpty()) {
|
||||
FoodComponent(mergedFood.hunger, mergedFood.saturation, mergedEffects)
|
||||
} else {
|
||||
mergedFood
|
||||
}
|
||||
|
||||
result.set(CobblemonItemComponents.FOOD, finalComponent)
|
||||
}
|
||||
|
||||
|
||||
override fun consumesItem(seasoning: ItemStack): Boolean {
|
||||
val seasoningData = Seasonings.getFromItemStack(seasoning)
|
||||
return seasoningData?.food != null
|
||||
|
||||
+9
-3
@@ -21,12 +21,18 @@ object MobEffectSeasoningProcessor : SeasoningProcessor {
|
||||
|
||||
override fun apply(result: ItemStack, seasoning: List<ItemStack>) {
|
||||
val allEffects: List<SerializableMobEffectInstance> = seasoning
|
||||
.flatMap { Seasonings.getMobEffectsFromItemStack(it) }
|
||||
.flatMap { Seasonings.getMobEffectsFromItemStack(it) }
|
||||
|
||||
val mergedEffects = MobEffectUtils.mergeEffects(allEffects).map { it.toInstance() }
|
||||
val mergedEffects = MobEffectUtils.mergeEffects(allEffects)
|
||||
.map { it.toInstance() }
|
||||
|
||||
val foodComponents = allEffects.mapNotNull { it.food?.toComponent() }
|
||||
val mergedFood = if (foodComponents.isNotEmpty()) {
|
||||
com.cobblemon.mod.common.api.cooking.FoodUtils.merge(foodComponents)
|
||||
} else null
|
||||
|
||||
if (mergedEffects.isNotEmpty()) {
|
||||
result.set(CobblemonItemComponents.MOB_EFFECTS, MobEffectsComponent(mergedEffects))
|
||||
result.set(CobblemonItemComponents.MOB_EFFECTS, MobEffectsComponent(mergedEffects, mergedFood))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -409,7 +409,6 @@ object CobblemonItemGroups {
|
||||
entries.accept(CobblemonItems.OLD_GATEAU)
|
||||
entries.accept(CobblemonItems.CASTELIACONE)
|
||||
entries.accept(CobblemonItems.LUMIOSE_GALETTE)
|
||||
entries.accept(CobblemonItems.SHALOUR_SABLE)
|
||||
entries.accept(CobblemonItems.BIG_MALASADA)
|
||||
entries.accept(CobblemonItems.SMOKED_TAIL_CURRY)
|
||||
entries.accept(CobblemonItems.OPEN_FACED_SANDWICH)
|
||||
@@ -765,8 +764,7 @@ object CobblemonItemGroups {
|
||||
injector.putAfter(CobblemonItems.OLD_GATEAU, CobblemonItems.JUBILIFE_MUFFIN)
|
||||
injector.putAfter(CobblemonItems.CASTELIACONE, CobblemonItems.OLD_GATEAU)
|
||||
injector.putAfter(CobblemonItems.LUMIOSE_GALETTE, CobblemonItems.CASTELIACONE)
|
||||
injector.putAfter(CobblemonItems.SHALOUR_SABLE, CobblemonItems.LUMIOSE_GALETTE)
|
||||
injector.putAfter(CobblemonItems.BIG_MALASADA, CobblemonItems.SHALOUR_SABLE)
|
||||
injector.putAfter(CobblemonItems.BIG_MALASADA, CobblemonItems.LUMIOSE_GALETTE)
|
||||
injector.putAfter(CobblemonItems.SMOKED_TAIL_CURRY, CobblemonItems.BIG_MALASADA)
|
||||
injector.putAfter(CobblemonItems.OPEN_FACED_SANDWICH, CobblemonItems.SMOKED_TAIL_CURRY)
|
||||
|
||||
|
||||
@@ -45,17 +45,21 @@ class PonigiriItem : Item(
|
||||
}
|
||||
|
||||
override fun finishUsingItem(stack: ItemStack, world: Level, user: LivingEntity): ItemStack {
|
||||
val effects = stack.get(CobblemonItemComponents.FOOD)
|
||||
val food = stack.get(CobblemonItemComponents.FOOD)
|
||||
|
||||
if (effects != null && !world.isClientSide) {
|
||||
if (user is Player) { // todo maybe we want to be able to let other mobs eat these? or modded creatures that have hunder? idk
|
||||
user.foodData.eat(effects.hunger, effects.saturation)
|
||||
if (food != null && !world.isClientSide) {
|
||||
if (user is Player) {
|
||||
user.foodData.eat(food.hunger, food.saturation)
|
||||
}
|
||||
food.mobEffects?.forEach {
|
||||
user.addEffect(it)
|
||||
}
|
||||
}
|
||||
|
||||
return super.finishUsingItem(stack, world, user)
|
||||
}
|
||||
|
||||
|
||||
override fun getUseAnimation(stack: ItemStack) = UseAnim.EAT
|
||||
|
||||
override fun getEatingSound(): SoundEvent {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:beetroot",
|
||||
"colour": "red",
|
||||
"food": {
|
||||
"hunger": 1,
|
||||
"saturation": 1.2
|
||||
"hunger": 0.5,
|
||||
"saturation": 0.6
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:brown_mushroom",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 3,
|
||||
"saturation": 3.6
|
||||
"hunger": 1.5,
|
||||
"saturation": 1.8
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:carrot",
|
||||
"colour": "orange",
|
||||
"food": {
|
||||
"hunger": 3,
|
||||
"saturation": 3.6
|
||||
"hunger": 1.5,
|
||||
"saturation": 1.8
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:dried_kelp",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 1,
|
||||
"saturation": 0.6
|
||||
"hunger": 0.5,
|
||||
"saturation": 0.3
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:egg",
|
||||
"colour": "white",
|
||||
"food": {
|
||||
"hunger": 3,
|
||||
"saturation": 1.8
|
||||
"hunger": 1.5,
|
||||
"saturation": 0.9
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
],
|
||||
"food": {
|
||||
"hunger": 6,
|
||||
"saturation": 14.4
|
||||
"hunger": 3,
|
||||
"saturation": 7.2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "cobblemon:medicinal_leek",
|
||||
"colour": "green",
|
||||
"food": {
|
||||
"hunger": 3,
|
||||
"saturation": 1.2
|
||||
"hunger": 1.5,
|
||||
"saturation": 0.6
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
"ingredient": "minecraft:poisonous_potato",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 2,
|
||||
"saturation": 1.2
|
||||
"hunger": 1,
|
||||
"saturation": 0.6
|
||||
},
|
||||
"mobEffects": [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:potato",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 5,
|
||||
"saturation": 6
|
||||
"hunger": 2.5,
|
||||
"saturation": 3
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:pumpkin",
|
||||
"colour": "orange",
|
||||
"food": {
|
||||
"hunger": 6,
|
||||
"saturation": 3.6
|
||||
"hunger": 3,
|
||||
"saturation": 1.8
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_beef",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 8,
|
||||
"saturation": 12.8
|
||||
"hunger": 4,
|
||||
"saturation": 6.4
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_chicken",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 6,
|
||||
"saturation": 7.2
|
||||
"hunger": 3,
|
||||
"saturation": 3.6
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_cod",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 5,
|
||||
"saturation": 6
|
||||
"hunger": 2.5,
|
||||
"saturation": 3
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_mutton",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 6,
|
||||
"saturation": 9.6
|
||||
"hunger": 3,
|
||||
"saturation": 4.8
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_porkchop",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 8,
|
||||
"saturation": 12.8
|
||||
"hunger": 4,
|
||||
"saturation": 6.4
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_rabbit",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 5,
|
||||
"saturation": 6
|
||||
"hunger": 2.5,
|
||||
"saturation": 3
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:raw_salmon",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 6,
|
||||
"saturation": 9.6
|
||||
"hunger": 3,
|
||||
"saturation": 4.8
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "minecraft:red_mushroom",
|
||||
"colour": "red",
|
||||
"food": {
|
||||
"hunger": 3,
|
||||
"saturation": 3.6
|
||||
"hunger": 1.5,
|
||||
"saturation": 1.8
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
"ingredient": "minecraft:rotten_flesh",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 4,
|
||||
"saturation": 0.8
|
||||
"hunger": 2,
|
||||
"saturation": 0.4
|
||||
},
|
||||
"mobEffects": [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "cobblemon:tasty_tail",
|
||||
"colour": "brown",
|
||||
"food": {
|
||||
"hunger": 8,
|
||||
"saturation": 12.8
|
||||
"hunger": 4,
|
||||
"saturation": 6.4
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ingredient": "cobblemon:vivichoke",
|
||||
"colour": "green",
|
||||
"food": {
|
||||
"hunger": 6,
|
||||
"saturation": 4
|
||||
"hunger": 3,
|
||||
"saturation": 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user