Skip to content

Commit

Permalink
Add missing info about demons (Blood Magic)) (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba6000 committed Oct 2, 2024
1 parent 3e4e239 commit 948004a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/main/java/com/kuba6000/mobsinfo/loader/extras/BloodMagic.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -28,5 +37,54 @@ public void process(String k, ArrayList<MobDrop> 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<ItemStack> 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<ItemStack> drops, Entity attacker,
EntityLiving victim) {
return 0d;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ enum Translations {
TINKERS_CONSTRUCT_BEHEADING_1,
WITCHERY_VAMPIRE_BOOK,
WITCHERY_WAREWOLF,
BLOODMAGIC_DEMON_SHARDS,
BLOODMAGIC_DEMON_PLACER,

;

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/mobsinfo/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 948004a

Please sign in to comment.