-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathItemPipeProperties.java
More file actions
98 lines (83 loc) · 2.45 KB
/
Copy pathItemPipeProperties.java
File metadata and controls
98 lines (83 loc) · 2.45 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package gregtech.api.unification.material.properties;
import java.util.Objects;
public class ItemPipeProperties implements IMaterialProperty {
/**
* Items will try to take the path with the lowest priority
*/
private int priority;
/**
* rate in stacks per sec
*/
private float transferRate;
public ItemPipeProperties(int priority, float transferRate) {
this.priority = priority;
this.transferRate = transferRate;
}
/**
* Default property constructor.
*/
public ItemPipeProperties() {
this(1, 0.25f);
}
/**
* Retrieves the priority of the item pipe
*
* @return The item pipe priority
*/
public int getPriority() {
return priority;
}
/**
* Sets the Priority of the item pipe
*/
public ItemPipeProperties setPriority(int priority) {
this.priority = priority;
return this;
}
/**
* Retrieve the transfer rate of the item pipe
*
* @return The transfer rate of the item pipe
*/
public float getTransferRate() {
return transferRate;
}
/**
* Sets the transfer rate of the item pipe
*
* @param transferRate The transfer rate
*/
public ItemPipeProperties setTransferRate(float transferRate) {
this.transferRate = transferRate;
return this;
}
@Override
public void verifyProperty(MaterialProperties properties) {
if (!properties.hasProperty(PropertyKey.WOOD)) {
properties.ensureSet(PropertyKey.INGOT, true);
}
if (properties.hasProperty(PropertyKey.FLUID_PIPE)) {
throw new IllegalStateException(
"Material " + properties.getMaterial() +
" has both Fluid and Item Pipe Property, which is not allowed!");
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ItemPipeProperties that = (ItemPipeProperties) o;
return priority == that.priority && Float.compare(that.transferRate, transferRate) == 0;
}
@Override
public int hashCode() {
return Objects.hash(priority, transferRate);
}
@Override
public String toString() {
return "ItemPipeProperties{" +
"priority=" + priority +
", transferRate=" + transferRate +
'}';
}
}