Fixed the null check in GenericHandler for using a bow.

This commit is contained in:
WayofTime 2021-01-23 10:05:56 -05:00
parent 5fda25052d
commit 37051b4e34
2 changed files with 21 additions and 10 deletions

View file

@ -26,14 +26,14 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.registries.ObjectHolder;
import wayoftime.bloodmagic.api.event.BloodMagicCraftedEvent;
import wayoftime.bloodmagic.impl.BloodMagicAPI;
import wayoftime.bloodmagic.recipe.RecipeAlchemyTable;
import wayoftime.bloodmagic.common.item.BloodOrb;
import wayoftime.bloodmagic.common.item.IBindable;
import wayoftime.bloodmagic.common.item.IBloodOrb;
import wayoftime.bloodmagic.core.data.Binding;
import wayoftime.bloodmagic.core.data.SoulNetwork;
import wayoftime.bloodmagic.core.data.SoulTicket;
import wayoftime.bloodmagic.common.item.IBindable;
import wayoftime.bloodmagic.common.item.BloodOrb;
import wayoftime.bloodmagic.common.item.IBloodOrb;
import wayoftime.bloodmagic.impl.BloodMagicAPI;
import wayoftime.bloodmagic.recipe.RecipeAlchemyTable;
import wayoftime.bloodmagic.tile.container.ContainerAlchemyTable;
import wayoftime.bloodmagic.util.Constants;
import wayoftime.bloodmagic.util.helper.NetworkHelper;
@ -256,8 +256,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
// Simple recipes
RecipeAlchemyTable recipeAlchemyTable = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyTable(world, inputList);
if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote
&& tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon())))
if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon())))
{
if (burnTime == 1)
notifyUpdate();
@ -417,14 +416,22 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
{
setInventorySlotContents(i, inputStack.getItem().getContainerItem(inputStack));
continue;
} else if (inputStack.isDamageable())
} else if (inputStack.getMaxDamage() > 0)
{
inputStack.setDamage(inputStack.getDamage() + 1);
if (inputStack.getDamage() >= inputStack.getMaxDamage())
// inputStack.setDamage(inputStack.getDamage() + 1);
// if (inputStack.getDamage() >= inputStack.getMaxDamage())
// {
//
// }
if (inputStack.attemptDamageItem(1, world.rand, null))
{
setInventorySlotContents(i, ItemStack.EMPTY);
}
continue;
} else if (!inputStack.isDamageable())
{
continue;
}
inputStack.shrink(1);

View file

@ -559,6 +559,10 @@ public class GenericHandler
if (stack.getItem() instanceof BowItem || stack.getItem() instanceof CrossbowItem)
{
AnointmentHolder holder = AnointmentHolder.fromItemStack(stack);
if (holder == null)
{
return;
}
int quickDrawLevel = holder.getAnointmentLevel(AnointmentRegistrar.ANOINTMENT_QUICK_DRAW.get());
if (quickDrawLevel > 0)
{