More item fixes

- Living and Sentient armor have no armor models
- (Self) Sacrifice Pack have no armor models
This commit is contained in:
Nick 2016-03-18 12:45:37 -07:00
parent f95949a1c8
commit 34f5753b17
9 changed files with 75 additions and 176 deletions

View file

@ -8,12 +8,15 @@ import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
@ -34,7 +37,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
public ItemPackSelfSacrifice()
{
super(ArmorMaterial.CHAIN, 0, 1);
super(ArmorMaterial.CHAIN, 0, EntityEquipmentSlot.CHEST);
setUnlocalizedName(Constants.Mod.MODID + ".pack.selfSacrifice");
setRegistryName(Constants.BloodMagicItem.SELF_SACRIFICE_PACK.getRegName());
@ -42,24 +45,24 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (world.isRemote)
return stack;
return ActionResult.newResult(EnumActionResult.FAIL, stack);
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, false);
RayTraceResult position = this.getMovingObjectPositionFromPlayer(world, player, false);
if (position == null)
{
return super.onItemRightClick(stack, world, player);
return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
} else
{
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
if (position.typeOfHit == RayTraceResult.Type.BLOCK)
{
TileEntity tile = world.getTileEntity(position.getBlockPos());
if (!(tile instanceof TileAltar))
return super.onItemRightClick(stack, world, player);
return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
TileAltar altar = (TileAltar) tile;
@ -72,13 +75,13 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
int filledAmount = altar.fillMainTank(amount);
amount -= filledAmount;
setStoredLP(stack, amount);
world.markBlockForUpdate(position.getBlockPos());
world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos()));
}
}
}
}
return stack;
return ActionResult.newResult(EnumActionResult.FAIL, stack);
}
@Override
@ -99,12 +102,6 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
setStoredLP(stack, CAPACITY);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
return Constants.Mod.DOMAIN + "models/armor/bloodPack_layer_1.png";
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced)
{