-
Notifications
You must be signed in to change notification settings - Fork 0
/
CraftArt.java
33 lines (27 loc) · 1 KB
/
CraftArt.java
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
package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.server.Paintings;
import org.bukkit.Art;
public class CraftArt {
private static final BiMap<Paintings, Art> artwork;
static {
ImmutableBiMap.Builder<Paintings, Art> artworkBuilder = ImmutableBiMap.builder();
for (ResourceLocation key : Paintings.a.keySet()) {
artworkBuilder.put(Paintings.a.get(key), Art.getByName(key.getResourcePath()));
}
artwork = artworkBuilder.build();
}
public static Art NotchToBukkit(Paintings art) {
Art bukkit = artwork.get(art);
Preconditions.checkArgument(bukkit != null);
return bukkit;
}
public static Paintings BukkitToNotch(Art art) {
Paintings nms = artwork.inverse().get(art);
Preconditions.checkArgument(nms != null);
return nms;
}
}