Skip to content

Commit

Permalink
repackage MealBooster and Seasoning, add javadocs, verbump
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed Feb 10, 2020
1 parent 497ca58 commit 1abbf20
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 39 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_build=3
loader_version=0.7.2+build.175

# Mod Properties
mod_version = 2.2.3
mod_version = 2.2.4
maven_group = io.github.cottonmc
archives_base_name = epicurean

Expand Down
5 changes: 1 addition & 4 deletions src/main/java/io/github/cottonmc/epicurean/Epicurean.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
import io.github.cottonmc.epicurean.block.crop.EpicureanCrops;
import io.github.cottonmc.epicurean.item.EpicureanItems;
import io.github.cottonmc.epicurean.meal.IngredientProfiles;
import io.github.cottonmc.epicurean.meal.MealBooster;
import io.github.cottonmc.epicurean.meal.SkillCheckMealBooster;
import io.github.cottonmc.epicurean.recipe.EpicureanRecipes;
import io.github.cottonmc.epicurean.util.EpicureanConfig;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.resource.ResourceType;
Expand Down Expand Up @@ -44,7 +41,7 @@ public void onInitialize() {
CropGeneration.registerCrops();
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(new IngredientProfiles());

// if (FabricLoader.getInstance().isModLoaded("skillcheck")) MealBooster.BOOSTERS.add(new SkillCheckMealBooster());
// if (FabricLoader.getInstance().isModLoaded("skillcheck")) MealBooster.BOOSTERS.add(new SkillCheckMealBooster()); TODO: port SkillCheck back up
}

}
46 changes: 46 additions & 0 deletions src/main/java/io/github/cottonmc/epicurean/api/MealBooster.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package io.github.cottonmc.epicurean.api;

import io.github.cottonmc.epicurean.container.CookingInventory;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.item.ItemStack;

import java.util.ArrayList;
import java.util.List;

/**
* A hook for other mods to add bonuses to meals.
*/
public interface MealBooster {
List<MealBooster> BOOSTERS = new ArrayList<>();

/**
* Add extra status effects to a meal.
* @param effects The effects on this meal.
* @param seasonings The seasonings being added.
* @param inv The inventory crafting this meal.
* @return All the effects this meal should have, including the ones previously passed in.
*/
default List<StatusEffectInstance> addBoostEffects(List<StatusEffectInstance> effects, List<ItemStack> seasonings, CookingInventory inv) {
return new ArrayList<>();
}

/**
* Add extra hunger restoration to a meal.
* @param seasonings The seasonings being added.
* @param inv The inventory crafting this meal.
* @return How much extra hunger this meal should restore.
*/
default int addBoostHunger(List<ItemStack> seasonings, CookingInventory inv) {
return 0;
}

/**
* Add extra saturation restoration to a meal.
* @param seasonings The seasonings being added.
* @param inv The inventory crafting this emal.
* @return How much extra saturation this meal should restore.
*/
default float addBoostSaturation(List<ItemStack> seasonings, CookingInventory inv) {
return 0f;
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
package io.github.cottonmc.epicurean.item;
package io.github.cottonmc.epicurean.api;

import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.item.ItemStack;

import javax.annotation.Nullable;

public interface Seasoning {
/**
* @param stack the stack of the item in question
* @return how much hunger restoration a seasoning in that stack should add to a meal
* @param stack the stack of the item in question.
* @return how much hunger restoration a seasoning in that stack should add to a meal.
*/
int getHungerRestored(ItemStack stack);

/**
* @param stack the stack of the item in question
* @return how much saturation a seasoning in that stack should add to a meal
* @param stack the stack of the item in question.
* @return how much saturation a seasoning in that stack should add to a meal.
*/
float getSaturationModifier(ItemStack stack);

/**
* @param stack the stack of the item in question
* @return what status effect a seasoning in that stack should add to a meal
* @param stack the stack of the item in question.
* @return what status effect a seasoning in that stack should add to a meal, or null if none.
*/
@Nullable
default StatusEffectInstance getBonusEffect(ItemStack stack) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.cottonmc.epicurean.item;

import io.github.cottonmc.epicurean.api.Seasoning;
import io.github.cottonmc.epicurean.meal.IngredientProfiles;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/io/github/cottonmc/epicurean/meal/MealBooster.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.cottonmc.epicurean.meal;

import io.github.cottonmc.epicurean.api.MealBooster;
import io.github.cottonmc.epicurean.container.CookingInventory;
import io.github.cottonmc.epicurean.recipe.MealRecipe;
//import io.github.cottonmc.skillcheck.SkillCheck;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.cottonmc.epicurean.mixins;

import io.github.cottonmc.epicurean.item.Seasoning;
import io.github.cottonmc.epicurean.api.Seasoning;
import io.github.cottonmc.epicurean.meal.IngredientProfiles;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import io.github.cottonmc.epicurean.Epicurean;
import io.github.cottonmc.epicurean.container.CookingInventory;
import io.github.cottonmc.epicurean.item.EpicureanItems;
import io.github.cottonmc.epicurean.item.Seasoning;
import io.github.cottonmc.epicurean.api.Seasoning;
import io.github.cottonmc.epicurean.meal.FlavorGroup;
import io.github.cottonmc.epicurean.meal.IngredientProfiles;
import io.github.cottonmc.epicurean.meal.MealBooster;
import io.github.cottonmc.epicurean.api.MealBooster;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.inventory.CraftingInventory;
Expand Down

0 comments on commit 1abbf20

Please sign in to comment.