Skip to content

Commit 66262e3

Browse files
committed
Always return true for canExtract and canReceive of energy wrappers, and let actual interactions handle the cases we cannot
1 parent cd1cd94 commit 66262e3

File tree

4 files changed

+0
-72
lines changed

4 files changed

+0
-72
lines changed

gradle/wrapper/gradle-wrapper.jar

79 Bytes
Binary file not shown.

src/main/java/mekanism/common/integration/energy/fluxnetworks/FNIntegration.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,35 +117,11 @@ public long getMaxEnergyStoredL() {
117117

118118
@Override
119119
public boolean canExtract() {
120-
//Mark that we can receive energy if we can insert energy
121-
if (handler.extractEnergy(1, Action.SIMULATE) != 0L) {
122-
return true;
123-
}
124-
//Or all our containers are empty. This isn't fully accurate but will give the best
125-
// accuracy to other mods of if we may be able to extract given we are predicate based
126-
// instead of having strict can receive checks
127-
for (int container = 0, containers = handler.getEnergyContainerCount(); container < containers; container++) {
128-
if (handler.getEnergy(container) > 0L) {
129-
return false;
130-
}
131-
}
132120
return true;
133121
}
134122

135123
@Override
136124
public boolean canReceive() {
137-
//Mark that we can receive energy if we can insert energy
138-
if (handler.insertEnergy(1, Action.SIMULATE) == 0) {
139-
return true;
140-
}
141-
//Or all our containers are full. This isn't fully accurate but will give the best
142-
// accuracy to other mods of if we may be able to receive given we are predicate based
143-
// instead of having strict can receive checks
144-
for (int container = 0, containers = handler.getEnergyContainerCount(); container < containers; container++) {
145-
if (handler.getNeededEnergy(container) > 0L) {
146-
return false;
147-
}
148-
}
149125
return true;
150126
}
151127
}

src/main/java/mekanism/common/integration/energy/forgeenergy/ForgeEnergyIntegration.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,35 +126,11 @@ public int getMaxEnergyStored() {
126126

127127
@Override
128128
public boolean canExtract() {
129-
//Mark that we can provide energy if we can extract energy
130-
if (handler.extractEnergy(1, Action.SIMULATE) != 0L) {
131-
return true;
132-
}
133-
//Or all our containers are empty. This isn't fully accurate but will give the best
134-
// accuracy to other mods of if we may be able to extract given we are predicate based
135-
// instead of having strict can receive checks
136-
for (int container = 0, containers = handler.getEnergyContainerCount(); container < containers; container++) {
137-
if (handler.getEnergy(container) > 0L) {
138-
return false;
139-
}
140-
}
141129
return true;
142130
}
143131

144132
@Override
145133
public boolean canReceive() {
146-
//Mark that we can receive energy if we can insert energy
147-
if (handler.insertEnergy(1, Action.SIMULATE) == 0) {
148-
return true;
149-
}
150-
//Or all our containers are full. This isn't fully accurate but will give the best
151-
// accuracy to other mods of if we may be able to receive given we are predicate based
152-
// instead of having strict can receive checks
153-
for (int container = 0, containers = handler.getEnergyContainerCount(); container < containers; container++) {
154-
if (handler.getNeededEnergy(container) > 0L) {
155-
return false;
156-
}
157-
}
158134
return true;
159135
}
160136
}

src/main/java/mekanism/common/integration/energy/grandpower/GPIntegration.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,35 +117,11 @@ public long getCapacity() {
117117

118118
@Override
119119
public boolean canExtract() {
120-
//Mark that we can receive energy if we can insert energy
121-
if (handler.extractEnergy(1, Action.SIMULATE) != 0) {
122-
return true;
123-
}
124-
//Or all our containers are empty. This isn't fully accurate but will give the best
125-
// accuracy to other mods of if we may be able to extract given we are predicate based
126-
// instead of having strict can receive checks
127-
for (int container = 0, containers = handler.getEnergyContainerCount(); container < containers; container++) {
128-
if (handler.getEnergy(container) > 0) {
129-
return false;
130-
}
131-
}
132120
return true;
133121
}
134122

135123
@Override
136124
public boolean canReceive() {
137-
//Mark that we can receive energy if we can insert energy
138-
if (handler.insertEnergy(1, Action.SIMULATE) == 0) {
139-
return true;
140-
}
141-
//Or all our containers are full. This isn't fully accurate but will give the best
142-
// accuracy to other mods of if we may be able to receive given we are predicate based
143-
// instead of having strict can receive checks
144-
for (int container = 0, containers = handler.getEnergyContainerCount(); container < containers; container++) {
145-
if (handler.getNeededEnergy(container) > 0) {
146-
return false;
147-
}
148-
}
149125
return true;
150126
}
151127
}

0 commit comments

Comments
 (0)