Search in sources :

Example 1 with TypeHelmetRender

use of hellfirepvp.astralsorcery.common.base.patreon.types.TypeHelmetRender in project AstralSorcery by HellFirePvP.

the class ProviderHelmetRender method buildEffect.

@Override
public TypeHelmetRender buildEffect(UUID playerUUID, List<String> effectParameters) throws Exception {
    UUID effectUniqueId = UUID.fromString(effectParameters.get(0));
    if (effectParameters.get(1).equals("astralsorcery:blockaltar;3")) {
        effectParameters.set(1, "astralsorcery:altar_radiance");
    }
    String[] itemInfo = effectParameters.get(1).split(";");
    Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemInfo[0]));
    if (item == null || item == Items.AIR) {
        throw new IllegalArgumentException("Unknown item: " + itemInfo[0]);
    }
    ItemStack stack = new ItemStack(item);
    if (itemInfo.length > 1) {
        int data = Integer.parseInt(itemInfo[1]);
        stack.setDamage(data);
    }
    FlareColor flColor = effectParameters.size() > 2 ? FlareColor.valueOf(effectParameters.get(2)) : null;
    return new TypeHelmetRender(effectUniqueId, flColor, playerUUID, stack);
}
Also used : Item(net.minecraft.item.Item) ResourceLocation(net.minecraft.util.ResourceLocation) TypeHelmetRender(hellfirepvp.astralsorcery.common.base.patreon.types.TypeHelmetRender) UUID(java.util.UUID) ItemStack(net.minecraft.item.ItemStack) FlareColor(hellfirepvp.astralsorcery.common.base.patreon.FlareColor)

Aggregations

FlareColor (hellfirepvp.astralsorcery.common.base.patreon.FlareColor)1 TypeHelmetRender (hellfirepvp.astralsorcery.common.base.patreon.types.TypeHelmetRender)1 UUID (java.util.UUID)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1