use of com.simibubi.create.content.logistics.item.filter.ItemAttribute in project Create by Creators-of-Create.
the class BlueprintOverlayRenderer method getItemsMatchingFilter.
private static ItemStack[] getItemsMatchingFilter(ItemStack filter) {
return cachedRenderedFilters.computeIfAbsent(filter, itemStack -> {
CompoundTag tag = itemStack.getOrCreateTag();
if (AllItems.FILTER.isIn(itemStack) && !tag.getBoolean("Blacklist")) {
ItemStackHandler filterItems = FilterItem.getFilterItems(itemStack);
List<ItemStack> list = new ArrayList<>();
for (int slot = 0; slot < filterItems.getSlots(); slot++) {
ItemStack stackInSlot = filterItems.getStackInSlot(slot);
if (!stackInSlot.isEmpty())
list.add(stackInSlot);
}
return list.toArray(new ItemStack[list.size()]);
}
if (AllItems.ATTRIBUTE_FILTER.isIn(itemStack)) {
WhitelistMode whitelistMode = WhitelistMode.values()[tag.getInt("WhitelistMode")];
ListTag attributes = tag.getList("MatchedAttributes", net.minecraft.nbt.Tag.TAG_COMPOUND);
if (whitelistMode == WhitelistMode.WHITELIST_DISJ && attributes.size() == 1) {
ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0));
if (fromNBT instanceof ItemAttribute.InTag) {
ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT;
Tag<Item> itag = ItemTags.getAllTags().getTag(inTag.tagName);
if (itag != null)
return Ingredient.of(itag).getItems();
}
}
}
return new ItemStack[0];
});
}
use of com.simibubi.create.content.logistics.item.filter.ItemAttribute in project Create by Creators-of-Create.
the class AstralSorceryAttunementAttribute method listAttributesOf.
@Override
public List<ItemAttribute> listAttributesOf(ItemStack itemStack) {
CompoundTag nbt = extractAstralNBT(itemStack);
String constellation = nbt.contains("constellation") ? nbt.getString("constellation") : nbt.getString("constellationName");
// Special handling for shifting stars
ResourceLocation itemResource = itemStack.getItem().getRegistryName();
if (itemResource != null && itemResource.toString().contains("shifting_star_")) {
constellation = itemResource.toString().replace("shifting_star_", "");
}
List<ItemAttribute> atts = new ArrayList<>();
if (constellation.length() > 0) {
atts.add(new AstralSorceryAttunementAttribute(constellation));
}
return atts;
}
use of com.simibubi.create.content.logistics.item.filter.ItemAttribute in project Create by Creators-of-Create.
the class AstralSorceryPerkGemAttribute method listAttributesOf.
@Override
public List<ItemAttribute> listAttributesOf(ItemStack itemStack) {
ListTag traits = extractTraitList(itemStack);
List<ItemAttribute> atts = new ArrayList<>();
for (int i = 0; i < traits.size(); i++) {
atts.add(new AstralSorceryPerkGemAttribute(traits.getCompound(i).getString("type")));
}
return atts;
}
use of com.simibubi.create.content.logistics.item.filter.ItemAttribute in project Create by Creators-of-Create.
the class AstralSorceryAmuletAttribute method listAttributesOf.
@Override
public List<ItemAttribute> listAttributesOf(ItemStack itemStack) {
ListTag traits = extractTraitList(itemStack);
List<ItemAttribute> atts = new ArrayList<>();
for (int i = 0; i < traits.size(); i++) {
atts.add(new AstralSorceryAmuletAttribute(traits.getCompound(i).getString("ench"), traits.getCompound(i).getInt("type")));
}
return atts;
}
use of com.simibubi.create.content.logistics.item.filter.ItemAttribute in project Create by Creators-of-Create.
the class AstralSorceryCrystalAttribute method listAttributesOf.
@Override
public List<ItemAttribute> listAttributesOf(ItemStack itemStack) {
ListTag traits = extractTraitList(itemStack);
List<ItemAttribute> atts = new ArrayList<>();
for (int i = 0; i < traits.size(); i++) {
atts.add(new AstralSorceryCrystalAttribute(traits.getCompound(i).getString("property")));
}
return atts;
}
Aggregations