use of net.minecraft.entity.item.ItemFrameEntity in project minecolonies by ldtteam.
the class ItemStackUtils method getListOfStackForEntity.
/**
* Adds entities to the builder building if he needs it.
*
* @param entity the entity object.
* @param placer the entity placer.
* @return a list of stacks.
*/
public static List<ItemStorage> getListOfStackForEntity(final Entity entity, final Entity placer) {
if (entity != null) {
final List<ItemStorage> request = new ArrayList<>();
if (entity instanceof ItemFrameEntity) {
final ItemStack stack = ((ItemFrameEntity) entity).getItem();
if (!ItemStackUtils.isEmpty(stack)) {
ItemStackUtils.setSize(stack, 1);
request.add(new ItemStorage(stack));
}
request.add(new ItemStorage(new ItemStack(Items.ITEM_FRAME, 1)));
} else if (entity instanceof ArmorStandEntity) {
request.add(new ItemStorage(entity.getPickedResult(new EntityRayTraceResult(placer))));
entity.getArmorSlots().forEach(item -> request.add(new ItemStorage(item)));
entity.getHandSlots().forEach(item -> request.add(new ItemStorage(item)));
}
return request.stream().filter(stack -> !stack.getItemStack().isEmpty()).collect(Collectors.toList());
}
return Collections.emptyList();
}
Aggregations