Skip to content

Commit 8e2d035

Browse files
committed
feat: ✨ Updated feeding upgrade to not eat ominous bottles and added support for drinking ominous bottles in Alchemy upgrade
1 parent 4d1ca78 commit 8e2d035

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ loader_version_range=[4,)
1313
mod_id=sophisticatedcore
1414
mod_name=Sophisticated Core
1515
mod_license=All Rights Reserved
16-
mod_version=1.3.55
16+
mod_version=1.3.56
1717
mod_group_id=sophisticatedcore
1818
mod_authors=P3pp3rF1y
1919
mod_description=A library / shared functionality mod for Sophisticated Storage and Backpacks

src/main/java/net/p3pp3rf1y/sophisticatedcore/upgrades/alchemy/AlchemyUpgradeWrapper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ public static void addItemDefinition(AlchemyItemDefinition itemDefinition) {
225225
}
226226

227227
static {
228+
addItemDefinition(new AlchemyItemDefinition(stack -> stack.getItem() == Items.OMINOUS_BOTTLE, stack -> AlchemyCondition.ALWAYS,
229+
(le, potionStack, matchAllEffects, matchEffectAmplifier) -> !le.hasEffect(MobEffects.BAD_OMEN),
230+
(stack, filter, matchAllEffects, matchEffectDuration, matchEffectAmplifier) -> stack.getItem() == Items.OMINOUS_BOTTLE,
231+
ItemStack::getUseDuration,
232+
(stack, livingEntity) -> stack.getItem().finishUsingItem(stack, livingEntity.level(), livingEntity)
233+
));
228234
addItemDefinition(new AlchemyItemDefinition(stack -> stack.getItem() == Items.SPLASH_POTION, AlchemyUpgradeWrapper::getDefaultConditionForPotion,
229235
AlchemyUpgradeWrapper::shouldApplyPotionEffectsTo, AlchemyUpgradeWrapper::stackPotionEffectsMatch,
230236
(stack, livingEntity) -> {

src/main/java/net/p3pp3rf1y/sophisticatedcore/upgrades/feeding/FeedingUpgradeWrapper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.minecraft.world.entity.player.Player;
1010
import net.minecraft.world.food.FoodProperties;
1111
import net.minecraft.world.item.ItemStack;
12+
import net.minecraft.world.item.Items;
1213
import net.minecraft.world.level.Level;
1314
import net.minecraft.world.phys.AABB;
1415
import net.neoforged.neoforge.capabilities.Capabilities;
@@ -111,6 +112,10 @@ private boolean tryFeedingStack(Level level, int hungerLevel, Player player, Int
111112
}
112113

113114
private boolean isHungryEnoughForFood(int hungerLevel, ItemStack stack) {
115+
if (stack.getItem() == Items.OMINOUS_BOTTLE) {
116+
return false; // Don't eat ominous bottle at all
117+
}
118+
114119
FoodProperties foodProperties = stack.get(DataComponents.FOOD);
115120
if (foodProperties == null) {
116121
return false;

0 commit comments

Comments
 (0)