diff --git a/changelog.txt b/changelog.txt index fc6f8a31..1b72bc97 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +------------------------------------------------------ +Version 3.0.5 +------------------------------------------------------ +- Fixed a crash with the Blood Altar because I am dumb. +- Also fixed the recipe for the Day array. + ------------------------------------------------------ Version 3.0.4 ------------------------------------------------------ diff --git a/src/main/java/wayoftime/bloodmagic/common/item/ItemAnointmentProvider.java b/src/main/java/wayoftime/bloodmagic/common/item/ItemAnointmentProvider.java new file mode 100644 index 00000000..aef5665c --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/common/item/ItemAnointmentProvider.java @@ -0,0 +1,74 @@ +package wayoftime.bloodmagic.common.item; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.SwordItem; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.world.World; +import net.minecraftforge.common.ToolType; +import wayoftime.bloodmagic.BloodMagic; +import wayoftime.bloodmagic.anointment.Anointment; + +public class ItemAnointmentProvider extends Item +{ + public Anointment anointment; + + public ItemAnointmentProvider(Anointment anointment) + { + super(new Item.Properties().maxStackSize(16).group(BloodMagic.TAB)); + + this.anointment = anointment; + } + + @Override + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) + { + 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(); +// double wantedVelocity = 1.7; +// +// // TODO - Revisit after potions +//// if (player.isPotionActive(RegistrarBloodMagic.BOOST)) +//// { +//// int amplifier = player.getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier(); +//// wantedVelocity += (1 + amplifier) * (0.35); +//// } +// +// player.setMotion(vec.x * wantedVelocity, vec.y * wantedVelocity, vec.z * wantedVelocity); +// } +// +// world.playSound(player, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) +// * 0.8F); + + if (!world.isRemote) + { + if (!weaponStack.isEmpty() && isItemValidForApplication(weaponStack)) + { + ToolType d; + } + } + + return super.onItemRightClick(world, player, hand); + } + + public boolean isItemValidForApplication(ItemStack stack) + { + return isItemTool(stack) || isItemSword(stack); + } + + public static boolean isItemTool(ItemStack stack) + { + return !stack.getItem().getToolTypes(stack).isEmpty(); + } + + public static boolean isItemSword(ItemStack stack) + { + return stack.getItem() instanceof SwordItem; + } +} diff --git a/src/main/java/wayoftime/bloodmagic/tile/TileAltar.java b/src/main/java/wayoftime/bloodmagic/tile/TileAltar.java index 79d66235..897d72d6 100644 --- a/src/main/java/wayoftime/bloodmagic/tile/TileAltar.java +++ b/src/main/java/wayoftime/bloodmagic/tile/TileAltar.java @@ -226,8 +226,12 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickableTi protected void invalidateCaps() { super.invalidateCaps(); - fluidOptional.invalidate(); - fluidOptional = null; + if (fluidOptional != null) + { + fluidOptional.invalidate(); + fluidOptional = null; + } + } @SuppressWarnings("unchecked")