mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-12 10:21:39 +01:00
Rename InventoryType#getAdditionalSlot to InventoryType#getSize
This commit is contained in:
parent
adb9a449bf
commit
7f0dc6d40a
@ -12,7 +12,7 @@ public class InventoryData extends DataType<Inventory> {
|
||||
@Override
|
||||
public void encode(@NotNull BinaryWriter writer, @NotNull Inventory value) {
|
||||
final InventoryType inventoryType = value.getInventoryType();
|
||||
final int size = inventoryType.getAdditionalSlot();
|
||||
final int size = inventoryType.getSize();
|
||||
|
||||
// Inventory title & type
|
||||
writer.writeSizedString(value.getTitle());
|
||||
@ -29,7 +29,7 @@ public class InventoryData extends DataType<Inventory> {
|
||||
public Inventory decode(@NotNull BinaryReader reader) {
|
||||
final String title = reader.readSizedString(Integer.MAX_VALUE);
|
||||
final InventoryType inventoryType = InventoryType.valueOf(reader.readSizedString(Integer.MAX_VALUE));
|
||||
final int size = inventoryType.getAdditionalSlot();
|
||||
final int size = inventoryType.getSize();
|
||||
|
||||
Inventory inventory = new Inventory(inventoryType, title);
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class Inventory implements InventoryModifier, InventoryClickHandler, View
|
||||
this.inventoryType = inventoryType;
|
||||
this.title = title;
|
||||
|
||||
this.size = inventoryType.getAdditionalSlot();
|
||||
this.size = inventoryType.getSize();
|
||||
|
||||
this.offset = size;
|
||||
|
||||
|
@ -30,18 +30,26 @@ public enum InventoryType {
|
||||
CARTOGRAPHY(3),
|
||||
STONE_CUTTER(2);
|
||||
|
||||
private final int slot;
|
||||
private final int size;
|
||||
|
||||
InventoryType(int slot) {
|
||||
this.slot = slot;
|
||||
InventoryType(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public int getWindowType() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getSize()}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getAdditionalSlot() {
|
||||
return slot;
|
||||
return size;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user