diff --git a/src/main/java/snownee/cuisine/api/CulinaryHub.java b/src/main/java/snownee/cuisine/api/CulinaryHub.java index 37fe7542..76113440 100644 --- a/src/main/java/snownee/cuisine/api/CulinaryHub.java +++ b/src/main/java/snownee/cuisine/api/CulinaryHub.java @@ -100,6 +100,7 @@ public static final class CommonSpices public static final Spice CRUDE_SALT = find("crude_salt"); public static final Spice SALT = find("salt"); public static final Spice SUGAR = find("sugar"); + public static final Spice UNREFINED_SUGAR = find("unrefined_sugar"); private static Spice find(final String uniqueName) { diff --git a/src/main/java/snownee/cuisine/api/prefab/DefaultConsumedCollector.java b/src/main/java/snownee/cuisine/api/prefab/DefaultConsumedCollector.java index ee8a50b4..063e231f 100644 --- a/src/main/java/snownee/cuisine/api/prefab/DefaultConsumedCollector.java +++ b/src/main/java/snownee/cuisine/api/prefab/DefaultConsumedCollector.java @@ -18,6 +18,17 @@ public class DefaultConsumedCollector implements EffectCollector { private final Map mapPotions = new HashMap<>(); + private final float durationModifier; + + public DefaultConsumedCollector() + { + this(1); + } + + public DefaultConsumedCollector(float durationModifier) + { + this.durationModifier = Math.max(durationModifier, 0); + } @Override public void apply(CompositeFood food, EntityPlayer player) @@ -35,7 +46,7 @@ public void apply(CompositeFood food, EntityPlayer player) continue; } PotionEffectInfo info = entry.getValue(); - player.addPotionEffect(new PotionEffect(entry.getKey(), info.duration, info.amplifier, false, info.showParticles)); + player.addPotionEffect(new PotionEffect(entry.getKey(), (int) (info.duration * durationModifier), info.amplifier, false, info.showParticles)); if (info.duration > maxDuration) { maxDuration = info.duration; @@ -44,7 +55,7 @@ public void apply(CompositeFood food, EntityPlayer player) } if (maxDuration > 0) { - player.addPotionEffect(new PotionEffect(CuisineRegistry.EFFECT_RESISTANCE, maxDuration * 2, 0, true, false)); + player.addPotionEffect(new PotionEffect(CuisineRegistry.EFFECT_RESISTANCE, (int) (maxDuration * durationModifier * 2), 0, true, false)); } } diff --git a/src/main/java/snownee/cuisine/internal/CuisineInternalGateway.java b/src/main/java/snownee/cuisine/internal/CuisineInternalGateway.java index 41063e61..53df86c8 100644 --- a/src/main/java/snownee/cuisine/internal/CuisineInternalGateway.java +++ b/src/main/java/snownee/cuisine/internal/CuisineInternalGateway.java @@ -538,8 +538,9 @@ public boolean hasGlowingOverlay(Ingredient ingredient) api.register(new SpiceChiliPowder("chili_powder", 11546150)); api.register(new SimpleSpiceImpl("sichuan_pepper_powder", 8606770)); api.register(new SimpleSpiceImpl("crude_salt", 4673362)); - api.register(new SimpleSpiceImpl("salt", 16383998)); + api.register(new SimpleSpiceImpl("salt", 0xE3E3E3)); api.register(new SimpleSpiceImpl("sugar", 16383998)); + api.register(new SimpleSpiceImpl("unrefined_sugar", 0xB35400)); CulinaryHub.CommonSkills.init(); } @@ -619,9 +620,10 @@ public static void deferredInit() api.fluidToSpiceMapping.put(CuisineFluids.FRUIT_VINEGAR.getName(), CulinaryHub.CommonSpices.FRUIT_VINEGAR); api.fluidToSpiceMapping.put(FluidRegistry.WATER.getName(), CulinaryHub.CommonSpices.WATER); - api.itemToSpiceMapping.put(ItemDefinition.of(CuisineRegistry.MATERIAL.getItemStack(Cuisine.Materials.CHILI_POWDER)), CulinaryHub.CommonSpices.CHILI_POWDER); - api.itemToSpiceMapping.put(ItemDefinition.of(CuisineRegistry.MATERIAL.getItemStack(Cuisine.Materials.SICHUAN_PEPPER_POWDER)), CulinaryHub.CommonSpices.SICHUAN_PEPPER_POWDER); + api.itemToSpiceMapping.put(ItemDefinition.of(CuisineRegistry.MATERIAL, Cuisine.Materials.CHILI_POWDER.getMeta()), CulinaryHub.CommonSpices.CHILI_POWDER); + api.itemToSpiceMapping.put(ItemDefinition.of(CuisineRegistry.MATERIAL, Cuisine.Materials.SICHUAN_PEPPER_POWDER.getMeta()), CulinaryHub.CommonSpices.SICHUAN_PEPPER_POWDER); api.itemToSpiceMapping.put(ItemDefinition.of(Items.SUGAR), CulinaryHub.CommonSpices.SUGAR); + api.itemToSpiceMapping.put(ItemDefinition.of(CuisineRegistry.MATERIAL, Cuisine.Materials.UNREFINED_SUGAR.getMeta()), CulinaryHub.CommonSpices.UNREFINED_SUGAR); api.oreDictToSpiceMapping.put("dustSalt", CulinaryHub.CommonSpices.SALT); api.oreDictToSpiceMapping.put("dustCrudesalt", CulinaryHub.CommonSpices.CRUDE_SALT); diff --git a/src/main/java/snownee/cuisine/internal/food/Drink.java b/src/main/java/snownee/cuisine/internal/food/Drink.java index f7c69f04..8c458903 100644 --- a/src/main/java/snownee/cuisine/internal/food/Drink.java +++ b/src/main/java/snownee/cuisine/internal/food/Drink.java @@ -370,7 +370,32 @@ public Collection getKeywords() public void onEaten(ItemStack stack, World worldIn, EntityPlayer player) { Collection bindings = getEffectBindings(); - EffectCollector collector = new DefaultConsumedCollector(); + float modifier = 1; + for (Seasoning seasoning : seasonings) + { + if (seasoning.getSpice() == CulinaryHub.CommonSpices.UNREFINED_SUGAR) + { + modifier += seasoning.getSize() * 0.1; + } + else if (seasoning.getSpice() == CulinaryHub.CommonSpices.SUGAR) + { + modifier += seasoning.getSize() * 0.2; + } + else if (seasoning.getSpice() == CulinaryHub.CommonSpices.SALT) + { + modifier -= seasoning.getSize() * 0.1; + } + else if (seasoning.getSpice() == CulinaryHub.CommonSpices.CRUDE_SALT) + { + modifier -= seasoning.getSize() * 0.2; + } + else if (seasoning.getSpice() == CulinaryHub.CommonSpices.SOY_SAUCE || seasoning.getSpice() == CulinaryHub.CommonSpices.CHILI_POWDER || seasoning.getSpice() == CulinaryHub.CommonSpices.SICHUAN_PEPPER_POWDER) + { + modifier = 0; + break; + } + } + EffectCollector collector = new DefaultConsumedCollector(modifier); // And then apply them for (IngredientBinding binding : bindings) @@ -441,7 +466,14 @@ else if (drinkType == DrinkType.SMOOTHIE) } collector.addEffect(DefaultTypes.POTION, new PotionEffect(potion, duration, 0, true, true)); } - collector.apply(this, player); + if (modifier <= 0.1F) + { + player.addPotionEffect(new PotionEffect(worldIn.rand.nextBoolean() ? MobEffects.SLOWNESS : MobEffects.MINING_FATIGUE, 1200)); + } + else if (modifier > 0.25F) + { + collector.apply(this, player); + } if (drinkType == DrinkType.SMOOTHIE) { player.extinguish();