diff --git a/README.md b/README.md index 706e2ef..abe0911 100644 --- a/README.md +++ b/README.md @@ -48,9 +48,9 @@ __餐事__(餐食、蚕食、餐室、餐市,或者随便你怎么读)是 可以防止获得者获得不高于剧毒抗性等级的中毒效果
- ##### 黑暗浸染 - _不详之瓶_
大幅提高移速、攻速、伤害、击退抗性与幸运
-- ##### 女神的眷顾 - _金苹果_
+- ##### 女神的恩惠 - _金苹果_
依据等级翻倍可能的战利品
-- ##### Mojang的眷顾 - _附魔金苹果_
+- ##### 游戏的恩惠 - _附魔金苹果_
依据等级大幅翻倍可能的战利品,在女神的眷顾计算后计算。挖掘方块有概率阻止方块掉落
- ##### 膻骚 - _(烤)羊肉_
阻止生物以膻骚的生物作为攻击目标,生物会逃离膻骚的生物
@@ -122,9 +122,9 @@ __餐事__(餐食、蚕食、餐室、餐市,或者随便你怎么读)是 --- # 状态 -| 开发阶段 | 下一阶段 | -|------|----------| -| 绘制贴图 | Alpha 测试 | +| 开发阶段 | 下一阶段 | +|----------|--------------| +| Alpha 测试 | 完善介绍、wiki,宣传 | --- diff --git a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/FoodDataMixin.java b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/FoodDataMixin.java index 38484a8..724804d 100644 --- a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/FoodDataMixin.java +++ b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/FoodDataMixin.java @@ -1,6 +1,6 @@ package indi.fcwyzzr.minecraft.food_talks.common.mixin.tweaks.mechanic; -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.Happy; +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.Happy; import net.minecraft.world.Difficulty; import net.minecraft.world.entity.player.Player; import net.minecraft.world.food.FoodData; diff --git a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/ItemMixin.java b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/ItemMixin.java index babe64e..3a02131 100644 --- a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/ItemMixin.java +++ b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/ItemMixin.java @@ -1,7 +1,7 @@ package indi.fcwyzzr.minecraft.food_talks.common.mixin.tweaks.mechanic; import indi.fcwyzzr.minecraft.food_talks.api.common.item.CompoundFood; -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.Anorexia; +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.Anorexia; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; diff --git a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/LivingEntityMixin.java b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/LivingEntityMixin.java index 77aeba9..f3d0e9e 100644 --- a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/LivingEntityMixin.java +++ b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/LivingEntityMixin.java @@ -1,7 +1,7 @@ package indi.fcwyzzr.minecraft.food_talks.common.mixin.tweaks.mechanic; -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.ProjectileImmune; -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.Overweight; +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.ProjectileImmune; +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.Overweight; import net.minecraft.core.Holder; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.Entity; diff --git a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/PathfinderMobMixin.java b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/PathfinderMobMixin.java index 19b0ff6..db0e253 100644 --- a/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/PathfinderMobMixin.java +++ b/src/main/java/indi/fcwyzzr/minecraft/food_talks/common/mixin/tweaks/mechanic/PathfinderMobMixin.java @@ -1,7 +1,7 @@ package indi.fcwyzzr.minecraft.food_talks.common.mixin.tweaks.mechanic; import indi.fcwyzzr.minecraft.food_talks.common.ai.goal.ConditionallyAvoidEntityGoal; -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.Smelly; +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.Smelly; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FMobEffect.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FMobEffect.kt index 2f0b25c..53efb09 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FMobEffect.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FMobEffect.kt @@ -1,5 +1,6 @@ package indi.fcwyzzr.minecraft.f_lib.registry +import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.food_talks.toRegistryName import indi.fcwyzzr.minecraft.food_talks.toResourceLocation import net.minecraft.core.Holder @@ -9,6 +10,7 @@ import net.minecraft.core.registries.Registries import net.minecraft.resources.ResourceKey import net.minecraft.world.effect.MobEffect import net.minecraft.world.effect.MobEffectCategory +import net.minecraft.world.effect.MobEffectInstance import net.neoforged.neoforge.registries.DeferredHolder abstract class FMobEffect( @@ -27,4 +29,20 @@ abstract class FMobEffect( Registries.MOB_EFFECT, location ) ) + + fun createNewInstance(duration: Int, amplifier: Int = 0) = MobEffectInstance( + holder, + duration, + amplifier + ) + + fun createDefaultInstance() = createNewInstance(duration) + fun createExtendedInstance() = createNewInstance(extendedDuration) + fun createUpgradedInstance() = createNewInstance(upgradedDuration, 1) + + companion object { + private const val duration = 3 * 60 * FoodTalks.TPS + private const val extendedDuration = 8 * 60 * FoodTalks.TPS + private const val upgradedDuration = 90 * FoodTalks.TPS + } } \ No newline at end of file diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FPotion.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FPotion.kt new file mode 100644 index 0000000..6c19500 --- /dev/null +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/f_lib/registry/FPotion.kt @@ -0,0 +1,37 @@ +package indi.fcwyzzr.minecraft.f_lib.registry + +import indi.fcwyzzr.minecraft.food_talks.toRegistryName +import indi.fcwyzzr.minecraft.food_talks.toResourceLocation +import net.minecraft.core.Holder +import net.minecraft.core.Registry +import net.minecraft.core.registries.BuiltInRegistries +import net.minecraft.core.registries.Registries +import net.minecraft.resources.ResourceKey +import net.minecraft.resources.ResourceLocation +import net.minecraft.world.effect.MobEffect +import net.minecraft.world.effect.MobEffectCategory +import net.minecraft.world.effect.MobEffectInstance +import net.minecraft.world.item.alchemy.Potion +import net.minecraft.world.item.alchemy.Potions +import net.neoforged.neoforge.registries.DeferredHolder + +class FPotion( + vararg effects: MobEffectInstance, + val name: String? = null +): Potion(name, *effects), FRegistry { + override val registryKey: ResourceKey> = BuiltInRegistries.POTION.key() + + override val location: ResourceLocation = name + ?.toRegistryName() + ?.toResourceLocation() + ?: effects[0] + .effect + .key!! + .location() + + override val holder: Holder = DeferredHolder.create( + ResourceKey.create( + Registries.POTION, location + ) + ) +} \ No newline at end of file diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/api/common/item/CompoundFood.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/api/common/item/CompoundFood.kt index ccc4fe3..2ff0294 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/api/common/item/CompoundFood.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/api/common/item/CompoundFood.kt @@ -4,7 +4,7 @@ import indi.fcwyzzr.minecraft.f_lib.registry.FItem import indi.fcwyzzr.minecraft.f_lib.utils.buildDataComponentPatch import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.food_talks.common.data_component.compound_food.FoodItemProperties -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.Anorexia +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.Anorexia import net.minecraft.core.Holder import net.minecraft.core.component.DataComponentPatch import net.minecraft.core.component.DataComponents diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/CompoundFoodEatingHandler.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/CompoundFoodEatingHandler.kt index 974ef46..54547ce 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/CompoundFoodEatingHandler.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/CompoundFoodEatingHandler.kt @@ -2,7 +2,7 @@ package indi.fcwyzzr.minecraft.food_talks.common.event.gameplay import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.food_talks.api.common.item.CompoundFood -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.Anorexia +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.Anorexia import net.neoforged.api.distmarker.Dist import net.neoforged.bus.api.SubscribeEvent import net.neoforged.fml.common.EventBusSubscriber diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/EffectHandler.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/EffectHandler.kt index 5d7a906..c1e9d13 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/EffectHandler.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/gameplay/EffectHandler.kt @@ -3,10 +3,11 @@ package indi.fcwyzzr.minecraft.food_talks.common.event.gameplay import com.google.common.math.IntMath.pow import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.food_talks.api.common.item.CompoundFood -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.* -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.* import indi.fcwyzzr.minecraft.food_talks.common.registries.ToothacheDamage import indi.fcwyzzr.minecraft.food_talks.common.registries.from +import indi.fcwyzzr.minecraft.food_talks.common.registries.milkIrremovable import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer import net.minecraft.util.Mth @@ -39,13 +40,7 @@ object EffectHandler { @SubscribeEvent fun entityTryToRemoveEffect(event: Remove){ if (event.cure != null) - if (event.effect.`is`(Anorexia.location) - || event.effect.`is`(Gout.location) - || event.effect.`is`(Overweight.location) - || event.effect.`is`(Toothache.location) - || event.effect.`is`(Vomit.location) - ) - + if (event.effect.`is`(milkIrremovable)) event.isCanceled = true } diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/FTLifecycle.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/CustomRegister.kt similarity index 70% rename from src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/FTLifecycle.kt rename to src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/CustomRegister.kt index b5351cf..43d7cee 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/FTLifecycle.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/CustomRegister.kt @@ -1,21 +1,12 @@ -package indi.fcwyzzr.minecraft.food_talks.common.event +package indi.fcwyzzr.minecraft.food_talks.common.event.lifecycle import indi.fcwyzzr.minecraft.f_lib.registry.doRegister import indi.fcwyzzr.minecraft.food_talks.FoodTalks -import indi.fcwyzzr.minecraft.food_talks.common.block.BottleBlock -import indi.fcwyzzr.minecraft.food_talks.common.block.PlateBlock -import indi.fcwyzzr.minecraft.food_talks.common.block.entity.BottleBlockEntity -import indi.fcwyzzr.minecraft.food_talks.common.block.entity.PlateBlockEntity import indi.fcwyzzr.minecraft.food_talks.common.data_component.SimpleDataComponents import indi.fcwyzzr.minecraft.food_talks.common.data_component.compound_food.FoodItemProperties import indi.fcwyzzr.minecraft.food_talks.common.data_component.compound_food.FoodStackProperties -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.* -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.* import indi.fcwyzzr.minecraft.food_talks.common.food.item_reward.* import indi.fcwyzzr.minecraft.food_talks.common.food.tag_punishment.* -import indi.fcwyzzr.minecraft.food_talks.common.item.Cocktail -import indi.fcwyzzr.minecraft.food_talks.common.item.Plate -import indi.fcwyzzr.minecraft.food_talks.common.item.Sandwich import indi.fcwyzzr.minecraft.food_talks.common.registries.foodItemRewardRegistry import indi.fcwyzzr.minecraft.food_talks.common.registries.foodTagPunishmentRegistry import indi.fcwyzzr.minecraft.food_talks.toRegistryName @@ -33,13 +24,31 @@ import net.neoforged.neoforge.registries.RegisterEvent value = [Dist.CLIENT, Dist.DEDICATED_SERVER], bus = EventBusSubscriber.Bus.MOD ) -object FTLifecycle { +object CustomRegister { @SubscribeEvent fun registerRegistry(event: NewRegistryEvent){ event.register(foodItemRewardRegistry) event.register(foodTagPunishmentRegistry) } + @SubscribeEvent + fun registerComponents(event: RegisterEvent){ + event.register(BuiltInRegistries.DATA_COMPONENT_TYPE.key()){ + it.register(FoodItemProperties.location, FoodItemProperties.type) + it.register(FoodStackProperties.location, FoodStackProperties.type) + + it.register( + "SandwichLayer".toRegistryName().toResourceLocation(), + SimpleDataComponents.SandwichLayer + ) + + it.register( + "PossibleEffectList".toRegistryName().toResourceLocation(), + SimpleDataComponents.PossibleEffectList + ) + } + } + @SubscribeEvent fun registerFoodItemReward(event: RegisterEvent){ // drinks @@ -94,71 +103,14 @@ object FTLifecycle { @SubscribeEvent fun registerFoodTagPunishment(event: RegisterEvent){ - event doRegister drinksMakeYouDizzy + // event doRegister drinksMakeYouDizzy event doRegister fleshesMakeYouVomit event doRegister fruitsMakeYouToothache event doRegister meatsMakeYouGout event doRegister snacksMakeYouOverweight - event doRegister soupMakeYouHungry + // event doRegister soupMakeYouHungry event doRegister staplesGiveYouAnorexia event doRegister vegetablesMakeYouWeak event doRegister drugsPoisonYou } - - @SubscribeEvent - fun registerEffect(event: RegisterEvent){ - event doRegister Anorexia - event doRegister Gout - event doRegister Toothache - event doRegister Vomit - event doRegister Overweight - - event doRegister PoisonResistance - event doRegister DarknessInfused - event doRegister GoddessGrace - event doRegister GameGrace - event doRegister Smelly - event doRegister Happy - event doRegister ProjectileImmune - event doRegister Starving - event doRegister JackHead - } - - @SubscribeEvent - fun registerBlocks(event: RegisterEvent){ - event doRegister BottleBlock - event doRegister PlateBlock - } - - @SubscribeEvent - fun registerBlockEntities(event: RegisterEvent){ - event doRegister BottleBlockEntity - event doRegister PlateBlockEntity - } - - @SubscribeEvent - fun registerItems(event: RegisterEvent){ - event doRegister Cocktail - event doRegister Plate - event doRegister Sandwich - } - - @SubscribeEvent - fun registerComponents(event: RegisterEvent){ - event.register(BuiltInRegistries.DATA_COMPONENT_TYPE.key()){ - it.register(FoodItemProperties.location, FoodItemProperties.type) - it.register(FoodStackProperties.location, FoodStackProperties.type) - - it.register( - "SandwichLayer".toRegistryName().toResourceLocation(), - SimpleDataComponents.SandwichLayer - ) - - it.register( - "PossibleEffectList".toRegistryName().toResourceLocation(), - SimpleDataComponents.PossibleEffectList - ) - } - } - } \ No newline at end of file diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/MobEffectRegister.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/MobEffectRegister.kt new file mode 100644 index 0000000..49b1c6f --- /dev/null +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/MobEffectRegister.kt @@ -0,0 +1,40 @@ +package indi.fcwyzzr.minecraft.food_talks.common.event.lifecycle + +import indi.fcwyzzr.minecraft.f_lib.registry.doRegister +import indi.fcwyzzr.minecraft.food_talks.FoodTalks +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.Vomit +import indi.fcwyzzr.minecraft.food_talks.common.registries.deferred.* +import net.neoforged.api.distmarker.Dist +import net.neoforged.bus.api.SubscribeEvent +import net.neoforged.fml.common.EventBusSubscriber +import net.neoforged.neoforge.registries.RegisterEvent + +@Suppress("DuplicatedCode") +@EventBusSubscriber( + modid = FoodTalks.MOD_ID, + value = [Dist.CLIENT, Dist.DEDICATED_SERVER], + bus = EventBusSubscriber.Bus.MOD +) +object MobEffectRegister { + + @SubscribeEvent + fun registerEffect(event: RegisterEvent){ + event doRegister Anorexia + event doRegister Gout + event doRegister Toothache + event doRegister Vomit + event doRegister Overweight + + event doRegister PoisonResistance + event doRegister DarknessInfused + event doRegister GoddessGrace + event doRegister GameGrace + event doRegister Smelly + event doRegister Happy + event doRegister ProjectileImmune + event doRegister Starving + event doRegister JackHead + } +} \ No newline at end of file diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/PrimaryElementRegister.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/PrimaryElementRegister.kt new file mode 100644 index 0000000..6ae47ac --- /dev/null +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/event/lifecycle/PrimaryElementRegister.kt @@ -0,0 +1,41 @@ +package indi.fcwyzzr.minecraft.food_talks.common.event.lifecycle + +import indi.fcwyzzr.minecraft.f_lib.registry.doRegister +import indi.fcwyzzr.minecraft.food_talks.FoodTalks +import indi.fcwyzzr.minecraft.food_talks.common.block.BottleBlock +import indi.fcwyzzr.minecraft.food_talks.common.block.PlateBlock +import indi.fcwyzzr.minecraft.food_talks.common.block.entity.BottleBlockEntity +import indi.fcwyzzr.minecraft.food_talks.common.block.entity.PlateBlockEntity +import indi.fcwyzzr.minecraft.food_talks.common.item.Cocktail +import indi.fcwyzzr.minecraft.food_talks.common.item.Plate +import indi.fcwyzzr.minecraft.food_talks.common.item.Sandwich +import net.neoforged.api.distmarker.Dist +import net.neoforged.bus.api.SubscribeEvent +import net.neoforged.fml.common.EventBusSubscriber +import net.neoforged.neoforge.registries.RegisterEvent + +@EventBusSubscriber( + modid = FoodTalks.MOD_ID, + value = [Dist.CLIENT, Dist.DEDICATED_SERVER], + bus = EventBusSubscriber.Bus.MOD +) +object PrimaryElementRegister { + @SubscribeEvent + fun registerBlocks(event: RegisterEvent){ + event doRegister BottleBlock + event doRegister PlateBlock + } + + @SubscribeEvent + fun registerBlockEntities(event: RegisterEvent){ + event doRegister BottleBlockEntity + event doRegister PlateBlockEntity + } + + @SubscribeEvent + fun registerItems(event: RegisterEvent){ + event doRegister Cocktail + event doRegister Plate + event doRegister Sandwich + } +} \ No newline at end of file diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/item_reward/SimpleItemReward.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/item_reward/SimpleItemReward.kt index e5cbcd9..bb3235d 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/item_reward/SimpleItemReward.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/item_reward/SimpleItemReward.kt @@ -2,7 +2,7 @@ package indi.fcwyzzr.minecraft.food_talks.common.food.item_reward import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.food_talks.api.common.registry.FoodItemReward -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.* import net.minecraft.core.registries.BuiltInRegistries import net.minecraft.world.effect.MobEffects import net.minecraft.world.item.Item diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/tag_punishment/SimpleTagPunishment.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/tag_punishment/SimpleTagPunishment.kt index 1d9e96d..9b3c447 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/tag_punishment/SimpleTagPunishment.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/food/tag_punishment/SimpleTagPunishment.kt @@ -2,7 +2,7 @@ package indi.fcwyzzr.minecraft.food_talks.common.food.tag_punishment import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.food_talks.api.common.registry.FoodTagPunishment -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.* import indi.fcwyzzr.minecraft.food_talks.toResourceLocation import net.minecraft.world.effect.MobEffects diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/item/Sandwich.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/item/Sandwich.kt index 5ac95bc..6920a48 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/item/Sandwich.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/item/Sandwich.kt @@ -6,7 +6,6 @@ import indi.fcwyzzr.minecraft.food_talks.client.renderer.Bewlr import indi.fcwyzzr.minecraft.food_talks.common.block.entity.PlateBlockEntity import indi.fcwyzzr.minecraft.food_talks.common.data_component.SimpleDataComponents import indi.fcwyzzr.minecraft.food_talks.common.data_component.compound_food.FoodStackProperties -import indi.fcwyzzr.minecraft.food_talks.common.effects.harmful.Anorexia import indi.fcwyzzr.minecraft.food_talks.common.mixin.accessors.mechanic.MobEffectInstanceAccessor import indi.fcwyzzr.minecraft.food_talks.common.registries.foodItemRewardRegistry import indi.fcwyzzr.minecraft.food_talks.common.registries.foodTagPunishmentRegistry diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/beneficial/SimpleBeneficialEffects.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/beneficial/SimpleBeneficialEffects.kt similarity index 96% rename from src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/beneficial/SimpleBeneficialEffects.kt rename to src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/beneficial/SimpleBeneficialEffects.kt index 3d3b351..4c4e9aa 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/beneficial/SimpleBeneficialEffects.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/beneficial/SimpleBeneficialEffects.kt @@ -1,4 +1,4 @@ -package indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial +package indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial import indi.fcwyzzr.minecraft.f_lib.registry.FMobEffect import indi.fcwyzzr.minecraft.food_talks.toResourceLocation diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Anorexia.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Anorexia.kt similarity index 92% rename from src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Anorexia.kt rename to src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Anorexia.kt index 1b208e1..b4bca1c 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Anorexia.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Anorexia.kt @@ -1,9 +1,9 @@ -package indi.fcwyzzr.minecraft.food_talks.common.effects.harmful +package indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful import indi.fcwyzzr.minecraft.f_lib.registry.FMobEffect import indi.fcwyzzr.minecraft.food_talks.api.common.item.CompoundFood import indi.fcwyzzr.minecraft.food_talks.common.data_component.compound_food.FoodItemProperties -import indi.fcwyzzr.minecraft.food_talks.common.effects.beneficial.Starving +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.Starving import net.minecraft.core.component.DataComponents import net.minecraft.world.Difficulty import net.minecraft.world.effect.MobEffectCategory diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Gout.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Gout.kt similarity index 93% rename from src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Gout.kt rename to src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Gout.kt index 225a315..c743097 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Gout.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Gout.kt @@ -1,4 +1,4 @@ -package indi.fcwyzzr.minecraft.food_talks.common.effects.harmful +package indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful import indi.fcwyzzr.minecraft.food_talks.FoodTalks import indi.fcwyzzr.minecraft.f_lib.registry.FMobEffect @@ -13,8 +13,6 @@ import net.minecraft.world.entity.player.Player /** * apply to non-peaceful player * - * - * * every 20 tick, player has 1/5 chance to receive 2 damage, effected by difficulty */ object Gout: FMobEffect(MobEffectCategory.HARMFUL, 0x801400) { diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/SimpleHarmfulEffects.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/SimpleHarmfulEffects.kt similarity index 90% rename from src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/SimpleHarmfulEffects.kt rename to src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/SimpleHarmfulEffects.kt index 35c26bc..1a7f74d 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/SimpleHarmfulEffects.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/SimpleHarmfulEffects.kt @@ -1,4 +1,4 @@ -package indi.fcwyzzr.minecraft.food_talks.common.effects.harmful +package indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful import indi.fcwyzzr.minecraft.f_lib.registry.FMobEffect import indi.fcwyzzr.minecraft.food_talks.toResourceLocation diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Vomit.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Vomit.kt similarity index 98% rename from src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Vomit.kt rename to src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Vomit.kt index c7a03e3..bf1616d 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/effects/harmful/Vomit.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/mob_effect/harmful/Vomit.kt @@ -1,4 +1,4 @@ -package indi.fcwyzzr.minecraft.food_talks.common.effects.harmful +package indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful import indi.fcwyzzr.minecraft.f_lib.registry.FMobEffect import net.minecraft.client.multiplayer.ClientLevel diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/Tags.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/Tags.kt index 5488fd6..1f05644 100644 --- a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/Tags.kt +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/Tags.kt @@ -1,15 +1,23 @@ package indi.fcwyzzr.minecraft.food_talks.common.registries import indi.fcwyzzr.minecraft.food_talks.toResourceLocation +import net.minecraft.core.registries.BuiltInRegistries import net.minecraft.resources.ResourceLocation import net.minecraft.tags.ItemTags import net.minecraft.tags.TagKey +import net.minecraft.world.effect.MobEffect import net.minecraft.world.item.Item fun ResourceLocation.toItemTag(): TagKey = ItemTags.create(this) - +fun ResourceLocation.toMobEffectTag(): TagKey = TagKey.create( + BuiltInRegistries.MOB_EFFECT.key(), this +) val sandwichCover = "ingredient/sandwich_cover" .toResourceLocation() - .toItemTag() \ No newline at end of file + .toItemTag() + +val milkIrremovable = "milk_irremovable.json" + .toResourceLocation() + .toMobEffectTag() \ No newline at end of file diff --git a/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/deferred/Potions.kt b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/deferred/Potions.kt new file mode 100644 index 0000000..0f9d9c7 --- /dev/null +++ b/src/main/kotlin/indi/fcwyzzr/minecraft/food_talks/common/registries/deferred/Potions.kt @@ -0,0 +1,194 @@ +package indi.fcwyzzr.minecraft.food_talks.common.registries.deferred + +import indi.fcwyzzr.minecraft.f_lib.registry.FPotion +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.beneficial.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.* +import indi.fcwyzzr.minecraft.food_talks.common.mob_effect.harmful.Vomit +import indi.fcwyzzr.minecraft.food_talks.toRegistryName +import net.minecraft.core.Holder +import net.minecraft.core.Registry +import net.minecraft.core.registries.BuiltInRegistries +import net.minecraft.world.effect.MobEffectInstance +import net.minecraft.world.item.alchemy.Potion + +private fun MobEffectInstance.createPotion(name: String? = null) = + FPotion(this, name = name?.toRegistryName()) + +private fun FPotion.register(): Holder.Reference = Registry.registerForHolder( + BuiltInRegistries.POTION, + this.location, + this +) + + +// beneficial +val poisonResistance = PoisonResistance + .createDefaultInstance() + .createPotion() + .register() + +val poisonResistanceII = PoisonResistance + .createUpgradedInstance() + .createPotion("StrongPoisonResistance") + .register() + +val lPoisonResistance = PoisonResistance + .createExtendedInstance() + .createPotion("LongPoisonResistance") + .register() + + +val darknessInfusing = DarknessInfused + .createDefaultInstance() + .createPotion("DarknessInfusing") + .register() + +val darknessInfusingII = DarknessInfused + .createUpgradedInstance() + .createPotion("StrongDarknessInfusing") + .register() + +val lDarknessInfusing = DarknessInfused + .createExtendedInstance() + .createPotion("LongDarknessInfusing") + .register() + +val goddessGrace = GoddessGrace + .createDefaultInstance() + .createPotion("GoddessGrace") + .register() + +val goddessGraceII = GoddessGrace + .createUpgradedInstance() + .createPotion("StrongGoddessGrace") + .register() + +val lGoddessGrace = GoddessGrace + .createExtendedInstance() + .createPotion("LongGoddessGrace") + .register() + +val gameGrace = GameGrace + .createDefaultInstance() + .createPotion("GameGrace") + .register() + +val gameGraceII = GameGrace + .createUpgradedInstance() + .createPotion("StrongGameGrace") + .register() + +val lGameGrace = GameGrace + .createExtendedInstance() + .createPotion("LongGameGrace") + .register() + +val smelly = Smelly + .createDefaultInstance() + .createPotion() + .register() + +val lSmelly = Smelly + .createExtendedInstance() + .createPotion("LongSmelly") + .register() + +val happy = Happy + .createDefaultInstance() + .createPotion() + .register() + +val lHappy = Happy + .createExtendedInstance() + .createPotion("LongHappy") + .register() + +val projectileImmune = ProjectileImmune + .createDefaultInstance() + .createPotion() + .register() + +val lProjectileImmune = ProjectileImmune + .createExtendedInstance() + .createPotion("LongProjectileImmune") + .register() + +val starving = Starving + .createDefaultInstance() + .createPotion() + .register() + +val lStarving = Starving + .createExtendedInstance() + .createPotion("LongStarving") + .register() + +val starvingII = Starving + .createUpgradedInstance() + .createPotion("StrongStarving") + .register() + +val jackHead = JackHead + .createDefaultInstance() + .createPotion() + .register() + +val lJackHead = JackHead + .createExtendedInstance() + .createPotion("LongJackHead") + .register() + +// harmful + +val anorexia = Anorexia + .createDefaultInstance() + .createPotion() + .register() + +val lAnorexia = Anorexia + .createExtendedInstance() + .createPotion("LongAnorexia") + .register() + +val gout = Gout + .createDefaultInstance() + .createPotion() + .register() + +val lGout = Gout + .createExtendedInstance() + .createPotion("LongGout") + .register() + +val vomit = Vomit + .createNewInstance(-1, 0) + .createPotion() + .register() + +val toothache = Toothache + .createDefaultInstance() + .createPotion() + .register() + +val lToothache = Toothache + .createExtendedInstance() + .createPotion("LongToothache") + .register() + +val overweight = Overweight + .createDefaultInstance() + .createPotion() + .register() + +val lOverweight = Overweight + .createExtendedInstance() + .createPotion("LongOverweight") + .register() + +val overweightII = Overweight + .createUpgradedInstance() + .createPotion("StrongOverweight") + .register() + + + diff --git a/src/main/resources/assets/food_talks/lang/en_us.json b/src/main/resources/assets/food_talks/lang/en_us.json index 5345ff1..10d2486 100644 --- a/src/main/resources/assets/food_talks/lang/en_us.json +++ b/src/main/resources/assets/food_talks/lang/en_us.json @@ -1,4 +1,24 @@ { + "block.food_talks.bottle_block": "Glass Bottle", + "block.food_talks.plate_block": "Wooden Plate", + "item.food_talks.cocktail": "Cocktail", + "item.food_talks.Plate": "Wooden Plate", + "item.food_talks.sandwich": "Sandwich", + + "effect.food_talks.poison_resistance": "Poison Resistance", + "effect.food_talks.darkness_infused": "Darkness Infused", + "effect.food_talks.goddess_grace": "Goddess Grace", + "effect.food_talks.game_grace": "Game Grace", + "effect.food_talks.smelly": "Smelly", + "effect.food_talks.happy": "Happiness", + "effect.food_talks.projectile_immune": "Projectile Immunity", + "effect.food_talks.starving": "Starving", + "effect.food_talks.jack_head": "Head' o Jack", + "effect.food_talks.anorexia": "Anorexia", - "item.food_talks.cocktail": "Cocktail" + "effect.food_talks.gout": "Gout", + "effect.food_talks.vomit": "Vomit", + "effect.food_talks.toothache": "Toothache", + "effect.food_talks.overweight": "Overweight" + } \ No newline at end of file diff --git a/src/main/resources/assets/food_talks/lang/zh_cn.json b/src/main/resources/assets/food_talks/lang/zh_cn.json index 3cbe3ed..3afb472 100644 --- a/src/main/resources/assets/food_talks/lang/zh_cn.json +++ b/src/main/resources/assets/food_talks/lang/zh_cn.json @@ -1,4 +1,22 @@ { + "item.food_talks.cocktail": "鸡尾酒", + "block.food_talks.bottle_block": "玻璃瓶", + "block.food_talks.plate_block": "木盘子", + "item.food_talks.Plate": "木盘子", + "item.food_talks.sandwich": "三明治", + "effect.food_talks.poison_resistance": "剧毒抗性", + "effect.food_talks.darkness_infused": "黑暗浸染", + "effect.food_talks.goddess_grace": "女神的恩惠", + "effect.food_talks.game_grace": "游戏的恩惠", + "effect.food_talks.smelly": "膻骚", + "effect.food_talks.happy": "开心", + "effect.food_talks.projectile_immune": "弹射物免疫", + "effect.food_talks.starving": "饥荒", + "effect.food_talks.jack_head": "替身", + "effect.food_talks.anorexia": "厌食症", - "item.food_talks.cocktail": "鸡尾酒" + "effect.food_talks.gout": "痛风", + "effect.food_talks.vomit": "呕吐", + "effect.food_talks.toothache": "牙痛", + "effect.food_talks.overweight": "肥胖" } \ No newline at end of file diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/anorexia.png b/src/main/resources/assets/food_talks/textures/mob_effect/anorexia.png new file mode 100644 index 0000000..686f277 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/anorexia.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/darkness_infused.png b/src/main/resources/assets/food_talks/textures/mob_effect/darkness_infused.png new file mode 100644 index 0000000..1fbef01 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/darkness_infused.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/game_grace.png b/src/main/resources/assets/food_talks/textures/mob_effect/game_grace.png new file mode 100644 index 0000000..b0846ec Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/game_grace.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/goddess_grace.png b/src/main/resources/assets/food_talks/textures/mob_effect/goddess_grace.png new file mode 100644 index 0000000..088b965 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/goddess_grace.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/gout.png b/src/main/resources/assets/food_talks/textures/mob_effect/gout.png new file mode 100644 index 0000000..a71228d Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/gout.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/happy.png b/src/main/resources/assets/food_talks/textures/mob_effect/happy.png new file mode 100644 index 0000000..1398068 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/happy.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/jack_head.png b/src/main/resources/assets/food_talks/textures/mob_effect/jack_head.png new file mode 100644 index 0000000..b94e85a Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/jack_head.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/overweight.png b/src/main/resources/assets/food_talks/textures/mob_effect/overweight.png new file mode 100644 index 0000000..81acc81 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/overweight.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/poison_resistance.png b/src/main/resources/assets/food_talks/textures/mob_effect/poison_resistance.png new file mode 100644 index 0000000..d3fc19d Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/poison_resistance.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/projectile_immune.png b/src/main/resources/assets/food_talks/textures/mob_effect/projectile_immune.png new file mode 100644 index 0000000..4f6e86b Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/projectile_immune.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/smelly.png b/src/main/resources/assets/food_talks/textures/mob_effect/smelly.png new file mode 100644 index 0000000..d99635e Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/smelly.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/starving.png b/src/main/resources/assets/food_talks/textures/mob_effect/starving.png new file mode 100644 index 0000000..310d6d1 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/starving.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/toothache.png b/src/main/resources/assets/food_talks/textures/mob_effect/toothache.png new file mode 100644 index 0000000..558b140 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/toothache.png differ diff --git a/src/main/resources/assets/food_talks/textures/mob_effect/vomit.png b/src/main/resources/assets/food_talks/textures/mob_effect/vomit.png new file mode 100644 index 0000000..624ccd2 Binary files /dev/null and b/src/main/resources/assets/food_talks/textures/mob_effect/vomit.png differ diff --git a/src/main/resources/data/food_talks/tags/mob_effect/milk_irremovable.json b/src/main/resources/data/food_talks/tags/mob_effect/milk_irremovable.json new file mode 100644 index 0000000..56b49cb --- /dev/null +++ b/src/main/resources/data/food_talks/tags/mob_effect/milk_irremovable.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "food_talks:anorexia", + "food_talks:vomit", + "food_talks:overweight", + + "food_talks:goddess_grace", + "food_talks:game_grace" + ] +} \ No newline at end of file