Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/generated/resources/assets/bloodmagic/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@
"tooltip.bloodmagic.sacrificialdagger.desc": "Just a prick of the finger will suffice...",
"tooltip.bloodmagic.sentientAxe.desc": "Uses demon will to unleash its full potential.",
"tooltip.bloodmagic.sentientPickaxe.desc": "Uses demon will to unleash its full potential.",
"tooltip.bloodmagic.sentientScythe.desc": "Uses demon will to unleash its full potential.",
"tooltip.bloodmagic.sentientShovel.desc": "Uses demon will to unleash its full potential.",
"tooltip.bloodmagic.sentientSword.desc": "Uses demon will to unleash its full potential.",
"tooltip.bloodmagic.sigil.air.desc": "I feel lighter already...",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"bloodmagic:soulscythe"
]
}
15 changes: 15 additions & 0 deletions src/main/java/wayoftime/bloodmagic/BloodMagic.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package wayoftime.bloodmagic;

import net.minecraft.Util;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.Position;
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.entity.projectile.Snowball;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.dispenser.DispenseItemBehavior;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.ModelEvent.RegisterGeometryLoaders;
Expand Down Expand Up @@ -57,6 +63,7 @@
import wayoftime.bloodmagic.core.recipe.IngredientBloodOrb;
import wayoftime.bloodmagic.core.registry.AlchemyArrayRegistry;
import wayoftime.bloodmagic.core.registry.OrbRegistry;
import wayoftime.bloodmagic.entity.projectile.EntitySoulSnare;
import wayoftime.bloodmagic.impl.BloodMagicAPI;
import wayoftime.bloodmagic.impl.BloodMagicCorePlugin;
import wayoftime.bloodmagic.loot.GlobalLootModifier;
Expand Down Expand Up @@ -234,6 +241,14 @@ private void setup(final FMLCommonSetupEvent event) {
packetHandler.initialize();
DispenserBlock.registerBehavior(BloodMagicItems.LIFE_ESSENCE_BUCKET.get(), DispenseFluidContainer.getInstance());
DispenserBlock.registerBehavior(BloodMagicItems.DOUBT_BUCKET.get(), DispenseFluidContainer.getInstance());
// adapted from Snowball behavior
DispenserBlock.registerBehavior(BloodMagicItems.SOUL_SNARE.get(), new AbstractProjectileDispenseBehavior() {
protected Projectile getProjectile(Level level, Position pos, ItemStack itemStack) {
return Util.make(new EntitySoulSnare(level, pos.x(), pos.y(), pos.z()), (snare) -> {
snare.setItem(itemStack);
});
}
});

curiosLoaded = ModList.get().isLoaded("curios");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private void registerVanillaTools()
tag(BloodMagicTags.SHOVELS).add(Items.DIAMOND_SHOVEL, Items.GOLDEN_SHOVEL, Items.IRON_SHOVEL, Items.NETHERITE_SHOVEL, Items.STONE_SHOVEL, Items.WOODEN_SHOVEL, BloodMagicItems.SENTIENT_SHOVEL.get());
tag(BloodMagicTags.PICKAXES).add(Items.DIAMOND_PICKAXE, Items.GOLDEN_PICKAXE, Items.IRON_PICKAXE, Items.NETHERITE_PICKAXE, Items.STONE_PICKAXE, Items.WOODEN_PICKAXE, BloodMagicItems.SENTIENT_PICKAXE.get());
tag(BloodMagicTags.HOES).add(Items.DIAMOND_HOE, Items.GOLDEN_HOE, Items.IRON_HOE, Items.NETHERITE_HOE, Items.STONE_HOE, Items.WOODEN_HOE, BloodMagicItems.SENTIENT_SCYTHE.get());
tag(BloodMagicTags.SCYTHES).add(BloodMagicItems.SENTIENT_SCYTHE.get());

tag(Tags.Items.ARMORS_HELMETS).add(BloodMagicItems.LIVING_HELMET.get());
tag(Tags.Items.ARMORS_CHESTPLATES).add(BloodMagicItems.LIVING_PLATE.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ protected void addTranslations()
add("tooltip.bloodmagic.sentientAxe.desc", "Uses demon will to unleash its full potential.");
add("tooltip.bloodmagic.sentientPickaxe.desc", "Uses demon will to unleash its full potential.");
add("tooltip.bloodmagic.sentientShovel.desc", "Uses demon will to unleash its full potential.");
add("tooltip.bloodmagic.sentientScythe.desc", "Uses demon will to unleash its full potential.");
add("tooltip.bloodmagic.soulGem.petty", "A gem used to contain a little will.");
add("tooltip.bloodmagic.soulGem.lesser", "A gem used to contain some will.");
add("tooltip.bloodmagic.soulGem.common", "A gem used to contain more will.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ public void addRecipes(Consumer<FinishedRecipe> consumer)
solidifyConcrete(consumer, Blocks.ORANGE_CONCRETE_POWDER, Blocks.ORANGE_CONCRETE);
solidifyConcrete(consumer, Blocks.MAGENTA_CONCRETE_POWDER, Blocks.MAGENTA_CONCRETE);
solidifyConcrete(consumer, Blocks.LIGHT_BLUE_CONCRETE_POWDER, Blocks.LIGHT_BLUE_CONCRETE);
solidifyConcrete(consumer, Blocks.YELLOW_CONCRETE_POWDER, Blocks.YELLOW_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.LIME_CONCRETE_POWDER, Blocks.LIME_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.PINK_CONCRETE_POWDER, Blocks.PINK_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.GRAY_CONCRETE_POWDER, Blocks.GRAY_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.LIGHT_GRAY_CONCRETE_POWDER, Blocks.LIGHT_GRAY_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.CYAN_CONCRETE_POWDER, Blocks.CYAN_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.PURPLE_CONCRETE_POWDER, Blocks.PURPLE_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.BLUE_CONCRETE_POWDER, Blocks.BLUE_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.BROWN_CONCRETE_POWDER, Blocks.BROWN_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.GREEN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.RED_CONCRETE_POWDER, Blocks.RED_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.BLACK_CONCRETE_POWDER, Blocks.BLACK_CONCRETE_POWDER);
solidifyConcrete(consumer, Blocks.YELLOW_CONCRETE_POWDER, Blocks.YELLOW_CONCRETE);
solidifyConcrete(consumer, Blocks.LIME_CONCRETE_POWDER, Blocks.LIME_CONCRETE);
solidifyConcrete(consumer, Blocks.PINK_CONCRETE_POWDER, Blocks.PINK_CONCRETE);
solidifyConcrete(consumer, Blocks.GRAY_CONCRETE_POWDER, Blocks.GRAY_CONCRETE);
solidifyConcrete(consumer, Blocks.LIGHT_GRAY_CONCRETE_POWDER, Blocks.LIGHT_GRAY_CONCRETE);
solidifyConcrete(consumer, Blocks.CYAN_CONCRETE_POWDER, Blocks.CYAN_CONCRETE);
solidifyConcrete(consumer, Blocks.PURPLE_CONCRETE_POWDER, Blocks.PURPLE_CONCRETE);
solidifyConcrete(consumer, Blocks.BLUE_CONCRETE_POWDER, Blocks.BLUE_CONCRETE);
solidifyConcrete(consumer, Blocks.BROWN_CONCRETE_POWDER, Blocks.BROWN_CONCRETE);
solidifyConcrete(consumer, Blocks.GREEN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE);
solidifyConcrete(consumer, Blocks.RED_CONCRETE_POWDER, Blocks.RED_CONCRETE);
solidifyConcrete(consumer, Blocks.BLACK_CONCRETE_POWDER, Blocks.BLACK_CONCRETE);

ARCRecipeBuilder.arc(Ingredient.of(ItemTags.BEDS), hydration, cauldron_use, new ItemStack(Items.WHITE_BED), null).build(consumer, BloodMagic.rl(basePath + "wash_bed"));
ARCRecipeBuilder.arc(Ingredient.of(ItemTags.WOOL), hydration, cauldron_use, new ItemStack(Items.WHITE_WOOL), null).build(consumer, BloodMagic.rl(basePath + "wash_wool"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public class BloodMagicTags
public static final TagKey<Item> SHOVELS = ItemTags.create(new ResourceLocation("forge:shovels"));
public static final TagKey<Item> PICKAXES = ItemTags.create(new ResourceLocation("forge:pickaxes"));
public static final TagKey<Item> HOES = ItemTags.create(new ResourceLocation("forge:hoes"));
public static final TagKey<Item> SCYTHES = ItemTags.create(new ResourceLocation("forge:tool/scythes"));

// Modded (for meteor rituals)
public static final TagKey<Item> ADVANCED_ALLOY = getForgeAlloyTag("advanced");
Expand Down
25 changes: 24 additions & 1 deletion src/main/java/wayoftime/bloodmagic/loot/GlobalLootModifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.BlockPos;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.SmeltingRecipe;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.common.loot.LootModifier;
import net.minecraftforge.items.ItemHandlerHelper;
Expand Down Expand Up @@ -70,6 +73,16 @@ public SilkTouchTestModifier(LootItemCondition[] conditionsIn)
fakeTool.enchant(Enchantments.SILK_TOUCH, 1);
LootParams.Builder builder = new LootParams.Builder(context.getLevel());
builder.withParameter(LootContextParams.TOOL, fakeTool);

Vec3 vec = context.getParam(LootContextParams.ORIGIN);
if (vec != null) {
BlockPos pos = BlockPos.containing(vec);
BlockEntity be = context.getLevel().getBlockEntity(pos);
if (be != null) {
builder.withParameter(LootContextParams.BLOCK_ENTITY, be);
}
}

LootParams ctx = builder.create(LootContextParamSets.EMPTY);
LootTable loottable = context.getLevel().getServer().getLootData().getLootTable(context.getParamOrNull(LootContextParams.BLOCK_STATE).getBlock().getLootTable());
return loottable.getRandomItems(ctx);
Expand Down Expand Up @@ -129,7 +142,17 @@ public FortuneModifier(LootItemCondition[] conditionsIn)

LootParams.Builder builder = new LootParams.Builder(context.getLevel());
builder.withParameter(LootContextParams.TOOL, fakeTool);
LootParams ctx = builder.create(LootContextParamSets.EMPTY);

Vec3 vec = context.getParam(LootContextParams.ORIGIN);
if (vec != null) {
BlockPos pos = BlockPos.containing(vec);
BlockEntity be = context.getLevel().getBlockEntity(pos);
if (be != null) {
builder.withParameter(LootContextParams.BLOCK_ENTITY, be);
}
}

LootParams ctx = builder.create(LootContextParamSets.EMPTY);
LootTable loottable = context.getLevel().getServer().getLootData().getLootTable(context.getParamOrNull(LootContextParams.BLOCK_STATE).getBlock().getLootTable());
return loottable.getRandomItems(ctx);
}
Expand Down