From 06d69297fc4be64d8b24be28b38949378d112c65 Mon Sep 17 00:00:00 2001 From: Elenterius Date: Thu, 3 Oct 2024 17:16:31 +0200 Subject: [PATCH 1/9] fix: fix crash when drinking milk under the frenzy effect --- .../biomancy/mixin/LivingEntityMixin.java | 64 ++++++++++++++++++- .../statuseffect/StatusEffectHandler.java | 52 ++++++++++++--- 2 files changed, 105 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/elenterius/biomancy/mixin/LivingEntityMixin.java b/src/main/java/com/github/elenterius/biomancy/mixin/LivingEntityMixin.java index 1f45c741..95e669e3 100644 --- a/src/main/java/com/github/elenterius/biomancy/mixin/LivingEntityMixin.java +++ b/src/main/java/com/github/elenterius/biomancy/mixin/LivingEntityMixin.java @@ -5,10 +5,13 @@ import com.github.elenterius.biomancy.item.ShieldBlockingListener; import com.github.elenterius.biomancy.serum.FrenzySerum; import com.github.elenterius.biomancy.statuseffect.StatusEffectHandler; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeMap; @@ -19,26 +22,42 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.Collection; +import java.util.Map; + @Mixin(LivingEntity.class) -public abstract class LivingEntityMixin { +public abstract class LivingEntityMixin extends Entity { @Shadow protected ItemStack useItem; + private LivingEntityMixin(EntityType entityType, Level level) { + super(entityType, level); + } + @Shadow public abstract boolean hasEffect(MobEffect effect); @Shadow public abstract AttributeMap getAttributes(); + @Shadow + @Final + private Map activeEffects; + + @Shadow + public abstract Collection getActiveEffects(); + @Inject(method = "getAttributeValue(Lnet/minecraft/world/entity/ai/attributes/Attribute;)D", at = @At("HEAD"), cancellable = true) protected void onGetAttributeValue(Attribute attribute, CallbackInfoReturnable cir) { if (attribute == Attributes.ATTACK_DAMAGE && !getAttributes().hasAttribute(Attributes.ATTACK_DAMAGE) && hasEffect(ModMobEffects.FRENZY.get())) { @@ -77,6 +96,49 @@ private void onAddEatEffect(ItemStack food, Level level, LivingEntity livingEnti } } + @ModifyArg( + method = "curePotionEffects", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;onEffectRemoved(Lnet/minecraft/world/effect/MobEffectInstance;)V"), + remap = false + ) + private MobEffectInstance onCurePotionEffects(MobEffectInstance effectInstance, @Share("removedFrenzy") LocalRef removedFrenzyRef) { + if (effectInstance.getEffect() == ModMobEffects.FRENZY.get()) { + removedFrenzyRef.set(effectInstance); + } + return effectInstance; + } + + @Inject(method = "curePotionEffects", at = @At(value = "TAIL"), remap = false) + private void onPostCurePotionEffects(ItemStack curativeItem, CallbackInfoReturnable cir, @Share("removedFrenzy") LocalRef removedFrenzyRef) { + if (level().isClientSide) return; + + MobEffectInstance removedFrenzyEffect = removedFrenzyRef.get(); + if (removedFrenzyEffect == null) return; + + StatusEffectHandler.addWithdrawalAfterFrenzy(biomancy$self(), removedFrenzyEffect); + } + + @ModifyArg( + method = "tickEffects", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;onEffectRemoved(Lnet/minecraft/world/effect/MobEffectInstance;)V") + ) + private MobEffectInstance onTickEffects(MobEffectInstance effectInstance, @Share("expiredFrenzy") LocalRef expiredFrenzyRef) { + if (effectInstance.getEffect() == ModMobEffects.FRENZY.get()) { + expiredFrenzyRef.set(effectInstance); + } + return effectInstance; + } + + @Inject(method = "tickEffects", at = @At(value = "TAIL")) + private void onPostTickEffects(CallbackInfo ci, @Share("expiredFrenzy") LocalRef expiredFrenzyRef) { + if (level().isClientSide) return; + + MobEffectInstance removedFrenzyEffect = expiredFrenzyRef.get(); + if (removedFrenzyEffect == null) return; + + StatusEffectHandler.addWithdrawalAfterFrenzy(biomancy$self(), removedFrenzyEffect); + } + @Unique private static int biomancy$getRawMeatNutrition(ItemStack itemStack) { if (!itemStack.isEdible()) return 0; diff --git a/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java b/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java index 9f088d41..1ca62e24 100644 --- a/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java +++ b/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java @@ -13,12 +13,15 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.WorldWorkerManager; import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; import net.minecraftforge.event.entity.living.MobEffectEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import org.jetbrains.annotations.Nullable; +import java.util.function.Consumer; + @Mod.EventBusSubscriber(modid = BiomancyMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public final class StatusEffectHandler { @@ -31,17 +34,12 @@ public static void onEffectRemoval(final MobEffectEvent.Remove event) { if (event.getEffect() == ModMobEffects.ESSENCE_ANEMIA.get() && ModMobEffectTags.isNotRemovableWithCleansingSerum(ModMobEffects.ESSENCE_ANEMIA.get())) { event.setCanceled(true); } - - addWithdrawalAfterFrenzy(event.getEntity(), event.getEffectInstance()); - } - - @SubscribeEvent - public static void onEffectExpiry(final MobEffectEvent.Expired event) { - if (event.getEntity().level().isClientSide) return; - addWithdrawalAfterFrenzy(event.getEntity(), event.getEffectInstance()); } - private static void addWithdrawalAfterFrenzy(LivingEntity livingEntity, @Nullable MobEffectInstance removedEffectInstance) { + /** + * We can't call this method from within a MobEffectEvent due to ConcurrentModification Exceptions + */ + public static void addWithdrawalAfterFrenzy(LivingEntity livingEntity, @Nullable MobEffectInstance removedEffectInstance) { if (removedEffectInstance == null) return; if (removedEffectInstance.getEffect() != ModMobEffects.FRENZY.get()) return; @@ -64,11 +62,18 @@ public static void reduceWithdrawal(int nutrition, LivingEntity livingEntity) { MobEffectInstance withdrawalEffect = livingEntity.getEffect(ModMobEffects.WITHDRAWAL.get()); if (withdrawalEffect != null) { int duration = withdrawalEffect.getDuration() - ((nutrition * nutrition / 2 + 4) * 20); //decrease effect duration by at least 4 sec + if (withdrawalEffect != null && !withdrawalEffect.isInfiniteDuration()) { int amplifier = withdrawalEffect.getAmplifier(); boolean ambient = withdrawalEffect.isAmbient(); boolean visible = withdrawalEffect.isVisible(); boolean showIcon = withdrawalEffect.showIcon(); - overrideMobEffect(livingEntity, new MobEffectInstance(ModMobEffects.WITHDRAWAL.get(), duration, amplifier, ambient, visible, showIcon)); + + if (duration <= 0) { + livingEntity.removeEffect(withdrawalEffect.getEffect()); + } + else { + overrideMobEffect(livingEntity, new MobEffectInstance(ModMobEffects.WITHDRAWAL.get(), duration, amplifier, ambient, visible, showIcon)); + } } } @@ -108,4 +113,31 @@ else if (effect == MobEffects.HARM) { return true; } + public static void modifyOnNextWorldTick(LivingEntity livingEntity, Consumer modify) { + WorldWorkerManager.addWorker(new OneShotTaskWorker() { + @Override + public void doTask() { + if (livingEntity.isAlive()) { + modify.accept(livingEntity); + } + } + }); + } + + private abstract static class OneShotTaskWorker implements WorldWorkerManager.IWorker { + + @Override + public boolean hasWork() { + return false; + } + + @Override + public boolean doWork() { + doTask(); + return false; + } + + public abstract void doTask(); + } + } From 79d565c9a1725b5ac1625a3af605781ffba2c44e Mon Sep 17 00:00:00 2001 From: Elenterius Date: Thu, 3 Oct 2024 17:31:20 +0200 Subject: [PATCH 2/9] feat: tweak withdrawal effect side effects, add poison side effect and buff withdrawal duration reduction from eating sugary food --- .../biomancy/mixin/client/ForgeGuiMixin.java | 28 +++++++++++++++++++ .../biomancy/mixin/client/HeartTypeMixin.java | 21 ++++++++++++++ .../statuseffect/StatusEffectHandler.java | 3 +- .../statuseffect/WithdrawalEffect.java | 24 ++++++++++++++-- .../resources/META-INF/accesstransformer.cfg | 1 + src/main/resources/mixins.biomancy.json | 2 +- 6 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/github/elenterius/biomancy/mixin/client/ForgeGuiMixin.java create mode 100644 src/main/java/com/github/elenterius/biomancy/mixin/client/HeartTypeMixin.java diff --git a/src/main/java/com/github/elenterius/biomancy/mixin/client/ForgeGuiMixin.java b/src/main/java/com/github/elenterius/biomancy/mixin/client/ForgeGuiMixin.java new file mode 100644 index 00000000..207e3edc --- /dev/null +++ b/src/main/java/com/github/elenterius/biomancy/mixin/client/ForgeGuiMixin.java @@ -0,0 +1,28 @@ +package com.github.elenterius.biomancy.mixin.client; + +import com.github.elenterius.biomancy.init.ModMobEffects; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraftforge.client.gui.overlay.ForgeGui; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(ForgeGui.class) +public abstract class ForgeGuiMixin extends Gui { + + private ForgeGuiMixin(Minecraft minecraft, ItemRenderer itemRenderer) { + super(minecraft, itemRenderer); + } + + @ModifyExpressionValue(method = "renderFood", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;hasEffect(Lnet/minecraft/world/effect/MobEffect;)Z")) + private boolean canRenderFoodHunger(boolean hasHungerEffect) { + //noinspection DataFlowIssue + if (!hasHungerEffect && minecraft.player.hasEffect(ModMobEffects.WITHDRAWAL.get())) { + return true; + } + return hasHungerEffect; + } + +} diff --git a/src/main/java/com/github/elenterius/biomancy/mixin/client/HeartTypeMixin.java b/src/main/java/com/github/elenterius/biomancy/mixin/client/HeartTypeMixin.java new file mode 100644 index 00000000..88420b22 --- /dev/null +++ b/src/main/java/com/github/elenterius/biomancy/mixin/client/HeartTypeMixin.java @@ -0,0 +1,21 @@ +package com.github.elenterius.biomancy.mixin.client; + +import com.github.elenterius.biomancy.init.ModMobEffects; +import net.minecraft.client.gui.Gui; +import net.minecraft.world.entity.player.Player; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Gui.HeartType.class) +public abstract class HeartTypeMixin { + + @Inject(method = "forPlayer", at = @At("HEAD"), cancellable = true) + private static void onForPlayer(Player player, CallbackInfoReturnable cir) { + if (player.hasEffect(ModMobEffects.WITHDRAWAL.get())) { + cir.setReturnValue(Gui.HeartType.POISIONED); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java b/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java index 1ca62e24..3fa65268 100644 --- a/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java +++ b/src/main/java/com/github/elenterius/biomancy/statuseffect/StatusEffectHandler.java @@ -60,9 +60,8 @@ public static void onFoodEaten(final LivingEntityUseItemEvent.Finish event) { public static void reduceWithdrawal(int nutrition, LivingEntity livingEntity) { MobEffectInstance withdrawalEffect = livingEntity.getEffect(ModMobEffects.WITHDRAWAL.get()); - if (withdrawalEffect != null) { - int duration = withdrawalEffect.getDuration() - ((nutrition * nutrition / 2 + 4) * 20); //decrease effect duration by at least 4 sec if (withdrawalEffect != null && !withdrawalEffect.isInfiniteDuration()) { + int duration = withdrawalEffect.getDuration() - ((nutrition * nutrition + 5) * 3 * 20); //decrease effect duration by at least 4 sec int amplifier = withdrawalEffect.getAmplifier(); boolean ambient = withdrawalEffect.isAmbient(); boolean visible = withdrawalEffect.isVisible(); diff --git a/src/main/java/com/github/elenterius/biomancy/statuseffect/WithdrawalEffect.java b/src/main/java/com/github/elenterius/biomancy/statuseffect/WithdrawalEffect.java index f52f4f5a..f53eafd9 100644 --- a/src/main/java/com/github/elenterius/biomancy/statuseffect/WithdrawalEffect.java +++ b/src/main/java/com/github/elenterius/biomancy/statuseffect/WithdrawalEffect.java @@ -16,13 +16,31 @@ public WithdrawalEffect(int color) { @Override public void applyEffectTick(LivingEntity livingEntity, int amplifier) { if (livingEntity instanceof Player player) { - if (livingEntity.getRandom().nextFloat() < 0.1f) { - livingEntity.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 20 * livingEntity.getRandom().nextIntBetweenInclusive(3, 7 + amplifier * 2), 0)); + + if (livingEntity.getRandom().nextFloat() < 0.09f) { + if (amplifier < 1) { + if (livingEntity.getRandom().nextFloat() < 0.7f) { + MobEffectInstance effectInstance = new MobEffectInstance(MobEffects.CONFUSION, 20 * livingEntity.getRandom().nextIntBetweenInclusive(3, 5), 0); + StatusEffectHandler.modifyOnNextWorldTick(livingEntity, living -> living.addEffect(effectInstance)); + } + player.causeFoodExhaustion(1.5F); + } + else if (amplifier < 2 || livingEntity.getRandom().nextFloat() < 0.4f) { + MobEffectInstance effectInstance = new MobEffectInstance(MobEffects.CONFUSION, 20 * livingEntity.getRandom().nextIntBetweenInclusive(3, 4 + amplifier * 2), 1); + StatusEffectHandler.modifyOnNextWorldTick(livingEntity, living -> living.addEffect(effectInstance)); + player.causeFoodExhaustion(2F * (amplifier + 1f)); + } + else { + if (livingEntity.getHealth() > 1f) { + livingEntity.hurt(livingEntity.damageSources().magic(), 1f); + } + player.causeFoodExhaustion(0.5F); + } } + if (!livingEntity.isSleeping()) { player.awardStat(Stats.CUSTOM.get(Stats.TIME_SINCE_REST), 20 * 2); //increase insomnia counter } - player.causeFoodExhaustion(0.05F * (amplifier + 1f)); } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 3c432270..d06e4921 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -2,3 +2,4 @@ public net.minecraft.world.item.crafting.RecipeManager m_44054_(Lnet/minecraft/w protected net.minecraft.client.gui.components.EditBox m_94219_()Z # isBordered protected net.minecraft.world.level.material.FlowingFluid m_75963_(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/world/level/material/Fluid;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/material/FluidState;)Z # canPassThrough protected net.minecraft.world.level.block.TrapDoorBlock f_271458_ # type +public net.minecraft.client.gui.Gui$HeartType diff --git a/src/main/resources/mixins.biomancy.json b/src/main/resources/mixins.biomancy.json index 31044d51..88494883 100644 --- a/src/main/resources/mixins.biomancy.json +++ b/src/main/resources/mixins.biomancy.json @@ -18,7 +18,7 @@ ], "client": [ "accessor.RecipeCollectionAccessor", "client.AbstractSignEditScreenMixin", "client.AnvilScreenMixin", "client.ClientPackListenerMixin", - "client.ClientRecipeBookMixin", "client.GuiGraphicsMixin", "client.PlayerRendererMixin" + "client.ClientRecipeBookMixin", "client.ForgeGuiMixin", "client.GuiGraphicsMixin", "client.HeartTypeMixin", "client.PlayerRendererMixin" ], "server": [ ] } \ No newline at end of file From 1d4920599e20cbf505f5d78eba4a2efa2efefd96 Mon Sep 17 00:00:00 2001 From: Elenterius Date: Thu, 3 Oct 2024 22:25:20 +0200 Subject: [PATCH 3/9] fix: don't render outer skin layer when wearing acolyte armor --- .../biomancy/mixin/PlayerMixin.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/java/com/github/elenterius/biomancy/mixin/PlayerMixin.java b/src/main/java/com/github/elenterius/biomancy/mixin/PlayerMixin.java index 7dc89b99..6f664a2a 100644 --- a/src/main/java/com/github/elenterius/biomancy/mixin/PlayerMixin.java +++ b/src/main/java/com/github/elenterius/biomancy/mixin/PlayerMixin.java @@ -1,6 +1,7 @@ package com.github.elenterius.biomancy.mixin; import com.github.elenterius.biomancy.init.ModDamageTypes; +import com.github.elenterius.biomancy.init.ModItems; import com.github.elenterius.biomancy.item.ItemAttackDamageSourceProvider; import com.github.elenterius.biomancy.item.SweepAttackListener; import com.github.elenterius.biomancy.item.shield.LivingShieldItem; @@ -10,20 +11,27 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.PlayerModelPart; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Player.class) public abstract class PlayerMixin extends LivingEntity { + @Shadow + public abstract ItemStack getItemBySlot(EquipmentSlot slot); + protected PlayerMixin(EntityType entityType, Level level) { super(entityType, level); } @@ -89,4 +97,21 @@ private void onHurtCurrentlyUsedShield(float damage, CallbackInfo ci) { } } + @Inject(method = "isModelPartShown", at = @At("HEAD"), cancellable = true) + private void onIsModelPartShown(PlayerModelPart part, CallbackInfoReturnable cir) { + //don't render outer skin overlay when wearing the acolyte armor to prevent z-fighting, etc. + switch (part) { + case HAT -> { + if (getItemBySlot(EquipmentSlot.HEAD).is(ModItems.ACOLYTE_ARMOR_HELMET.get())) cir.setReturnValue(false); + } + case JACKET, LEFT_SLEEVE, RIGHT_SLEEVE -> { + if (getItemBySlot(EquipmentSlot.CHEST).is(ModItems.ACOLYTE_ARMOR_CHESTPLATE.get())) cir.setReturnValue(false); + } + case LEFT_PANTS_LEG, RIGHT_PANTS_LEG -> { + if (getItemBySlot(EquipmentSlot.LEGS).is(ModItems.ACOLYTE_ARMOR_LEGGINGS.get())) cir.setReturnValue(false); + } + case CAPE -> {} + } + } + } From e6656c5b0cbad19e5e0c977198058b60a61ef168 Mon Sep 17 00:00:00 2001 From: Elenterius Date: Thu, 3 Oct 2024 23:55:06 +0200 Subject: [PATCH 4/9] feat(nerf): make frenzy effect consume food --- .../biomancy/statuseffect/FrenzyEffect.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/github/elenterius/biomancy/statuseffect/FrenzyEffect.java b/src/main/java/com/github/elenterius/biomancy/statuseffect/FrenzyEffect.java index daeef636..d435374c 100644 --- a/src/main/java/com/github/elenterius/biomancy/statuseffect/FrenzyEffect.java +++ b/src/main/java/com/github/elenterius/biomancy/statuseffect/FrenzyEffect.java @@ -1,6 +1,8 @@ package com.github.elenterius.biomancy.statuseffect; import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; public class FrenzyEffect extends AttackDamageEffect implements StackingStatusEffect { @@ -13,4 +15,16 @@ public int getMaxEffectStack() { return 3; } + @Override + public boolean isDurationEffectTick(int duration, int amplifier) { + return duration % 20 == 0; + } + + @Override + public void applyEffectTick(LivingEntity livingEntity, int amplifier) { + if (livingEntity instanceof Player player) { + player.causeFoodExhaustion(0.15f * (amplifier + 1f)); + } + } + } From 707840e7f78b2bf707f36f77fffd9b8741858091 Mon Sep 17 00:00:00 2001 From: Elenterius Date: Fri, 4 Oct 2024 23:32:47 +0200 Subject: [PATCH 5/9] chore: add utility method for matching recipes with the last know recipe id first before doing a lookup --- .../crafting/recipe/SimpleRecipeType.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/elenterius/biomancy/crafting/recipe/SimpleRecipeType.java b/src/main/java/com/github/elenterius/biomancy/crafting/recipe/SimpleRecipeType.java index 33d9ab52..660ef6be 100644 --- a/src/main/java/com/github/elenterius/biomancy/crafting/recipe/SimpleRecipeType.java +++ b/src/main/java/com/github/elenterius/biomancy/crafting/recipe/SimpleRecipeType.java @@ -1,5 +1,6 @@ package com.github.elenterius.biomancy.crafting.recipe; +import com.mojang.datafixers.util.Pair; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; @@ -10,6 +11,7 @@ import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; +import java.util.Map; import java.util.Optional; public class SimpleRecipeType> implements RecipeType { @@ -50,18 +52,36 @@ public Optional getRecipeFromContainer(Level level, Container inputInventory) return (R) recipe; } + private boolean matches(R recipe, ItemStack stack) { + for (Ingredient ingredient : recipe.getIngredients()) { + if (ingredient.test(stack)) return true; + } + return false; + } + public Optional getRecipeForIngredient(Level level, ItemStack stack) { RecipeManager recipeManager = level.getRecipeManager(); return recipeManager.byType(this).values().stream() - .filter(recipe -> { - for (Ingredient ingredient : recipe.getIngredients()) { - if (ingredient.test(stack)) return true; - } - return false; - }) + .filter(recipe -> matches(recipe, stack)) .findFirst().map(this::castRecipe); } + public Optional> getRecipeForIngredient(Level level, ItemStack stack, @Nullable ResourceLocation lastRecipeId) { + RecipeManager recipeManager = level.getRecipeManager(); + + Map map = recipeManager.byType(this); + if (lastRecipeId != null) { + R recipe = map.get(lastRecipeId); + if (recipe != null && matches(recipe, stack)) { + return Optional.of(Pair.of(lastRecipeId, recipe)); + } + } + + return map.entrySet().stream() + .filter(entry -> matches(entry.getValue(), stack)) + .findFirst() + .map(entry -> Pair.of(entry.getKey(), entry.getValue())); + } } } From 2ae27b13505288f6051d4fa1d93d99defdd658b2 Mon Sep 17 00:00:00 2001 From: Elenterius Date: Sat, 5 Oct 2024 01:23:06 +0200 Subject: [PATCH 6/9] feat: rebrand Corrosive Additive to Decaying Additive --- .../biomancy/datagen/lang/EnglishLangProvider.java | 8 ++++---- .../biomancy/datagen/lang/PirateLangProvider.java | 2 +- .../datagen/models/ModItemModelProvider.java | 2 +- .../datagen/recipes/BioLabRecipeProvider.java | 10 ++++++---- .../resources/assets/biomancy/lang/en_pt.json | 4 ++-- .../resources/assets/biomancy/lang/en_us.json | 10 +++++----- ...rrosive_additive.json => decaying_additive.json} | 2 +- ...json => decaying_additive_from_bio_brewing.json} | 4 ++-- .../bio_brewing/ageing_serum_from_bio_brewing.json | 5 +---- .../cleansing_serum_from_bio_brewing.json | 2 +- ...json => decaying_additive_from_bio_brewing.json} | 4 ++-- .../healing_additive_from_bio_brewing.json | 2 +- .../organic_compound_from_bio_brewing.json | 8 +++++++- .../rejuvenation_serum_from_bio_brewing.json | 2 +- .../shrinking_serum_from_bio_brewing.json | 4 ++-- .../elenterius/biomancy/api/tribute/Tributes.java | 2 +- .../elenterius/biomancy/init/MigrationHandler.java | 2 ++ .../github/elenterius/biomancy/init/ModItems.java | 2 +- ...corrosive_additive.png => decaying_additive.png} | Bin 19 files changed, 41 insertions(+), 34 deletions(-) rename src/generated/resources/assets/biomancy/models/item/{corrosive_additive.json => decaying_additive.json} (53%) rename src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/{corrosive_additive_from_bio_brewing.json => decaying_additive_from_bio_brewing.json} (80%) rename src/generated/resources/data/biomancy/recipes/bio_brewing/{corrosive_additive_from_bio_brewing.json => decaying_additive_from_bio_brewing.json} (75%) rename src/main/resources/assets/biomancy/textures/item/serum/{corrosive_additive.png => decaying_additive.png} (100%) diff --git a/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/EnglishLangProvider.java b/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/EnglishLangProvider.java index cb9bcde1..22a2a5df 100644 --- a/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/EnglishLangProvider.java +++ b/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/EnglishLangProvider.java @@ -471,7 +471,7 @@ private void addItemTranslations() { addItem(ModItems.BLOOMBERRY, "Bloomberry", "An exotic delicacy which has a bioluminescent sheen and grants random potion effects when eaten."); addItem(ModItems.REGENERATIVE_FLUID, "Regenerative Fluid", "A fluid with regenerative properties, used to concoct healing additives."); - addItem(ModItems.WITHERING_OOZE, "Withering Ooze", "A corrosive extract. It likely has uses in bio-alchemy."); + addItem(ModItems.WITHERING_OOZE, "Withering Ooze", "A black to steel gray liquid extracted from decaying material of wither origin."); addItem(ModItems.HORMONE_SECRETION, "Hormone Secretion", "A fluid extract very rich in various hormones. A potent material for making drugs."); addItem(ModItems.TOXIN_EXTRACT, "Toxin Extract", "A fluid so toxic you probably shouldn't touch it. Good for making a plethora of dubious substances."); addItem(ModItems.VOLATILE_FLUID, "Volatile Fluid", "A very combustible extract, however it needs further processing to be truly dangerous."); @@ -531,11 +531,11 @@ private void addItemTranslations() { addItem(ModItems.UNSTABLE_COMPOUND, "Unstable Compound", "Very unstable and reactive substance. Seems like it will combust if it comes in contact with just about anything else.\nThe explosion is highly incendiary and has been known to liquefy magma blocks."); addItem(ModItems.EXOTIC_COMPOUND, "Exotic Compound", "Substance of a questionable nature, comprised of exotic material and other trace elements."); addItem(ModItems.GENETIC_COMPOUND, "Genetic Compound", "Cocktail of various hormones, nutrients and organic elements. It seems useful for producing potent stimulants."); - addItem(ModItems.CORROSIVE_ADDITIVE, "Corrosive Additive", "A highly corrosive fluid that seems useful for alchemically burning away organic material, or weakening the bonds of complex substances."); - addItem(ModItems.HEALING_ADDITIVE, "Healing Additive", "An highly concentrated substance that is used to imbue its properties to other compounds."); + addItem(ModItems.DECAYING_ADDITIVE, "Decaying Additive", "A viscous liquid that destabilizes life energy and accelerates the decay of organic material, weakening it at the molecular level."); + addItem(ModItems.HEALING_ADDITIVE, "Healing Additive", "A concentrated syrup of life energy that enhances other substances with vitality."); addSerumItem(ModItems.AGEING_SERUM, "Aging Serum", "Forces the maturation of young Mobs into Adults. Some rare Mobs may even turn into Elders."); - addSerumItem(ModItems.REJUVENATION_SERUM, "Rejuvenation Serum", "Reverses the maturation of Mobs, in most cases turning them into children."); + addSerumItem(ModItems.REJUVENATION_SERUM, "Rejuvenation Serum", "Promotes cellular regeneration, reversing the maturation of Mobs and in most cases turning them into children."); addSerumItem(ModItems.ENLARGEMENT_SERUM, "Enlargement Serum", "Induces growth in Slimes, Magma Cubes and Flesh Blobs.\n\n(If Pehkui is installed you can enlarge yourself and all Mobs)"); addSerumItem(ModItems.SHRINKING_SERUM, "Shrinking Serum", "Shrinks Slimes, Magma Cubes and Flesh Blobs.\n\n(If Pehkui is installed you can shrink yourself and all Mobs)"); diff --git a/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/PirateLangProvider.java b/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/PirateLangProvider.java index 9810da63..4a92437e 100644 --- a/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/PirateLangProvider.java +++ b/src/datagen/java/com/github/elenterius/biomancy/datagen/lang/PirateLangProvider.java @@ -458,7 +458,7 @@ private void addItemTranslations() { addItem(ModItems.UNSTABLE_COMPOUND, "Cannoneer's Compound", "Mighty unstable substance. Seems it'd explode if it be touchin' just about anythin' else."); addItem(ModItems.EXOTIC_COMPOUND, "Wicthes' Compound", "It be o' questionable nature, made o' magic essence and other bits n' bobs."); addItem(ModItems.GENETIC_COMPOUND, "Hereditary Compound", "Mixer o' various humors, nutrients and other livin' bits. It be used fer producin' potent drugs."); - addItem(ModItems.CORROSIVE_ADDITIVE, "Burnin' Additive", "A fluid that be quickly corrodin' even ta' thickest o' cannon barrels. It be useful for burnin' away livin' material, or weakenin' the hulls of yer rivals' ships."); + addItem(ModItems.DECAYING_ADDITIVE, "Burnin' Additive", "A fluid that be quickly corrodin' even ta' thickest o' cannon barrels. It be useful for burnin' away livin' material, or weakenin' the hulls of yer rivals' ships."); addItem(ModItems.HEALING_ADDITIVE, "Healin' Additive", "A mightily concentrated brew that be used to imbue its healin' powers ta other brews."); addSerumItem(ModItems.AGEING_SERUM, "Agin' Serum", "Forces the agin' of young Mobs inta Adults. Some rare Mobs may even turn inta Elders."); diff --git a/src/datagen/java/com/github/elenterius/biomancy/datagen/models/ModItemModelProvider.java b/src/datagen/java/com/github/elenterius/biomancy/datagen/models/ModItemModelProvider.java index 3cc0c37c..b65440b6 100644 --- a/src/datagen/java/com/github/elenterius/biomancy/datagen/models/ModItemModelProvider.java +++ b/src/datagen/java/com/github/elenterius/biomancy/datagen/models/ModItemModelProvider.java @@ -80,7 +80,7 @@ protected void registerModels() { serumItem(ModItems.GENETIC_COMPOUND); serumItem(ModItems.EXOTIC_COMPOUND); serumItem(ModItems.HEALING_ADDITIVE); - serumItem(ModItems.CORROSIVE_ADDITIVE); + serumItem(ModItems.DECAYING_ADDITIVE); emissiveItem(ModItems.PRIMORDIAL_CORE); fleshPlunderer(ModItems.DESPOIL_SICKLE); diff --git a/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java b/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java index 525adca9..b5457a5a 100644 --- a/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java +++ b/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java @@ -60,7 +60,7 @@ private void buildAdditiveRecipes(Consumer consumer) { .setCraftingTime(2 * 20) .unlockedBy(ModItems.ORGANIC_COMPOUND.get()).save(consumer); - BioLabRecipeBuilder.create(ModItems.CORROSIVE_ADDITIVE.get()) + BioLabRecipeBuilder.create(ModItems.DECAYING_ADDITIVE.get()) .addIngredient(ModItems.WITHERING_OOZE.get()) .addIngredient(ModItems.BILE.get()) .setReactant(ModItems.ORGANIC_COMPOUND.get()) @@ -85,7 +85,7 @@ private void buildSerumRecipes(Consumer consumer) { .unlockedBy(ModItems.EXOTIC_COMPOUND.get()).save(consumer); BioLabRecipeBuilder.create(ModItems.CLEANSING_SERUM.get()) - .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) + .addIngredient(ModItems.DECAYING_ADDITIVE.get()) .addIngredient(ModItems.HEALING_ADDITIVE.get()) .setReactant(ModItems.EXOTIC_COMPOUND.get()) .setCraftingTime(8 * 20) @@ -110,7 +110,7 @@ private void buildSerumRecipes(Consumer consumer) { BioLabRecipeBuilder.create(ModItems.REJUVENATION_SERUM.get()) .addIngredient(ModItems.HEALING_ADDITIVE.get()) .addIngredient(ModItems.NUTRIENT_PASTE.get()) - .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) + .addIngredient(ModItems.DECAYING_ADDITIVE.get()) .setReactant(ModItems.GENETIC_COMPOUND.get()) .setCraftingTime(8 * 20) .unlockedBy(ModItems.GENETIC_COMPOUND.get()).save(consumer); @@ -119,7 +119,7 @@ private void buildSerumRecipes(Consumer consumer) { .addIngredient(ModItems.NUTRIENT_PASTE.get()) .addIngredient(ModItems.NUTRIENT_PASTE.get()) .addIngredient(ModItems.MINERAL_FRAGMENT.get()) - .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) + .addIngredient(ModItems.DECAYING_ADDITIVE.get()) .setReactant(ModItems.GENETIC_COMPOUND.get()) .setCraftingTime(6 * 20) .unlockedBy(ModItems.GENETIC_COMPOUND.get()).save(consumer); @@ -138,6 +138,8 @@ private void buildSerumRecipes(Consumer consumer) { .addIngredient(ModItems.HEALING_ADDITIVE.get()) .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) + .addIngredient(ModItems.DECAYING_ADDITIVE.get()) + .addIngredient(ModItems.DECAYING_ADDITIVE.get()) .setReactant(ModItems.GENETIC_COMPOUND.get()) .setCraftingTime(8 * 20) .unlockedBy(ModItems.GENETIC_COMPOUND.get()).save(consumer); diff --git a/src/generated/resources/assets/biomancy/lang/en_pt.json b/src/generated/resources/assets/biomancy/lang/en_pt.json index c638bb85..833c5727 100644 --- a/src/generated/resources/assets/biomancy/lang/en_pt.json +++ b/src/generated/resources/assets/biomancy/lang/en_pt.json @@ -93,8 +93,8 @@ "item.biomancy.exotic_compound.tooltip": "It be o' questionable nature, made o' magic essence and other bits n' bobs.", "item.biomancy.genetic_compound": "Hereditary Compound", "item.biomancy.genetic_compound.tooltip": "Mixer o' various humors, nutrients and other livin' bits. It be used fer producin' potent drugs.", - "item.biomancy.corrosive_additive": "Burnin' Additive", - "item.biomancy.corrosive_additive.tooltip": "A fluid that be quickly corrodin' even ta' thickest o' cannon barrels. It be useful for burnin' away livin' material, or weakenin' the hulls of yer rivals' ships.", + "item.biomancy.decaying_additive": "Burnin' Additive", + "item.biomancy.decaying_additive.tooltip": "A fluid that be quickly corrodin' even ta' thickest o' cannon barrels. It be useful for burnin' away livin' material, or weakenin' the hulls of yer rivals' ships.", "item.biomancy.healing_additive": "Healin' Additive", "item.biomancy.healing_additive.tooltip": "A mightily concentrated brew that be used to imbue its healin' powers ta other brews.", "serum.biomancy.ageing_serum": "Agin' Serum", diff --git a/src/generated/resources/assets/biomancy/lang/en_us.json b/src/generated/resources/assets/biomancy/lang/en_us.json index c0b9a622..98277353 100644 --- a/src/generated/resources/assets/biomancy/lang/en_us.json +++ b/src/generated/resources/assets/biomancy/lang/en_us.json @@ -49,7 +49,7 @@ "item.biomancy.regenerative_fluid": "Regenerative Fluid", "item.biomancy.regenerative_fluid.tooltip": "A fluid with regenerative properties, used to concoct healing additives.", "item.biomancy.withering_ooze": "Withering Ooze", - "item.biomancy.withering_ooze.tooltip": "A corrosive extract. It likely has uses in bio-alchemy.", + "item.biomancy.withering_ooze.tooltip": "A black to steel gray liquid extracted from decaying material of wither origin.", "item.biomancy.hormone_secretion": "Hormone Secretion", "item.biomancy.hormone_secretion.tooltip": "A fluid extract very rich in various hormones. A potent material for making drugs.", "item.biomancy.toxin_extract": "Toxin Extract", @@ -103,16 +103,16 @@ "item.biomancy.exotic_compound.tooltip": "Substance of a questionable nature, comprised of exotic material and other trace elements.", "item.biomancy.genetic_compound": "Genetic Compound", "item.biomancy.genetic_compound.tooltip": "Cocktail of various hormones, nutrients and organic elements. It seems useful for producing potent stimulants.", - "item.biomancy.corrosive_additive": "Corrosive Additive", - "item.biomancy.corrosive_additive.tooltip": "A highly corrosive fluid that seems useful for alchemically burning away organic material, or weakening the bonds of complex substances.", + "item.biomancy.decaying_additive": "Decaying Additive", + "item.biomancy.decaying_additive.tooltip": "A viscous liquid that destabilizes life energy and accelerates the decay of organic material, weakening it at the molecular level.", "item.biomancy.healing_additive": "Healing Additive", - "item.biomancy.healing_additive.tooltip": "An highly concentrated substance that is used to imbue its properties to other compounds.", + "item.biomancy.healing_additive.tooltip": "A concentrated syrup of life energy that enhances other substances with vitality.", "serum.biomancy.ageing_serum": "Aging Serum", "item.biomancy.ageing_serum": "Aging Serum", "serum.biomancy.ageing_serum.tooltip": "Forces the maturation of young Mobs into Adults. Some rare Mobs may even turn into Elders.", "serum.biomancy.rejuvenation_serum": "Rejuvenation Serum", "item.biomancy.rejuvenation_serum": "Rejuvenation Serum", - "serum.biomancy.rejuvenation_serum.tooltip": "Reverses the maturation of Mobs, in most cases turning them into children.", + "serum.biomancy.rejuvenation_serum.tooltip": "Promotes cellular regeneration, reversing the maturation of Mobs and in most cases turning them into children.", "serum.biomancy.enlargement_serum": "Enlargement Serum", "item.biomancy.enlargement_serum": "Enlargement Serum", "serum.biomancy.enlargement_serum.tooltip": "Induces growth in Slimes, Magma Cubes and Flesh Blobs.\n\n(If Pehkui is installed you can enlarge yourself and all Mobs)", diff --git a/src/generated/resources/assets/biomancy/models/item/corrosive_additive.json b/src/generated/resources/assets/biomancy/models/item/decaying_additive.json similarity index 53% rename from src/generated/resources/assets/biomancy/models/item/corrosive_additive.json rename to src/generated/resources/assets/biomancy/models/item/decaying_additive.json index d9fea1e4..a2eefb5e 100644 --- a/src/generated/resources/assets/biomancy/models/item/corrosive_additive.json +++ b/src/generated/resources/assets/biomancy/models/item/decaying_additive.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/generated", "textures": { - "layer0": "biomancy:item/serum/corrosive_additive" + "layer0": "biomancy:item/serum/decaying_additive" } } \ No newline at end of file diff --git a/src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/corrosive_additive_from_bio_brewing.json b/src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/decaying_additive_from_bio_brewing.json similarity index 80% rename from src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/corrosive_additive_from_bio_brewing.json rename to src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/decaying_additive_from_bio_brewing.json index 8c2120da..f2e9c6fa 100644 --- a/src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/corrosive_additive_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/advancements/recipes/biomancy/bio_brewing/decaying_additive_from_bio_brewing.json @@ -15,7 +15,7 @@ }, "has_the_recipe": { "conditions": { - "recipe": "biomancy:bio_brewing/corrosive_additive_from_bio_brewing" + "recipe": "biomancy:bio_brewing/decaying_additive_from_bio_brewing" }, "trigger": "minecraft:recipe_unlocked" } @@ -28,7 +28,7 @@ ], "rewards": { "recipes": [ - "biomancy:bio_brewing/corrosive_additive_from_bio_brewing" + "biomancy:bio_brewing/decaying_additive_from_bio_brewing" ] }, "sends_telemetry_event": false diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/ageing_serum_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/ageing_serum_from_bio_brewing.json index eee2ad43..5fa164a3 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/ageing_serum_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/ageing_serum_from_bio_brewing.json @@ -1,9 +1,6 @@ { "type": "biomancy:bio_brewing", "ingredients": [ - { - "item": "biomancy:nutrient_paste" - }, { "item": "biomancy:nutrient_paste" }, @@ -11,7 +8,7 @@ "item": "biomancy:mineral_fragment" }, { - "item": "biomancy:corrosive_additive" + "item": "biomancy:decaying_additive" } ], "nutrientsCost": 2, diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/cleansing_serum_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/cleansing_serum_from_bio_brewing.json index 9082f46a..bec2b570 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/cleansing_serum_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/cleansing_serum_from_bio_brewing.json @@ -2,7 +2,7 @@ "type": "biomancy:bio_brewing", "ingredients": [ { - "item": "biomancy:corrosive_additive" + "item": "biomancy:decaying_additive" }, { "item": "biomancy:healing_additive" diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/corrosive_additive_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/decaying_additive_from_bio_brewing.json similarity index 75% rename from src/generated/resources/data/biomancy/recipes/bio_brewing/corrosive_additive_from_bio_brewing.json rename to src/generated/resources/data/biomancy/recipes/bio_brewing/decaying_additive_from_bio_brewing.json index 027bb42d..ebc1f552 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/corrosive_additive_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/decaying_additive_from_bio_brewing.json @@ -5,7 +5,7 @@ "item": "biomancy:withering_ooze" }, { - "item": "biomancy:bile" + "item": "biomancy:withering_ooze" } ], "nutrientsCost": 2, @@ -14,6 +14,6 @@ "item": "biomancy:organic_compound" }, "result": { - "item": "biomancy:corrosive_additive" + "item": "biomancy:decaying_additive" } } \ No newline at end of file diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/healing_additive_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/healing_additive_from_bio_brewing.json index 62e7ba9b..da39b15d 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/healing_additive_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/healing_additive_from_bio_brewing.json @@ -5,7 +5,7 @@ "item": "biomancy:regenerative_fluid" }, { - "item": "biomancy:bile" + "item": "biomancy:regenerative_fluid" } ], "nutrientsCost": 2, diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/organic_compound_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/organic_compound_from_bio_brewing.json index 5d4d5cd8..2a17d395 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/organic_compound_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/organic_compound_from_bio_brewing.json @@ -5,7 +5,13 @@ "item": "biomancy:bile" }, { - "item": "biomancy:nutrient_paste" + "item": "biomancy:bile" + }, + { + "item": "biomancy:organic_matter" + }, + { + "item": "biomancy:nutrients" } ], "nutrientsCost": 2, diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/rejuvenation_serum_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/rejuvenation_serum_from_bio_brewing.json index 175c2c11..030bbe19 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/rejuvenation_serum_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/rejuvenation_serum_from_bio_brewing.json @@ -8,7 +8,7 @@ "item": "biomancy:nutrient_paste" }, { - "item": "biomancy:corrosive_additive" + "item": "biomancy:decaying_additive" } ], "nutrientsCost": 2, diff --git a/src/generated/resources/data/biomancy/recipes/bio_brewing/shrinking_serum_from_bio_brewing.json b/src/generated/resources/data/biomancy/recipes/bio_brewing/shrinking_serum_from_bio_brewing.json index 36ee542e..0c793d7e 100644 --- a/src/generated/resources/data/biomancy/recipes/bio_brewing/shrinking_serum_from_bio_brewing.json +++ b/src/generated/resources/data/biomancy/recipes/bio_brewing/shrinking_serum_from_bio_brewing.json @@ -8,10 +8,10 @@ "item": "biomancy:healing_additive" }, { - "item": "biomancy:corrosive_additive" + "item": "biomancy:decaying_additive" }, { - "item": "biomancy:corrosive_additive" + "item": "biomancy:decaying_additive" } ], "nutrientsCost": 2, diff --git a/src/main/java/com/github/elenterius/biomancy/api/tribute/Tributes.java b/src/main/java/com/github/elenterius/biomancy/api/tribute/Tributes.java index 448bc78b..3edb0867 100644 --- a/src/main/java/com/github/elenterius/biomancy/api/tribute/Tributes.java +++ b/src/main/java/com/github/elenterius/biomancy/api/tribute/Tributes.java @@ -43,7 +43,7 @@ public final class Tributes { register(ModItems.HEALING_ADDITIVE.get(), SimpleTribute.builder().lifeEnergy(55).successModifier(1).diseaseModifier(-5).hostileModifier(-10).build()); register(ModItems.REGENERATIVE_FLUID.get(), SimpleTribute.builder().lifeEnergy(5).hostileModifier(-1).build()); register(ModItems.WITHERING_OOZE.get(), SimpleTribute.builder().biomass(-5).successModifier(-1).diseaseModifier(1).build()); - register(ModItems.CORROSIVE_ADDITIVE.get(), SimpleTribute.builder().biomass(-20).successModifier(-5).diseaseModifier(5).build()); + register(ModItems.DECAYING_ADDITIVE.get(), SimpleTribute.builder().biomass(-20).successModifier(-5).diseaseModifier(5).build()); register(ModItems.ORGANIC_COMPOUND.get(), SimpleTribute.builder().successModifier(10).build()); register(ModItems.EXOTIC_COMPOUND.get(), SimpleTribute.builder().successModifier(5).anomalyModifier(20).build()); register(ModItems.GENETIC_COMPOUND.get(), SimpleTribute.builder().successModifier(1).diseaseModifier(-10).build()); diff --git a/src/main/java/com/github/elenterius/biomancy/init/MigrationHandler.java b/src/main/java/com/github/elenterius/biomancy/init/MigrationHandler.java index 69a2a155..6dcf7ed2 100644 --- a/src/main/java/com/github/elenterius/biomancy/init/MigrationHandler.java +++ b/src/main/java/com/github/elenterius/biomancy/init/MigrationHandler.java @@ -137,6 +137,8 @@ public static void handleMissingItems(List> mappings) { case "digestate" -> mapping.remap(ModItems.ORGANIC_MATTER.get()); case "oxide_powder", "silicate_paste", "bio_minerals" -> mapping.remap(ModItems.MINERAL_FRAGMENT.get()); case "hormone_bile" -> mapping.remap(ModItems.HORMONE_SECRETION.get()); + case "corrosive_additive" -> mapping.remap(ModItems.DECAYING_ADDITIVE.get()); + default -> mapping.ignore(); } } diff --git a/src/main/java/com/github/elenterius/biomancy/init/ModItems.java b/src/main/java/com/github/elenterius/biomancy/init/ModItems.java index eba0879b..ff500062 100644 --- a/src/main/java/com/github/elenterius/biomancy/init/ModItems.java +++ b/src/main/java/com/github/elenterius/biomancy/init/ModItems.java @@ -72,7 +72,7 @@ public final class ModItems { public static final RegistryObject GENETIC_COMPOUND = registerSimpleVialItem("genetic_compound"); public static final RegistryObject EXOTIC_COMPOUND = registerSimpleVialItem("exotic_compound"); public static final RegistryObject HEALING_ADDITIVE = registerSimpleVialItem("healing_additive"); - public static final RegistryObject CORROSIVE_ADDITIVE = registerSimpleVialItem("corrosive_additive"); + public static final RegistryObject DECAYING_ADDITIVE = registerSimpleVialItem("decaying_additive"); public static final RegistryObject REJUVENATION_SERUM = registerSerumItem(ModSerums.REJUVENATION_SERUM); public static final RegistryObject AGEING_SERUM = registerSerumItem(ModSerums.AGEING_SERUM); public static final RegistryObject ENLARGEMENT_SERUM = registerSerumItem(ModSerums.ENLARGEMENT_SERUM); diff --git a/src/main/resources/assets/biomancy/textures/item/serum/corrosive_additive.png b/src/main/resources/assets/biomancy/textures/item/serum/decaying_additive.png similarity index 100% rename from src/main/resources/assets/biomancy/textures/item/serum/corrosive_additive.png rename to src/main/resources/assets/biomancy/textures/item/serum/decaying_additive.png From 406a056fe59037802943736c7e7a33edb52a743a Mon Sep 17 00:00:00 2001 From: Elenterius Date: Sat, 5 Oct 2024 01:34:34 +0200 Subject: [PATCH 7/9] feat: tweak bio-lab recipes --- .../datagen/recipes/BioLabRecipeProvider.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java b/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java index b5457a5a..7c9a49a7 100644 --- a/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java +++ b/src/datagen/java/com/github/elenterius/biomancy/datagen/recipes/BioLabRecipeProvider.java @@ -26,7 +26,9 @@ protected void buildRecipes(Consumer consumer) { private void buildCompoundRecipes(Consumer consumer) { BioLabRecipeBuilder.create(ModItems.ORGANIC_COMPOUND.get()) .addIngredient(ModItems.BILE.get()) - .addIngredient(ModItems.NUTRIENT_PASTE.get()) + .addIngredient(ModItems.BILE.get()) + .addIngredient(ModItems.ORGANIC_MATTER.get()) + .addIngredient(ModItems.NUTRIENTS.get()) .setCraftingTime(2 * 20) .unlockedBy(ModItems.BILE.get()).save(consumer); @@ -55,14 +57,14 @@ private void buildCompoundRecipes(Consumer consumer) { private void buildAdditiveRecipes(Consumer consumer) { BioLabRecipeBuilder.create(ModItems.HEALING_ADDITIVE.get()) .addIngredient(ModItems.REGENERATIVE_FLUID.get()) - .addIngredient(ModItems.BILE.get()) + .addIngredient(ModItems.REGENERATIVE_FLUID.get()) .setReactant(ModItems.ORGANIC_COMPOUND.get()) .setCraftingTime(2 * 20) .unlockedBy(ModItems.ORGANIC_COMPOUND.get()).save(consumer); BioLabRecipeBuilder.create(ModItems.DECAYING_ADDITIVE.get()) .addIngredient(ModItems.WITHERING_OOZE.get()) - .addIngredient(ModItems.BILE.get()) + .addIngredient(ModItems.WITHERING_OOZE.get()) .setReactant(ModItems.ORGANIC_COMPOUND.get()) .setCraftingTime(2 * 20) .unlockedBy(ModItems.ORGANIC_COMPOUND.get()).save(consumer); @@ -116,7 +118,6 @@ private void buildSerumRecipes(Consumer consumer) { .unlockedBy(ModItems.GENETIC_COMPOUND.get()).save(consumer); BioLabRecipeBuilder.create(ModItems.AGEING_SERUM.get()) - .addIngredient(ModItems.NUTRIENT_PASTE.get()) .addIngredient(ModItems.NUTRIENT_PASTE.get()) .addIngredient(ModItems.MINERAL_FRAGMENT.get()) .addIngredient(ModItems.DECAYING_ADDITIVE.get()) @@ -136,8 +137,6 @@ private void buildSerumRecipes(Consumer consumer) { BioLabRecipeBuilder.create(ModItems.SHRINKING_SERUM.get()) .addIngredient(ModItems.EXOTIC_DUST.get()) .addIngredient(ModItems.HEALING_ADDITIVE.get()) - .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) - .addIngredient(ModItems.CORROSIVE_ADDITIVE.get()) .addIngredient(ModItems.DECAYING_ADDITIVE.get()) .addIngredient(ModItems.DECAYING_ADDITIVE.get()) .setReactant(ModItems.GENETIC_COMPOUND.get()) From 97bbff27a0183a29b6db1bfd35341362cfec86fb Mon Sep 17 00:00:00 2001 From: Elenterius Date: Sat, 5 Oct 2024 12:39:50 +0200 Subject: [PATCH 8/9] feat(buff): increase max stack size of serums from 8 to 16 --- src/main/java/com/github/elenterius/biomancy/init/ModItems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/elenterius/biomancy/init/ModItems.java b/src/main/java/com/github/elenterius/biomancy/init/ModItems.java index ff500062..a20a9edd 100644 --- a/src/main/java/com/github/elenterius/biomancy/init/ModItems.java +++ b/src/main/java/com/github/elenterius/biomancy/init/ModItems.java @@ -306,7 +306,7 @@ private static > RegistryObject RegistryObject registerSerumItem(RegistryObject registryObject) { - return ITEMS.register(registryObject.getId().getPath(), () -> new SerumItem(createProperties().stacksTo(8).rarity(ModRarities.UNCOMMON), registryObject)); + return ITEMS.register(registryObject.getId().getPath(), () -> new SerumItem(createProperties().stacksTo(16).rarity(ModRarities.UNCOMMON), registryObject)); } private static RegistryObject registerSimpleVialItem(String name) { From 9b54ec00ea3ce88cccb51bd3d21e19b8a9503977 Mon Sep 17 00:00:00 2001 From: Elenterius Date: Sat, 5 Oct 2024 12:45:12 +0200 Subject: [PATCH 9/9] chore: mark BehavioralInventory as deprecated --- .../elenterius/biomancy/inventory/BehavioralInventory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/elenterius/biomancy/inventory/BehavioralInventory.java b/src/main/java/com/github/elenterius/biomancy/inventory/BehavioralInventory.java index 289670e8..51fb6278 100644 --- a/src/main/java/com/github/elenterius/biomancy/inventory/BehavioralInventory.java +++ b/src/main/java/com/github/elenterius/biomancy/inventory/BehavioralInventory.java @@ -11,6 +11,7 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; +@Deprecated public class BehavioralInventory> extends BaseInventory { private final T behavioralItemHandler;