aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api/Entry.java
blob: c0eb609bb8c660586e3b3f29b5f74330b05b33d2 (plain)
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
43
44
45
46
47
48
49
50
51
52
/*
 * Roughly Enough Items by Danielshe.
 * Licensed under the MIT License.
 */

package me.shedaniel.rei.api;

import me.shedaniel.rei.api.annotations.ToBeRemoved;
import me.shedaniel.rei.impl.FluidEntry;
import me.shedaniel.rei.impl.ItemStackEntry;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;

import javax.annotation.Nullable;

@Deprecated
@ToBeRemoved
public interface Entry extends Cloneable {
    @SuppressWarnings("deprecation")
    static Entry create(ItemStack itemStack) {
        return new ItemStackEntry(itemStack);
    }
    
    @SuppressWarnings("deprecation")
    static Entry create(Fluid fluid) {
        return new FluidEntry(fluid);
    }
    
    Type getEntryType();
    
    @Nullable
    ItemStack getItemStack();
    
    @Nullable
    Fluid getFluid();
    
    Entry clone();
    
    default EntryStack toEntryStack() {
        if (getEntryType() == Type.ITEM)
            return EntryStack.create(getItemStack());
        if (getEntryType() == Type.FLUID)
            return EntryStack.create(getFluid());
        return EntryStack.empty();
    }
    
    boolean equalsEntry(Entry other, boolean checkTags);
    
    public static enum Type {
        ITEM, FLUID
    }
}