-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathCat.java
More file actions
174 lines (143 loc) · 5.07 KB
/
Cat.java
File metadata and controls
174 lines (143 loc) · 5.07 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package org.bukkit.entity;
import com.google.common.base.Preconditions;
import io.papermc.paper.registry.RegistryAccess;
import io.papermc.paper.registry.RegistryElement;
import io.papermc.paper.registry.RegistryKey;
import java.util.Locale;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;
import org.bukkit.DyeColor;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.NotNull;
/**
* Meow.
*/
public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable
/**
* Gets the current type of this cat.
*
* @return Type of the cat.
*/
@NotNull
public Type getCatType();
/**
* Sets the current type of this cat.
*
* @param type New type of this cat.
*/
public void setCatType(@NotNull Type type);
/**
* Get the sound variant of this cat.
*
* @return cat sound variant
*/
@NotNull
SoundVariant getSoundVariant();
/**
* Set the sound variant of this cat.
*
* @param variant cat sound variant
*/
void setSoundVariant(@NotNull SoundVariant variant);
/**
* Get the collar color of this cat
*
* @return the color of the collar
*/
@NotNull
@Override // Paper
public DyeColor getCollarColor();
/**
* Set the collar color of this cat
*
* @param color the color to apply
*/
@Override // Paper
public void setCollarColor(@NotNull DyeColor color);
/**
* Represents the various different cat types there are.
*/
interface Type extends RegistryElement<Type>, OldEnum<Type>, Keyed {
// Start generate - CatType
Type ALL_BLACK = getType("all_black");
Type BLACK = getType("black");
Type BRITISH_SHORTHAIR = getType("british_shorthair");
Type CALICO = getType("calico");
Type JELLIE = getType("jellie");
Type PERSIAN = getType("persian");
Type RAGDOLL = getType("ragdoll");
Type RED = getType("red");
Type SIAMESE = getType("siamese");
Type TABBY = getType("tabby");
Type WHITE = getType("white");
// End generate - CatType
@NotNull
private static Type getType(@NotNull @KeyPattern.Value String key) {
return RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_VARIANT).getOrThrow(Key.key(Key.MINECRAFT_NAMESPACE, key));
}
/**
* @param name of the cat type.
* @return the cat type with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type valueOf(@NotNull String name) {
final NamespacedKey key = NamespacedKey.fromString(name.toLowerCase(Locale.ROOT));
Type type = key == null ? null : RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_VARIANT).get(key);
Preconditions.checkArgument(type != null, "No cat type found with the name %s", name);
return type;
}
/**
* @return an array of all known cat types.
* @deprecated use {@link Registry#stream()}.
*/
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
return RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_VARIANT).stream().toArray(Type[]::new);
}
}
/**
* Represents the sound variant of a cat.
*/
interface SoundVariant extends RegistryElement<SoundVariant>, Keyed {
// Start generate - CatSoundVariant
SoundVariant CLASSIC = getSoundVariant("classic");
SoundVariant ROYAL = getSoundVariant("royal");
// End generate - CatSoundVariant
@NotNull
private static SoundVariant getSoundVariant(final @NotNull @KeyPattern.Value String key) {
return RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_SOUND_VARIANT).getOrThrow(Key.key(Key.MINECRAFT_NAMESPACE, key));
}
}
/**
* Sets if the cat is lying down.
* This is visual and does not affect the behaviour of the cat.
*
* @param lyingDown whether the cat should lie down
*/
public void setLyingDown(boolean lyingDown);
/**
* Gets if the cat is lying down.
*
* @return whether the cat is lying down
*/
public boolean isLyingDown();
/**
* Sets if the cat has its head up.
* This is visual and does not affect the behaviour of the cat.
*
* @param headUp head is up
*/
public void setHeadUp(boolean headUp);
/**
* Gets if the cat has its head up.
*
* @return head is up
*/
public boolean isHeadUp();
}