Added the Iron Throwing Dagger
Throwing Dagger does 10 damage when it hits a mob, and triggers a 2.5s cooldown similar to Ender Pearls (so they cannot be spammed). If the player has enough Demon Will in their contained gems, when a mob is killed with the Throwing Dagger they give Will to the player similar to the Sentient Sword.
This commit is contained in:
parent
e349c424bf
commit
1b06cea133
15 changed files with 904 additions and 3 deletions
|
@ -120,6 +120,8 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
add("tooltip.bloodmagic.experienceTome.exp", "Exp: %0.3f");
|
||||
add("tooltip.bloodmagic.experienceTome.expLevel", "Level: %d");
|
||||
|
||||
add("tooltip.bloodmagic.throwing_dagger.desc", "Not to be used in the kitchen");
|
||||
|
||||
add("key.bloodmagic.category", "Blood Magic");
|
||||
|
||||
// Ritual info
|
||||
|
@ -553,6 +555,8 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
|
||||
addItem(BloodMagicItems.LIVING_TOME, "Living Armour Upgrade Tome");
|
||||
|
||||
addItem(BloodMagicItems.THROWING_DAGGER, "Iron Throwing Dagger");
|
||||
|
||||
// Anointment Items
|
||||
addItem(BloodMagicItems.SLATE_VIAL, "Slate-infused Vial");
|
||||
addItem(BloodMagicItems.MELEE_DAMAGE_ANOINTMENT, "Honing Oil");
|
||||
|
|
|
@ -223,6 +223,8 @@ public class BloodMagicItems
|
|||
public static final RegistryObject<Item> SALTPETER = BASICITEMS.register("saltpeter", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> PLANT_OIL = BASICITEMS.register("plantoil", () -> new ItemBase());
|
||||
|
||||
public static final RegistryObject<Item> THROWING_DAGGER = BASICITEMS.register("throwing_dagger", ItemThrowingDagger::new);
|
||||
|
||||
// Anointments
|
||||
public static final RegistryObject<Item> SLATE_VIAL = ITEMS.register("slate_vial", () -> new ItemBase(16, "slate_vial"));
|
||||
public static final RegistryObject<Item> MELEE_DAMAGE_ANOINTMENT = ITEMS.register("melee_anointment", () -> new ItemAnointmentProvider(BloodMagic.rl("melee_damage"), 0xFF0000, 1, 256));
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
package wayoftime.bloodmagic.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.compat.EnumDemonWillType;
|
||||
import wayoftime.bloodmagic.entity.projectile.EntityThrowingDagger;
|
||||
import wayoftime.bloodmagic.will.PlayerDemonWillHandler;
|
||||
|
||||
public class ItemThrowingDagger extends Item
|
||||
{
|
||||
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000, 2000, 4000 };
|
||||
|
||||
public static double[] soulDrop = new double[] { 2, 4, 7, 10, 13, 15, 18 };
|
||||
public static double[] staticDrop = new double[] { 1, 1, 2, 3, 3, 4, 4 };
|
||||
|
||||
public ItemThrowingDagger()
|
||||
{
|
||||
super(new Item.Properties().maxStackSize(64).group(BloodMagic.TAB));
|
||||
|
||||
// setTranslationKey(BloodMagic.MODID + ".soulSnare.");
|
||||
// setCreativeTab(BloodMagic.TAB_BM);
|
||||
// setHasSubtypes(true);
|
||||
// setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand hand)
|
||||
{
|
||||
ItemStack stack = playerIn.getHeldItem(hand);
|
||||
if (!playerIn.isCreative())
|
||||
{
|
||||
stack.shrink(1);
|
||||
}
|
||||
playerIn.getCooldownTracker().setCooldown(this, 50);
|
||||
|
||||
worldIn.playSound((PlayerEntity) null, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
// System.out.println("Attempting to spawn");
|
||||
// EntitySoulSnare snare = new EntitySoulSnare(worldIn, playerIn);
|
||||
// snare.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
// worldIn.addEntity(snare);
|
||||
EnumDemonWillType largestType = PlayerDemonWillHandler.getLargestWillType(playerIn);
|
||||
double souls = PlayerDemonWillHandler.getTotalDemonWill(largestType, playerIn);
|
||||
|
||||
ItemStack copyStack = stack.copy();
|
||||
copyStack.setCount(1);
|
||||
EntityThrowingDagger dagger = new EntityThrowingDagger(copyStack, worldIn, playerIn);
|
||||
dagger.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 3F, 0.5F);
|
||||
dagger.setDamage(10);
|
||||
|
||||
int level = getLevel(souls);
|
||||
if (level >= 0)
|
||||
{
|
||||
double willDrop = (soulDrop[level] * worldIn.rand.nextDouble() + staticDrop[level]);
|
||||
dagger.setWillDrop(willDrop);
|
||||
dagger.setWillType(largestType);
|
||||
}
|
||||
|
||||
worldIn.addEntity(dagger);
|
||||
//
|
||||
// SnowballEntity snowballentity = new SnowballEntity(worldIn, playerIn);
|
||||
// snowballentity.setItem(itemstack);
|
||||
// snowballentity.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
|
||||
// worldIn.addEntity(snowballentity);
|
||||
}
|
||||
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
||||
}
|
||||
|
||||
private int getLevel(double soulsRemaining)
|
||||
{
|
||||
int lvl = -1;
|
||||
for (int i = 0; i < soulBracket.length; i++)
|
||||
{
|
||||
if (soulsRemaining >= soulBracket[i])
|
||||
{
|
||||
lvl = i;
|
||||
}
|
||||
}
|
||||
|
||||
return lvl;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.throwing_dagger.desc"));
|
||||
|
||||
super.addInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
}
|
|
@ -59,6 +59,8 @@ public class TartaricForgeRecipeProvider implements ISubRecipeProvider
|
|||
|
||||
TartaricForgeRecipeBuilder.tartaricForge(stack, 60, 1, Ingredient.fromItems(BloodMagicItems.DEFORESTER_CHARGE_ITEM.get())).build(consumer, BloodMagic.rl(basePath + "deforester_charge_smelting"));
|
||||
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.THROWING_DAGGER.get(), 16), 32, 5, Ingredient.fromTag(Tags.Items.INGOTS_IRON), Ingredient.fromTag(Tags.Items.INGOTS_IRON), Ingredient.fromTag(Tags.Items.STRING)).build(consumer, BloodMagic.rl(basePath + "throwing_dagger"));
|
||||
|
||||
// Changed Recipes
|
||||
{
|
||||
// TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.ARCANE_ASHES.get()), 0, 0, Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), Ingredient.fromTag(Tags.Items.DYES_WHITE), Ingredient.fromTag(Tags.Items.GUNPOWDER), Ingredient.fromTag(ItemTags.COALS)).build(consumer, BloodMagic.rl(basePath + "arcaneashes"));
|
||||
|
|
|
@ -8,6 +8,7 @@ import wayoftime.bloodmagic.common.registration.impl.EntityTypeRegistryObject;
|
|||
import wayoftime.bloodmagic.entity.projectile.EntityBloodLight;
|
||||
import wayoftime.bloodmagic.entity.projectile.EntityShapedCharge;
|
||||
import wayoftime.bloodmagic.entity.projectile.EntitySoulSnare;
|
||||
import wayoftime.bloodmagic.entity.projectile.EntityThrowingDagger;
|
||||
|
||||
public class BloodMagicEntityTypes
|
||||
{
|
||||
|
@ -19,6 +20,7 @@ public class BloodMagicEntityTypes
|
|||
public static final EntityTypeDeferredRegister ENTITY_TYPES = new EntityTypeDeferredRegister(BloodMagic.MODID);
|
||||
|
||||
public static final EntityTypeRegistryObject<EntitySoulSnare> SNARE = ENTITY_TYPES.register("soulsnare", EntityType.Builder.<EntitySoulSnare>create(EntitySoulSnare::new, EntityClassification.MISC).setTrackingRange(64).setUpdateInterval(1).size(0.25f, 0.25f));
|
||||
public static final EntityTypeRegistryObject<EntityThrowingDagger> THROWING_DAGGER = ENTITY_TYPES.register("throwing_dagger", EntityType.Builder.<EntityThrowingDagger>create(EntityThrowingDagger::new, EntityClassification.MISC).setTrackingRange(64).setUpdateInterval(1).size(0.25f, 0.25f));
|
||||
public static final EntityTypeRegistryObject<EntityBloodLight> BLOOD_LIGHT = ENTITY_TYPES.register("bloodlight", EntityType.Builder.<EntityBloodLight>create(EntityBloodLight::new, EntityClassification.MISC).setTrackingRange(64).setUpdateInterval(1).size(0.25f, 0.25f));
|
||||
public static final EntityTypeRegistryObject<EntityShapedCharge> SHAPED_CHARGE = ENTITY_TYPES.register("shapedcharge", EntityType.Builder.<EntityShapedCharge>create(EntityShapedCharge::new, EntityClassification.MISC).setTrackingRange(64).setUpdateInterval(1).size(0.4f, 0.4f));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue