Added most of the rest of the Anointment framework and a few more items.

Includes a Fortune, Silk Touch, and +damage Anointment.
This commit is contained in:
WayofTime 2021-01-12 08:27:47 -05:00
parent 8d9319e271
commit 7f2c40a1c4
114 changed files with 962 additions and 218 deletions

View file

@ -3,6 +3,7 @@ package wayoftime.bloodmagic.common.data;
import net.minecraft.block.Block;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.generators.ItemModelBuilder;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.client.model.generators.ModelFile;
@ -90,6 +91,11 @@ public class GeneratorItemModels extends ItemModelProvider
registerBlockModel(BloodMagicBlocks.SHAPED_CHARGE.get());
registerBlockModel(BloodMagicBlocks.DEFORESTER_CHARGE.get());
registerMultiLayerItem(BloodMagicItems.SLATE_VIAL.get(), modLoc("item/alchemic_vial"), modLoc("item/alchemic_ribbon"));
registerMultiLayerItem(BloodMagicItems.MELEE_DAMAGE_ANOINTMENT.get(), modLoc("item/alchemic_vial"), modLoc("item/alchemic_liquid"), modLoc("item/alchemic_ribbon"));
registerMultiLayerItem(BloodMagicItems.SILK_TOUCH_ANOINTMENT.get(), modLoc("item/alchemic_vial"), modLoc("item/alchemic_liquid"), modLoc("item/alchemic_ribbon"));
registerMultiLayerItem(BloodMagicItems.FORTUNE_ANOINTMENT.get(), modLoc("item/alchemic_vial"), modLoc("item/alchemic_liquid"), modLoc("item/alchemic_ribbon"));
}
private void registerCustomFullTexture(Block block, String texturePath)
@ -113,7 +119,21 @@ public class GeneratorItemModels extends ItemModelProvider
private void registerBasicItem(Item item)
{
String path = item.getRegistryName().getPath();
singleTexture(path, mcLoc("item/handheld"), "layer0", modLoc("item/" + path));
singleTexture(path, mcLoc("item/generated"), "layer0", modLoc("item/" + path));
}
private void registerMultiLayerItem(Item item, ResourceLocation... locations)
{
String path = item.getRegistryName().getPath();
ItemModelBuilder builder = getBuilder(path).parent(getExistingFile(mcLoc("item/generated")));
// ModelFile model = withExistingParent(path, mcLoc("item/handheld"));
for (int i = 0; i < locations.length; i++)
{
builder.texture("layer" + i, locations[i]);
}
builder.assertExistence();
}
private void registerToggleableItem(Item item)

View file

@ -342,8 +342,15 @@ public class GeneratorLanguage extends LanguageProvider
add("tooltip.bloodmagic.livingarmour.extraExtraInfo", "&9-Hold shift + M for progress info-");
add("tooltip.bloodmagic.slate_vial", "A glass vial infused with a simple slate");
add("chat.bloodmagic.living_upgrade_level_increase", "%s has leveled up to %d");
// Anointments. Doesn't have any spelling to be pedantic about.
add("anointment.bloodmagic.melee_damage", "Whetstone");
add("anointment.bloodmagic.silk_touch", "Soft Touch");
add("anointment.bloodmagic.fortune", "Fortunate");
// Guide
add("guide.bloodmagic.name", "Sanguine Scientiem");
add("guide.bloodmagic.landing_text", "\"It is my dear hope that by holding this tome in your hands, I may impart the knowledge of the lost art that is Blood Magic\"$(br)$(o)- Magus Arcana$()");
@ -522,6 +529,12 @@ public class GeneratorLanguage extends LanguageProvider
addItem(BloodMagicItems.LIVING_TOME, "Living Armour Upgrade Tome");
// Anointment Items
addItem(BloodMagicItems.SLATE_VIAL, "Slate-infused Vial");
addItem(BloodMagicItems.MELEE_DAMAGE_ANOINTMENT, "Honing Oil");
addItem(BloodMagicItems.SILK_TOUCH_ANOINTMENT, "Soft Coating");
addItem(BloodMagicItems.FORTUNE_ANOINTMENT, "Fortuna Extract");
// Alchemy Items
addItem(BloodMagicItems.PLANT_OIL, "Plant Oil");

View file

@ -217,6 +217,12 @@ 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());
// 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, 128));
public static final RegistryObject<Item> SILK_TOUCH_ANOINTMENT = ITEMS.register("silk_touch_anointment", () -> new ItemAnointmentProvider(BloodMagic.rl("silk_touch"), 0x00B0FF, 1, 256));
public static final RegistryObject<Item> FORTUNE_ANOINTMENT = ITEMS.register("fortune_anointment", () -> new ItemAnointmentProvider(BloodMagic.rl("fortune"), 3381504, 1, 128));
// Fragments
public static final RegistryObject<Item> IRON_FRAGMENT = BASICITEMS.register("ironfragment", () -> new ItemBase());
public static final RegistryObject<Item> GOLD_FRAGMENT = BASICITEMS.register("goldfragment", () -> new ItemBase());

View file

@ -4,22 +4,35 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.anointment.Anointment;
import wayoftime.bloodmagic.anointment.AnointmentData;
import wayoftime.bloodmagic.anointment.AnointmentHolder;
import wayoftime.bloodmagic.core.AnointmentRegistrar;
public class ItemAnointmentProvider extends Item
{
public Anointment anointment;
// public Anointment anointment;
public ResourceLocation anointRL;
private int colour;
private int level;
private int maxDamage;
public ItemAnointmentProvider(Anointment anointment)
public ItemAnointmentProvider(ResourceLocation anointRL, int colour, int level, int maxDamage)
{
super(new Item.Properties().maxStackSize(16).group(BloodMagic.TAB));
this.anointment = anointment;
this.anointRL = anointRL;
this.colour = colour;
this.level = level;
this.maxDamage = maxDamage;
// this.anointment = anointment;
}
@Override
@ -27,7 +40,6 @@ public class ItemAnointmentProvider extends Item
{
ItemStack stack = player.getHeldItem(hand);
ItemStack weaponStack = player.getHeldItem(hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND);
// if (world.isRemote && !unusable)
// {
// Vector3d vec = player.getLookVec();
@ -50,7 +62,45 @@ public class ItemAnointmentProvider extends Item
{
if (!weaponStack.isEmpty() && isItemValidForApplication(weaponStack))
{
ToolType d;
AnointmentHolder holder = AnointmentHolder.fromItemStack(weaponStack);
if (holder == null)
{
holder = new AnointmentHolder();
}
if (holder.applyAnointment(weaponStack, AnointmentRegistrar.ANOINTMENT_MAP.get(anointRL), new AnointmentData(level, 0, maxDamage)))
{
// if (world instanceof ServerWorld)
{
SoundEvent soundevent = SoundEvents.ITEM_BOTTLE_EMPTY;
world.playSound(null, player.getPosition(), soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
stack.shrink(1);
holder.toItemStack(weaponStack);
return ActionResult.resultSuccess(stack);
}
}
} else
{
if (!weaponStack.isEmpty() && isItemValidForApplication(weaponStack))
{
AnointmentHolder holder = AnointmentHolder.fromItemStack(weaponStack);
if (holder == null)
{
holder = new AnointmentHolder();
}
if (holder.canApplyAnointment(weaponStack, AnointmentRegistrar.ANOINTMENT_MAP.get(anointRL), new AnointmentData(level, 0, maxDamage)))
{
boolean flag1 = false;
double d0 = (double) (colour >> 16 & 255) / 255.0D;
double d1 = (double) (colour >> 8 & 255) / 255.0D;
double d2 = (double) (colour >> 0 & 255) / 255.0D;
for (int i = 0; i < 16; i++)
{
world.addParticle(flag1 ? ParticleTypes.AMBIENT_ENTITY_EFFECT
: ParticleTypes.ENTITY_EFFECT, player.getPosXRandom(0.3D), player.getPosYRandom(), player.getPosZRandom(0.3D), d0, d1, d2);
}
}
}
}
@ -71,4 +121,9 @@ public class ItemAnointmentProvider extends Item
{
return stack.getItem() instanceof SwordItem;
}
public int getColor()
{
return colour;
}
}

View file

@ -23,7 +23,17 @@ public class ItemBase extends Item
public ItemBase(String desc)
{
super(new Item.Properties().maxStackSize(64).group(BloodMagic.TAB));
this(64, desc);
}
public ItemBase(int stackSize)
{
this(stackSize, "");
}
public ItemBase(int stackSize, String desc)
{
super(new Item.Properties().maxStackSize(stackSize).group(BloodMagic.TAB));
this.desc = desc;
}

View file

@ -39,6 +39,8 @@ public class AlchemyTableRecipeProvider implements ISubRecipeProvider
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.COAL_SAND.get(), 4), 400, 200, 1).addIngredient(Ingredient.fromItems(Items.COAL)).addIngredient(Ingredient.fromItems(Items.COAL)).addIngredient(Ingredient.fromItems(Items.FLINT)).build(consumer, BloodMagic.rl(basePath + "sand_coal"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.BASIC_CUTTING_FLUID.get()), 1000, 200, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.PLANT_OIL.get())).addIngredient(Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE)).addIngredient(Ingredient.fromTag(Tags.Items.GUNPOWDER)).addIngredient(Ingredient.fromItems(Items.SUGAR)).addIngredient(Ingredient.fromTag(BloodMagicTags.DUST_COAL)).addIngredient(Ingredient.fromStacks(new ItemStack(Items.POTION))).build(consumer, BloodMagic.rl(basePath + "basic_cutting_fluid"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.SLATE_VIAL.get(), 8), 500, 200, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE.get())).addIngredient(Ingredient.fromTag(Tags.Items.GLASS)).addIngredient(Ingredient.fromTag(Tags.Items.GLASS)).addIngredient(Ingredient.fromTag(Tags.Items.GLASS)).addIngredient(Ingredient.fromTag(Tags.Items.GLASS)).addIngredient(Ingredient.fromTag(Tags.Items.GLASS)).build(consumer, BloodMagic.rl(basePath + "slate_vial"));
}
}