mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-16 21:21:22 +01:00
Added precison to the InventoryModifier comments
This commit is contained in:
parent
c03a2992ef
commit
8612245ff9
@ -7,12 +7,12 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an inventory where its items can be modified/retrieved.
|
* Represents an inventory where items can be modified/retrieved.
|
||||||
*/
|
*/
|
||||||
public interface InventoryModifier {
|
public interface InventoryModifier {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an {@link ItemStack} at the specified slot.
|
* Sets an {@link ItemStack} at the specified slot and send relevant update to the viewer(s).
|
||||||
*
|
*
|
||||||
* @param slot the slot to set the item
|
* @param slot the slot to set the item
|
||||||
* @param itemStack the item to set
|
* @param itemStack the item to set
|
||||||
@ -20,7 +20,9 @@ public interface InventoryModifier {
|
|||||||
void setItemStack(int slot, @NotNull ItemStack itemStack);
|
void setItemStack(int slot, @NotNull ItemStack itemStack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an {@link ItemStack} to the inventory.
|
* Adds an {@link ItemStack} to the inventory and send relevant update to the viewer(s).
|
||||||
|
* <p>
|
||||||
|
* Even the item cannot be fully added, the amount of {@code itemStack} will be updated.
|
||||||
*
|
*
|
||||||
* @param itemStack the item to add
|
* @param itemStack the item to add
|
||||||
* @return true if the item has been successfully fully added, false otherwise
|
* @return true if the item has been successfully fully added, false otherwise
|
||||||
@ -28,7 +30,7 @@ public interface InventoryModifier {
|
|||||||
boolean addItemStack(@NotNull ItemStack itemStack);
|
boolean addItemStack(@NotNull ItemStack itemStack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the inventory.
|
* Clears the inventory and send relevant update to the viewer(s).
|
||||||
*/
|
*/
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ public interface InventoryModifier {
|
|||||||
/**
|
/**
|
||||||
* Gets all the {@link InventoryCondition} of this inventory.
|
* Gets all the {@link InventoryCondition} of this inventory.
|
||||||
*
|
*
|
||||||
* @return the inventory conditions
|
* @return a modifiable {@link List} containing all the inventory conditions
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
List<InventoryCondition> getInventoryConditions();
|
List<InventoryCondition> getInventoryConditions();
|
||||||
|
@ -205,7 +205,7 @@ public class InventoryClickProcessor {
|
|||||||
if (!clickedRule.canApply(clicked, amount + 1))
|
if (!clickedRule.canApply(clicked, amount + 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int totalAmount = clickedRule.getAmount(resultClicked) + amount;
|
final int totalAmount = clickedRule.getAmount(resultClicked) + amount;
|
||||||
if (!clickedRule.canApply(clicked, totalAmount)) {
|
if (!clickedRule.canApply(clicked, totalAmount)) {
|
||||||
item = itemRule.apply(item, itemRule.getMaxSize());
|
item = itemRule.apply(item, itemRule.getMaxSize());
|
||||||
itemSetter.accept(index, item);
|
itemSetter.accept(index, item);
|
||||||
@ -278,7 +278,7 @@ public class InventoryClickProcessor {
|
|||||||
int finalCursorAmount = cursorAmount;
|
int finalCursorAmount = cursorAmount;
|
||||||
|
|
||||||
for (Integer s : slots) {
|
for (Integer s : slots) {
|
||||||
ItemStack draggedItem = cursor.copy();
|
final ItemStack draggedItem = cursor.copy();
|
||||||
ItemStack slotItem = itemGetter.apply(s);
|
ItemStack slotItem = itemGetter.apply(s);
|
||||||
|
|
||||||
clickResult = startCondition(clickResult, inventory, player, s, ClickType.DRAGGING, slotItem, cursor);
|
clickResult = startCondition(clickResult, inventory, player, s, ClickType.DRAGGING, slotItem, cursor);
|
||||||
|
Loading…
Reference in New Issue
Block a user