Package mindustry.world.modules
Class ItemModule
java.lang.Object
mindustry.world.modules.BlockModule
mindustry.world.modules.ItemModule
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ItemModule
protected int[]
protected int
protected int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
void
add
(ItemModule items) boolean
any()
void
clear()
copy()
void
each
(ItemModule.ItemConsumer cons) boolean
empty()
first()
int
get
(int id) int
float
getFlowRate
(Item item) void
handleFlow
(Item item, int amount) boolean
has
(int id) boolean
boolean
boolean
boolean
boolean
boolean
boolean
hasFlowItem
(Item item) boolean
Returns true if this entity has at least one of each item in each stack.int
length()
int
nextIndex
(int takeRotation) void
void
void
void
void
void
void
void
set
(ItemModule other) void
stopFlow()
float
sum
(ItemModule.ItemCalculator calc) take()
takeIndex
(int takeRotation) Begins a speculative take operation.toString()
int
total()
void
void
void
Methods inherited from class mindustry.world.modules.BlockModule
read
-
Field Details
-
empty
-
items
protected int[] items -
total
protected int total -
takeRotation
protected int takeRotation
-
-
Constructor Details
-
ItemModule
public ItemModule()
-
-
Method Details
-
copy
-
set
-
updateFlow
public void updateFlow() -
stopFlow
public void stopFlow() -
length
public int length() -
getFlowRate
- Returns:
- a specific item's flow rate in items/s; any value < 0 means not ready.
-
hasFlowItem
-
each
-
sum
-
has
public boolean has(int id) -
has
-
has
-
has
-
has
-
has
-
has
-
hasOne
Returns true if this entity has at least one of each item in each stack. -
empty
public boolean empty() -
total
public int total() -
any
public boolean any() -
first
-
take
-
takeIndex
Begins a speculative take operation. This returns the item that would be returned by #take(), but does not change state. -
nextIndex
public int nextIndex(int takeRotation) -
get
public int get(int id) -
get
-
set
-
add
-
add
-
add
-
add
-
handleFlow
-
undoFlow
-
remove
-
remove
-
remove
-
remove
-
remove
-
clear
public void clear() -
write
- Specified by:
write
in classBlockModule
-
read
- Overrides:
read
in classBlockModule
-
toString
-