From 948004a3e01b51528335158ceffd89417a4fa4fa Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:11:13 +0200 Subject: [PATCH] Add missing info about demons (Blood Magic)) (#49) --- .../mobsinfo/loader/extras/BloodMagic.java | 58 +++++++++++++++++++ .../mobsinfo/loader/extras/Translations.java | 2 + .../resources/assets/mobsinfo/lang/en_US.lang | 2 + 3 files changed, 62 insertions(+) diff --git a/src/main/java/com/kuba6000/mobsinfo/loader/extras/BloodMagic.java b/src/main/java/com/kuba6000/mobsinfo/loader/extras/BloodMagic.java index d952b3a..7dfa543 100644 --- a/src/main/java/com/kuba6000/mobsinfo/loader/extras/BloodMagic.java +++ b/src/main/java/com/kuba6000/mobsinfo/loader/extras/BloodMagic.java @@ -2,14 +2,23 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import javax.annotation.Nonnull; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import com.kuba6000.mobsinfo.api.IChanceModifier; import com.kuba6000.mobsinfo.api.MobDrop; import com.kuba6000.mobsinfo.api.MobRecipe; import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon; public class BloodMagic implements IExtraLoader { @@ -28,5 +37,54 @@ public void process(String k, ArrayList drops, MobRecipe recipe) { drop.chanceModifiers.addAll(Arrays.asList(new NormalChance(50d), new DropsOnlyWithWeaknessII())); drops.add(drop); } + if (recipe.entity instanceof EntityDemon) { + for (MobDrop drop : drops) { + if (drop.stack.getItem() == ModItems.demonPlacer) { + drop.variableChance = true; + drop.chanceModifiers.addAll(Arrays.asList(new NormalChance(100d), new DemonDemonPlacer())); + } + } + } + // WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt.dropFewItems + if (recipe.entity instanceof EntityMinorDemonGrunt) { + ItemStack lifeShardStack = new ItemStack(ModItems.baseItems, 1, 28); + ItemStack soulShardStack = new ItemStack(ModItems.baseItems, 1, 29); + MobDrop drop = new MobDrop(lifeShardStack, MobDrop.DropType.Normal, 0, 0, null, true, false); + drop.variableChance = true; + drop.chanceModifiers.addAll(Arrays.asList(new NormalChance(30d), new MinorDemonGruntShards())); + drops.add(drop); + MobDrop drop2 = new MobDrop(soulShardStack, MobDrop.DropType.Normal, 0, 0, null, true, false); + drop2.variableChance = true; + drop2.chanceModifiers.addAll(Arrays.asList(new NormalChance(30d), new MinorDemonGruntShards())); + drops.add(drop2); + } + } + + private static class MinorDemonGruntShards implements IChanceModifier { + + @Override + public String getDescription() { + return Translations.BLOODMAGIC_DEMON_SHARDS.get(); + } + + @Override + public double apply(double chance, @Nonnull World world, @Nonnull List drops, Entity attacker, + EntityLiving victim) { + return chance; + } + } + + private static class DemonDemonPlacer implements IChanceModifier { + + @Override + public String getDescription() { + return Translations.BLOODMAGIC_DEMON_PLACER.get(); + } + + @Override + public double apply(double chance, @Nonnull World world, @Nonnull List drops, Entity attacker, + EntityLiving victim) { + return 0d; + } } } diff --git a/src/main/java/com/kuba6000/mobsinfo/loader/extras/Translations.java b/src/main/java/com/kuba6000/mobsinfo/loader/extras/Translations.java index ac53d58..01fd6e8 100644 --- a/src/main/java/com/kuba6000/mobsinfo/loader/extras/Translations.java +++ b/src/main/java/com/kuba6000/mobsinfo/loader/extras/Translations.java @@ -35,6 +35,8 @@ enum Translations { TINKERS_CONSTRUCT_BEHEADING_1, WITCHERY_VAMPIRE_BOOK, WITCHERY_WAREWOLF, + BLOODMAGIC_DEMON_SHARDS, + BLOODMAGIC_DEMON_PLACER, ; diff --git a/src/main/resources/assets/mobsinfo/lang/en_US.lang b/src/main/resources/assets/mobsinfo/lang/en_US.lang index fc2fd6f..d249227 100644 --- a/src/main/resources/assets/mobsinfo/lang/en_US.lang +++ b/src/main/resources/assets/mobsinfo/lang/en_US.lang @@ -62,6 +62,8 @@ mobsinfo.extras.tinkers_construct_beheading=Each level of beheading on your weap mobsinfo.extras.tinkers_construct_beheading_1=If you are using a Cleaver, it gives another %.2f%% mobsinfo.extras.witchery_vampire_book=Drops only when player has Vampire book mobsinfo.extras.witchery_warewolf=Only when killer is a Warewolf +mobsinfo.extras.bloodmagic_demon_shards=Drops only when spawned using Demon Portal or hit with dagger of sacrifice +mobsinfo.extras.bloodmagic_demon_placer=Drops only when NOT spawned using Demon Portal and NOT hit with dagger of sacrifice #Commands