Move insert/extract usage of wireless grid to method for API consumers

This commit is contained in:
raoulvdberge
2017-07-17 12:06:25 +02:00
parent ec59d9afe4
commit f1c7a92189
2 changed files with 11 additions and 3 deletions

View File

@@ -95,7 +95,7 @@ public class ItemGridHandler implements IItemGridHandler {
INetworkItem networkItem = network.getNetworkItemHandler().getItem(player);
if (networkItem != null && networkItem instanceof NetworkItemWirelessGrid) {
((NetworkItemWirelessGrid) networkItem).drainEnergy(RS.INSTANCE.config.wirelessGridExtractUsage);
((NetworkItemWirelessGrid) networkItem).drainEnergy(((NetworkItemWirelessGrid) networkItem).getExtractUsage());
}
}
}
@@ -111,7 +111,7 @@ public class ItemGridHandler implements IItemGridHandler {
INetworkItem networkItem = network.getNetworkItemHandler().getItem(player);
if (networkItem != null && networkItem instanceof NetworkItemWirelessGrid) {
((NetworkItemWirelessGrid) networkItem).drainEnergy(RS.INSTANCE.config.wirelessGridInsertUsage);
((NetworkItemWirelessGrid) networkItem).drainEnergy(((NetworkItemWirelessGrid) networkItem).getInsertUsage());
}
return remainder;
@@ -145,7 +145,7 @@ public class ItemGridHandler implements IItemGridHandler {
INetworkItem networkItem = network.getNetworkItemHandler().getItem(player);
if (networkItem != null && networkItem instanceof NetworkItemWirelessGrid) {
((NetworkItemWirelessGrid) networkItem).drainEnergy(RS.INSTANCE.config.wirelessGridInsertUsage);
((NetworkItemWirelessGrid) networkItem).drainEnergy(((NetworkItemWirelessGrid) networkItem).getInsertUsage());
}
}

View File

@@ -67,4 +67,12 @@ public class NetworkItemWirelessGrid implements INetworkItem {
}
}
}
public int getInsertUsage() {
return RS.INSTANCE.config.wirelessGridInsertUsage;
}
public int getExtractUsage() {
return RS.INSTANCE.config.wirelessGridExtractUsage;
}
}