2011-10-01 13:30:59 -04:00
|
|
|
package org.bukkit;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import org.apache.commons.lang.Validate;
|
|
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
2019-03-13 17:42:57 +11:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
2012-01-29 11:10:40 +01:00
|
|
|
|
2011-10-01 13:30:59 -04:00
|
|
|
/**
|
|
|
|
* Represents the art on a painting
|
|
|
|
*/
|
2019-04-23 12:00:00 +10:00
|
|
|
public enum Art implements Keyed {
|
2011-12-25 16:02:30 +01:00
|
|
|
KEBAB(0, 1, 1),
|
|
|
|
AZTEC(1, 1, 1),
|
|
|
|
ALBAN(2, 1, 1),
|
|
|
|
AZTEC2(3, 1, 1),
|
|
|
|
BOMB(4, 1, 1),
|
|
|
|
PLANT(5, 1, 1),
|
|
|
|
WASTELAND(6, 1, 1),
|
|
|
|
POOL(7, 2, 1),
|
|
|
|
COURBET(8, 2, 1),
|
|
|
|
SEA(9, 2, 1),
|
|
|
|
SUNSET(10, 2, 1),
|
|
|
|
CREEBET(11, 2, 1),
|
|
|
|
WANDERER(12, 1, 2),
|
|
|
|
GRAHAM(13, 1, 2),
|
2012-01-29 11:10:40 +01:00
|
|
|
MATCH(14, 2, 2),
|
2011-12-25 16:02:30 +01:00
|
|
|
BUST(15, 2, 2),
|
|
|
|
STAGE(16, 2, 2),
|
|
|
|
VOID(17, 2, 2),
|
|
|
|
SKULL_AND_ROSES(18, 2, 2),
|
2012-10-22 03:30:04 -05:00
|
|
|
WITHER(19, 2, 2),
|
|
|
|
FIGHTERS(20, 4, 2),
|
|
|
|
POINTER(21, 4, 4),
|
|
|
|
PIGSCENE(22, 4, 4),
|
2018-07-15 10:00:00 +10:00
|
|
|
BURNING_SKULL(23, 4, 4),
|
2012-10-22 03:30:04 -05:00
|
|
|
SKELETON(24, 4, 3),
|
2018-07-15 10:00:00 +10:00
|
|
|
DONKEY_KONG(25, 4, 3);
|
2012-01-29 11:10:40 +01:00
|
|
|
|
2019-04-23 12:00:00 +10:00
|
|
|
private final int id, width, height;
|
|
|
|
private final NamespacedKey key;
|
2012-01-29 11:10:40 +01:00
|
|
|
private static final HashMap<String, Art> BY_NAME = Maps.newHashMap();
|
|
|
|
private static final HashMap<Integer, Art> BY_ID = Maps.newHashMap();
|
2011-10-01 13:30:59 -04:00
|
|
|
|
|
|
|
private Art(int id, int width, int height) {
|
|
|
|
this.id = id;
|
|
|
|
this.width = width;
|
|
|
|
this.height = height;
|
2019-04-23 12:00:00 +10:00
|
|
|
this.key = NamespacedKey.minecraft(name().toLowerCase(java.util.Locale.ENGLISH));
|
2011-10-01 13:30:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the width of the painting, in blocks
|
|
|
|
*
|
|
|
|
* @return The width of the painting, in blocks
|
|
|
|
*/
|
|
|
|
public int getBlockWidth() {
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the height of the painting, in blocks
|
|
|
|
*
|
|
|
|
* @return The height of the painting, in blocks
|
|
|
|
*/
|
|
|
|
public int getBlockHeight() {
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the ID of this painting.
|
|
|
|
*
|
|
|
|
* @return The ID of this painting
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-10-01 13:30:59 -04:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-10-01 13:30:59 -04:00
|
|
|
public int getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2019-04-23 12:00:00 +10:00
|
|
|
@NotNull
|
|
|
|
@Override
|
|
|
|
public NamespacedKey getKey() {
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
2011-10-01 13:30:59 -04:00
|
|
|
/**
|
|
|
|
* Get a painting by its numeric ID
|
|
|
|
*
|
|
|
|
* @param id The ID
|
|
|
|
* @return The painting
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-10-01 13:30:59 -04:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2019-03-13 17:42:57 +11:00
|
|
|
@Nullable
|
2011-10-01 13:30:59 -04:00
|
|
|
public static Art getById(int id) {
|
2012-01-29 11:10:40 +01:00
|
|
|
return BY_ID.get(id);
|
2011-10-01 13:30:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a painting by its unique name
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2012-01-29 11:10:40 +01:00
|
|
|
* This ignores underscores and capitalization
|
2011-10-01 13:30:59 -04:00
|
|
|
*
|
|
|
|
* @param name The name
|
|
|
|
* @return The painting
|
|
|
|
*/
|
2019-03-13 17:42:57 +11:00
|
|
|
@Nullable
|
|
|
|
public static Art getByName(@NotNull String name) {
|
2012-01-29 11:10:40 +01:00
|
|
|
Validate.notNull(name, "Name cannot be null");
|
|
|
|
|
2018-07-15 10:00:00 +10:00
|
|
|
return BY_NAME.get(name.toLowerCase(java.util.Locale.ENGLISH));
|
2012-01-29 11:10:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
|
|
|
for (Art art : values()) {
|
|
|
|
BY_ID.put(art.id, art);
|
2018-07-15 10:00:00 +10:00
|
|
|
BY_NAME.put(art.toString().toLowerCase(java.util.Locale.ENGLISH), art);
|
2012-01-29 11:10:40 +01:00
|
|
|
}
|
2011-10-01 13:30:59 -04:00
|
|
|
}
|
|
|
|
}
|