diff options
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r-- | src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java index 29b32b5d3b..8bb0ed87aa 100644 --- a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java +++ b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java @@ -7,12 +7,12 @@ import java.util.UUID; import net.minecraft.entity.player.EntityPlayer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.common.misc.GlobalEnergyWorldSavedData; // If you are adding very late-game content feel free to tap into this interface. // The eventual goal is to bypass laser/dynamo stuff and have energy deposited directly from ultra-endgame // multi-blocks directly into the users network. -@SuppressWarnings("unused") public interface IGlobalWirelessEnergy { // User 0 will join user 1 by calling this function. They will share the same energy network. @@ -57,7 +57,7 @@ public interface IGlobalWirelessEnergy { // If the value goes below 0 it will return false and not perform the operation. // BigIntegers have much slower operations than longs/ints. You should call these methods // as infrequently as possible and bulk store values to add to the global map. - default boolean addEUToGlobalEnergyMap(String user_uuid, BigInteger EU) { + default boolean addEUToGlobalEnergyMap(String userUUID, BigInteger EU) { // Mark the data as dirty and in need of saving. try { @@ -68,15 +68,15 @@ public interface IGlobalWirelessEnergy { } // Get the team UUID. Users are by default in a team with a UUID equal to their player UUID. - String team_uuid = GlobalEnergyTeam.getOrDefault(user_uuid, user_uuid); + String teamUUID = GlobalEnergyTeam.getOrDefault(userUUID, userUUID); // Get the teams total energy stored. If they are not in the map, return 0 EU. - BigInteger total_eu = GlobalEnergy.getOrDefault(team_uuid, BigInteger.ZERO); - total_eu = total_eu.add(EU); + BigInteger totalEU = GlobalEnergy.getOrDefault(teamUUID, BigInteger.ZERO); + totalEU = totalEU.add(EU); // If there is sufficient EU then complete the operation and return true. - if (total_eu.signum() >= 0) { - GlobalEnergy.put(team_uuid, total_eu); + if (totalEU.signum() >= 0) { + GlobalEnergy.put(teamUUID, totalEU); return true; } @@ -137,4 +137,14 @@ public interface IGlobalWirelessEnergy { GlobalEnergyName.clear(); GlobalEnergyTeam.clear(); } + + default String processInitialSettings(final IGregTechTileEntity machine) { + + // UUID and username of the owner. + final String UUID = machine.getOwnerUuid().toString(); + final String name = machine.getOwnerName(); + + strongCheckOrAddUser(UUID, name); + return UUID; + } } |