-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathGTItemStackHandler.java
More file actions
42 lines (31 loc) · 1.13 KB
/
GTItemStackHandler.java
File metadata and controls
42 lines (31 loc) · 1.13 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
package gregtech.api.items.itemhandlers;
import gregtech.api.metatileentity.MetaTileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.items.ItemStackHandler;
import org.jetbrains.annotations.NotNull;
public class GTItemStackHandler extends ItemStackHandler {
final private MetaTileEntity metaTileEntity;
public GTItemStackHandler(MetaTileEntity metaTileEntity) {
super();
this.metaTileEntity = metaTileEntity;
}
public GTItemStackHandler(MetaTileEntity metaTileEntity, int size) {
super(size);
this.metaTileEntity = metaTileEntity;
}
public GTItemStackHandler(MetaTileEntity metaTileEntity, NonNullList<ItemStack> stacks) {
super(stacks);
this.metaTileEntity = metaTileEntity;
}
@Override
public void setStackInSlot(int slot, @NotNull ItemStack stack) {
if (ItemStack.areItemStacksEqual(stack, getStackInSlot(slot)))
return;
super.setStackInSlot(slot, stack);
}
@Override
public void onContentsChanged(int slot) {
metaTileEntity.markDirty();
}
}