Search in sources :

Example 6 with EnumRarity

use of net.minecraft.item.EnumRarity in project ImmersiveEngineering by BluSunrize.

the class ShaderRegistry method getHigherRarities.

public static ArrayList<EnumRarity> getHigherRarities(EnumRarity rarity) {
    ArrayList<EnumRarity> list = new ArrayList<EnumRarity>();
    int idx = sortedRarityMap.indexOf(rarity);
    if (idx <= 0)
        return list;
    int next = idx - 1;
    int weight = rarityWeightMap.get(rarity);
    int lowerWeight = -1;
    for (; next >= 0; next--) {
        EnumRarity r = sortedRarityMap.get(next);
        int rWeight = rarityWeightMap.get(r);
        if (rWeight < weight && (lowerWeight == -1 || rWeight >= lowerWeight)) {
            list.add(r);
            lowerWeight = rWeight;
        }
    }
    return list;
}
Also used : EnumRarity(net.minecraft.item.EnumRarity)

Example 7 with EnumRarity

use of net.minecraft.item.EnumRarity in project ImmersiveEngineering by BluSunrize.

the class RecipeShaderBags method getCraftingResult.

@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        ItemStack stackInSlot = inv.getStackInSlot(i);
        if (stackInSlot != null) {
            ItemStack output = new ItemStack(IEContent.itemShaderBag, IEContent.itemShaderBag.equals(stackInSlot.getItem()) ? 2 : 1);
            EnumRarity next = ShaderRegistry.getLowerRarity(stackInSlot.getRarity());
            if (next != null) {
                ItemNBTHelper.setString(output, "rarity", next.toString());
                return output;
            }
        }
    }
    return null;
}
Also used : EnumRarity(net.minecraft.item.EnumRarity) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EnumRarity (net.minecraft.item.EnumRarity)7 ItemStack (net.minecraft.item.ItemStack)4 ManualPages (blusunrize.lib.manual.ManualPages)1 PositionedItemStack (blusunrize.lib.manual.ManualPages.PositionedItemStack)1 ToolTipLine (mods.railcraft.common.gui.tooltips.ToolTipLine)1 EntityItem (net.minecraft.entity.item.EntityItem)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1