Skip to content

Commit

Permalink
Increase Gourmaryllis internal buffer size
Browse files Browse the repository at this point in the history
Adjusts internal buffer size of Gourmaryllis to allow food with maximum supported hunger restoration value to still fully benefit from maximum streak bonus.
  • Loading branch information
TheRealWormbo committed Sep 27, 2023
1 parent 1af050d commit 1b77ab0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public class GourmaryllisBlockEntity extends GeneratingFlowerBlockEntity {
public static final String TAG_STREAK_LENGTH = "streakLength";
private static final int RANGE = 1;
private static final double[] STREAK_MULTIPLIERS = { 0, 1, 1.3, 1.5, 1.6, 1.7, 1.75, 1.8 };
private static final int MAX_FOOD_VALUE = 12;
private static final int FOOD_COOLDOWN_FACTOR = 10;
private static final int FOOD_MANA_FACTOR = 70;
private static final int MAX_MANA = getDigestingMana(MAX_FOOD_VALUE, STREAK_MULTIPLIERS[STREAK_MULTIPLIERS.length - 1]);

private int cooldown = 0;
private int digestingMana = 0;
Expand Down Expand Up @@ -130,10 +134,9 @@ public void tickFlower() {
if (cooldown <= 0) {
streakLength = Math.min(streakLength + 1, processFood(stack));

int val = Math.min(12, stack.getItem().getFoodProperties().getNutrition());
digestingMana = val * val * 70;
digestingMana *= getMultiplierForStreak(streakLength);
cooldown = val * 10;
int val = getFoodValue(stack);
digestingMana = getDigestingMana(val, getMultiplierForStreak(streakLength));
cooldown = getCooldown(val);
//Usage of vanilla sound event: Subtitle is "Eating", generic sounds are meant to be reused.
item.playSound(SoundEvents.GENERIC_EAT, 0.2F, 0.6F);
sync();
Expand All @@ -145,6 +148,18 @@ public void tickFlower() {
}
}

private static int getCooldown(int foodValue) {
return foodValue * FOOD_COOLDOWN_FACTOR;
}

private static int getDigestingMana(int foodValue, double streakFactor) {
return (int) (foodValue * foodValue * FOOD_MANA_FACTOR * streakFactor);
}

private static int getFoodValue(ItemStack stack) {
return Math.min(MAX_FOOD_VALUE, stack.getItem().getFoodProperties().getNutrition());
}

@Override
public void writeToPacketNBT(CompoundTag cmp) {
super.writeToPacketNBT(cmp);
Expand Down Expand Up @@ -180,7 +195,7 @@ public RadiusDescriptor getRadius() {

@Override
public int getMaxMana() {
return 9000;
return MAX_MANA;
}

@Override
Expand Down
1 change: 1 addition & 0 deletions web/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and start a new "Upcoming" section.
* Add: Manufactory Halo shows active status in its icon (Wormbo)
* Add: Tuff now convertable by Marimorphosis
* Change: Key of the King's Law no longer hurts items or most other nonliving entities
* Change: The internal mana buffer of the Gourmaryllis is now large enough to benefit from streak bonus even with very nutritious food like Rabbit Stew or high quality modded foods (it still caps the food value at 12 points or 6 haunches)
* Change: Removed desu gun and its associated advancement. The reference has overstayed its welcome.
* Fix: Ender Air emission not being mentioned in Pure Daisy entry (Wormbo)

Expand Down

0 comments on commit 1b77ab0

Please sign in to comment.