Skip to content

Commit c1147e6

Browse files
committed
Implement basic component for enchantments and map id component
1 parent 23f4658 commit c1147e6

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package dev.simplix.protocolize.api.item.component;
2+
3+
import dev.simplix.protocolize.api.Protocolize;
4+
import java.util.Map;
5+
6+
public interface EnchantmentsComponent extends StructuredComponent {
7+
8+
Map<Integer, Integer> getEnchantments();
9+
10+
void setEnchantments(Map<Integer, Integer> enchantments);
11+
12+
void removeEnchantment(int id);
13+
14+
void addEnchantment(int id, int level);
15+
16+
void setShowInTooltip(boolean show);
17+
18+
void removeAllEnchantments();
19+
20+
static EnchantmentsComponent create(Map<Integer, Integer> enchantments) {
21+
return Protocolize.getService(Factory.class).create(enchantments);
22+
}
23+
24+
static EnchantmentsComponent create(Map<Integer, Integer> enchantments, boolean showInTooltip) {
25+
return Protocolize.getService(Factory.class).create(enchantments, showInTooltip);
26+
}
27+
28+
interface Factory {
29+
30+
EnchantmentsComponent create(Map<Integer, Integer> enchantments);
31+
32+
EnchantmentsComponent create(Map<Integer, Integer> enchantments, boolean showInTooltip);
33+
34+
}
35+
36+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package dev.simplix.protocolize.api.item.component;
2+
3+
import dev.simplix.protocolize.api.Protocolize;
4+
5+
public interface MapIdComponent extends StructuredComponent {
6+
7+
int getId();
8+
9+
void setId(int id);
10+
11+
static MapIdComponent create(int id) {
12+
return Protocolize.getService(Factory.class).create(id);
13+
}
14+
15+
interface Factory {
16+
17+
MapIdComponent create(int id);
18+
19+
}
20+
21+
}

0 commit comments

Comments
 (0)