|
1 | 1 | package makmods.levelstorage.logic; |
2 | 2 |
|
| 3 | +import makmods.levelstorage.LevelStorage; |
3 | 4 | import net.minecraft.tileentity.TileEntity; |
| 5 | +import net.minecraftforge.common.Configuration; |
4 | 6 | import net.minecraftforge.common.DimensionManager; |
5 | 7 |
|
6 | 8 | public class BlockLocation { |
@@ -55,33 +57,40 @@ public int getDistance(BlockLocation other) { |
55 | 57 |
|
56 | 58 | return xDistance + yDistance + zDistance; |
57 | 59 | } |
58 | | - |
| 60 | + |
59 | 61 | /** |
60 | 62 | * Gets energy discount for given energy and distance |
61 | | - * @param energy Energy |
62 | | - * @param distance Distance |
| 63 | + * |
| 64 | + * @param energy |
| 65 | + * Energy |
| 66 | + * @param distance |
| 67 | + * Distance |
63 | 68 | * @return energy discount |
64 | 69 | */ |
65 | 70 | public static int getEnergyDiscount(int energy, int distance) { |
66 | | - // Cross-Dimensional |
67 | | - if (distance == Integer.MAX_VALUE) |
68 | | - return (int)(energy * 0.25f); |
69 | | - // Distance < 1000 |
70 | | - if (distance < 1000) |
71 | | - return (int)(energy * 0.05f); |
72 | | - // Distance > 1000 <2000 |
73 | | - if (distance > 1000 && distance < 2000) |
74 | | - return (int)(energy * 0.1f); |
75 | | - // Distance > 2000 |
76 | | - if (distance > 2000) |
77 | | - return (int)(energy * 0.15f); |
78 | | - // IDK what happened here |
| 71 | + if (LevelStorage.configuration.get(Configuration.CATEGORY_GENERAL, |
| 72 | + "enableEnergyLoss", false).getBoolean(false)) { |
| 73 | + // Cross-Dimensional |
| 74 | + if (distance == Integer.MAX_VALUE) |
| 75 | + return (int) (energy * 0.25f); |
| 76 | + // Distance < 1000 |
| 77 | + if (distance < 1000) |
| 78 | + return (int) (energy * 0.05f); |
| 79 | + // Distance > 1000 <2000 |
| 80 | + if (distance > 1000 && distance < 2000) |
| 81 | + return (int) (energy * 0.1f); |
| 82 | + // Distance > 2000 |
| 83 | + if (distance > 2000) |
| 84 | + return (int) (energy * 0.15f); |
| 85 | + } |
79 | 86 | return 0; |
80 | 87 | } |
81 | | - |
| 88 | + |
82 | 89 | /** |
83 | 90 | * Returns whether or not DimensionId is valid |
84 | | - * @param dimId Dimension id |
| 91 | + * |
| 92 | + * @param dimId |
| 93 | + * Dimension id |
85 | 94 | */ |
86 | 95 | public static boolean isDimIdValid(int dimId) { |
87 | 96 | Integer[] ids = DimensionManager.getIDs(); |
|
0 commit comments