TheBrokenRail
6d51dee9c7
All checks were successful
EnergonRelics/pipeline/head This commit looks good
36 lines
1022 B
Java
36 lines
1022 B
Java
package com.thebrokenrail.energonrelics.structure.researchcomplex;
|
|
|
|
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
|
import net.minecraft.server.world.ServerWorld;
|
|
import net.minecraft.util.BlockRotation;
|
|
import net.minecraft.world.World;
|
|
|
|
public class ResearchComplexState {
|
|
private final int baseID;
|
|
private long energyBudget = HardcodedConfig.REACTOR_ENERGY_OUTPUT;
|
|
|
|
public ResearchComplexState(World world) {
|
|
ServerWorld serverWorld = (ServerWorld) world;
|
|
NetworkComponent component = NetworkComponent.getInstance(serverWorld);
|
|
baseID = component.create();
|
|
}
|
|
|
|
private int getID(int id) {
|
|
return baseID + id;
|
|
}
|
|
|
|
int getMainNetwork() {
|
|
return getID(0);
|
|
}
|
|
|
|
boolean hasEnergy(long amount) {
|
|
if (amount <= energyBudget) {
|
|
energyBudget = energyBudget - amount;
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|