Java Code Examples for net.minecraft.entity.EntityLiving#getArmorPosition()

The following examples show how to use net.minecraft.entity.EntityLiving#getArmorPosition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfusionVisualDisguiseArmor.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void findArmorItems() {
    List<ItemStack> items = new ArrayList<ItemStack>();
    for (Object o : Item.itemRegistry) {
        if (o instanceof Item && ((Item) o).getCreativeTab() != null) {
            List list = new ArrayList();

            try {
                ((Item) o).getSubItems((Item) o, ((Item) o).getCreativeTab(), list);
            } catch (Throwable ignored) {
            }

            for (Object o2 : list) {
                if (o2 != null && o2 instanceof ItemStack
                        && EntityLiving.getArmorPosition((ItemStack) o2) != 0) {
                    items.add((ItemStack) o2);
                }
            }
        }
    }
    armorItems = items.toArray(new ItemStack[items.size()]);
}
 
Example 2
Source File: InfusionVisualDisguiseArmor.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ItemStack getCurrentDisguise() {
    if(transparent) {
        return new ItemStack(Items.potionitem, 1, POTION_METAS[(int)((System.currentTimeMillis() / 1000) % POTION_METAS.length)]);
    }

    Random random = new Random(System.currentTimeMillis() / 1000);
    int first = getRecipeInput(random);
    int firstPos = EntityLiving.getArmorPosition(armorItems[first]);

    int next;
    do {
        next = random.nextInt(armorItems.length);
    }
    while (next == first || EntityLiving.getArmorPosition(armorItems[next]) != firstPos || !canSee(armorItems[next]));
    return armorItems[next];
}
 
Example 3
Source File: InfusionDisguiseArmor.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean isValidDisguise(ItemStack armor, ItemStack disguise) {
    if(isDisguised(armor) || isDisguised(disguise)) {
        return false;
    }

    int armorPos = EntityLiving.getArmorPosition(armor);
    return armorPos != 0 && (isInvisItem(disguise) || EntityLiving.getArmorPosition(disguise) == armorPos);
}
 
Example 4
Source File: TerminalAddonRecipe.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
private static boolean isSuitableItem(ItemStack itemStack) {
	return EntityLiving.getArmorPosition(itemStack) == 4 &&
			itemStack.stackSize == 1 &&
			!NbtGuidProviders.hasTerminalCapabilities(itemStack);
}