summaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/funnyteleporters/Utils.java
blob: b0a16495e8ac04459a4c8a320597ca688ab3bf1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package moe.nea.funnyteleporters;

import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Unit;

import java.util.Iterator;

public class Utils {
	public static ItemStack createBlankBlack() {
		var s = new ItemStack(Items.BLACK_STAINED_GLASS_PANE);
		s.set(DataComponentTypes.CUSTOM_NAME, Text.empty());
		s.set(DataComponentTypes.HIDE_TOOLTIP, Unit.INSTANCE);
		return s;
	}

	public static void skipIt(Iterator<?> it, int skipCount) {
		for (; skipCount > 0 && it.hasNext(); skipCount--) {
			it.next();
		}
	}

	public static Style emptyLoreStyle() {
		return Style.EMPTY.withItalic(false);
	}

	public static Style colouredLoreStyle(Formatting formatting) {
		return emptyLoreStyle().withColor(formatting);
	}
}