Added initial TechReborn compatibility to the EnergyAcceptor.
This commit is contained in:
@@ -103,8 +103,8 @@ public class SettingToggleButton<T extends Enum<T>> extends IconButton {
|
||||
PowerUnits.AE.textComponent());
|
||||
registerApp(16 * 10 + 1, Settings.POWER_UNITS, PowerUnits.EU, ButtonToolTips.PowerUnits,
|
||||
PowerUnits.EU.textComponent());
|
||||
registerApp(16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits,
|
||||
PowerUnits.RF.textComponent());
|
||||
registerApp(16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.TR, ButtonToolTips.PowerUnits,
|
||||
PowerUnits.TR.textComponent());
|
||||
|
||||
registerApp(3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode,
|
||||
ButtonToolTips.AlwaysActive);
|
||||
|
||||
@@ -18,22 +18,6 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.DoubleSupplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
@@ -52,6 +36,21 @@ import appeng.core.config.IntegerOption;
|
||||
import appeng.core.config.StringListOption;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.util.EnumCycler;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.DoubleSupplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class AEConfig {
|
||||
|
||||
@@ -87,7 +86,7 @@ public final class AEConfig {
|
||||
|
||||
// Default Energy Conversion Rates
|
||||
private static final double DEFAULT_IC2_EXCHANGE = 2.0;
|
||||
private static final double DEFAULT_RF_EXCHANGE = 0.5;
|
||||
private static final double DEFAULT_TR_EXCHANGE = 2.0;
|
||||
|
||||
public static final String VERSION = "@version@";
|
||||
public static final String CHANNEL = "@aechannel@";
|
||||
@@ -112,7 +111,6 @@ public final class AEConfig {
|
||||
private boolean useColoredCraftingStatus;
|
||||
private boolean disableColoredCableRecipesInJEI;
|
||||
private int craftingCalculationTimePerTick;
|
||||
private PowerUnits selectedPowerUnit = PowerUnits.AE;
|
||||
|
||||
// GUI Buttons
|
||||
private final int[] craftByStacks = new int[4];
|
||||
@@ -157,9 +155,7 @@ public final class AEConfig {
|
||||
this.enableEffects = clientConfig.enableEffects.get();
|
||||
this.useLargeFonts = clientConfig.useLargeFonts.get();
|
||||
this.useColoredCraftingStatus = clientConfig.useColoredCraftingStatus.get();
|
||||
this.selectedPowerUnit = clientConfig.selectedPowerUnit.get();
|
||||
|
||||
// load buttons..
|
||||
for (int btnNum = 0; btnNum < 4; btnNum++) {
|
||||
this.craftByStacks[btnNum] = clientConfig.craftByStacks.get(btnNum).get();
|
||||
this.priorityByStacks[btnNum] = clientConfig.priorityByStacks.get(btnNum).get();
|
||||
@@ -169,7 +165,7 @@ public final class AEConfig {
|
||||
|
||||
private void syncCommonConfig() {
|
||||
PowerUnits.EU.conversionRatio = commonConfig.powerRatioIc2.get();
|
||||
PowerUnits.RF.conversionRatio = commonConfig.powerRatioForgeEnergy.get();
|
||||
PowerUnits.TR.conversionRatio = commonConfig.powerRatioTechReborn.get();
|
||||
PowerMultiplier.CONFIG.multiplier = commonConfig.powerUsageMultiplier.get();
|
||||
|
||||
CondenserOutput.MATTER_BALLS.requiredPower = commonConfig.condenserMatterBallsPower.get();
|
||||
@@ -271,7 +267,6 @@ public final class AEConfig {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
clientConfig.selectedPowerUnit.set(this.selectedPowerUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,7 +294,7 @@ public final class AEConfig {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void nextPowerUnit(final boolean backwards) {
|
||||
PowerUnits selectedPowerUnit = EnumCycler.rotateEnum(this.selectedPowerUnit, backwards,
|
||||
PowerUnits selectedPowerUnit = EnumCycler.rotateEnum(getSelectedPowerUnit(), backwards,
|
||||
(EnumSet<PowerUnits>) Settings.POWER_UNITS.getPossibleValues());
|
||||
clientConfig.selectedPowerUnit.set(selectedPowerUnit);
|
||||
}
|
||||
@@ -373,6 +368,10 @@ public final class AEConfig {
|
||||
return () -> this.chargedStaffBattery;
|
||||
}
|
||||
|
||||
public double getPowerTransactionLimitTechReborn() {
|
||||
return commonConfig.powerTransactionLimitTechReborn.get();
|
||||
}
|
||||
|
||||
public float getSpawnChargedChance() {
|
||||
return (float) commonConfig.spawnChargedChance.get();
|
||||
}
|
||||
@@ -494,9 +493,12 @@ public final class AEConfig {
|
||||
|
||||
// Power Ratios
|
||||
public final DoubleOption powerRatioIc2;
|
||||
public final DoubleOption powerRatioForgeEnergy;
|
||||
public final DoubleOption powerRatioTechReborn;
|
||||
public final DoubleOption powerUsageMultiplier;
|
||||
|
||||
// How much TR energy can be transfered at most in one operation
|
||||
public final DoubleOption powerTransactionLimitTechReborn;
|
||||
|
||||
// Condenser Power Requirement
|
||||
public final IntegerOption condenserMatterBallsPower;
|
||||
public final IntegerOption condenserSingularityPower;
|
||||
@@ -578,9 +580,13 @@ public final class AEConfig {
|
||||
|
||||
ConfigSection PowerRatios = root.subsection("PowerRatios");
|
||||
powerRatioIc2 = PowerRatios.addDouble("IC2", DEFAULT_IC2_EXCHANGE);
|
||||
powerRatioForgeEnergy = PowerRatios.addDouble("ForgeEnergy", DEFAULT_RF_EXCHANGE);
|
||||
powerRatioTechReborn = PowerRatios.addDouble("TechReborn", DEFAULT_TR_EXCHANGE);
|
||||
powerUsageMultiplier = PowerRatios.addDouble("UsageMultiplier", 1.0, 0.01, Double.MAX_VALUE);
|
||||
|
||||
ConfigSection integration = root.subsection("Integration");
|
||||
powerTransactionLimitTechReborn = integration.addDouble("MaxTechRebornEnergyPerTransaction", 10000.0, 0.1, 1000000.0,
|
||||
"The maximum amount of TechReborn energy units that can be transfered per operation.");
|
||||
|
||||
ConfigSection Condenser = root.subsection("Condenser");
|
||||
condenserMatterBallsPower = Condenser.addInt("MatterBalls", 256);
|
||||
condenserSingularityPower = Condenser.addInt("Singularity", 256000);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class FluidP2PTunnelPart extends P2PTunnelPart<FluidP2PTunnelPart> {
|
||||
}
|
||||
|
||||
if (simulation.isAction()) {
|
||||
FluidP2PTunnelPart.this.queueTunnelDrain(PowerUnits.RF,
|
||||
FluidP2PTunnelPart.this.queueTunnelDrain(PowerUnits.TR,
|
||||
amount.sub(overflowAmount).asInexactDouble() * 1000);
|
||||
}
|
||||
} catch (GridAccessException ignored) {
|
||||
|
||||
@@ -18,31 +18,29 @@
|
||||
|
||||
package appeng.tile.powersink;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.AttributeProvider;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.tile.AEBaseInvBlockEntity;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyStorage;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AEBasePoweredBlockEntity extends AEBaseInvBlockEntity
|
||||
implements IAEPowerStorage, IExternalPowerSink, AttributeProvider {
|
||||
implements IAEPowerStorage, IExternalPowerSink, EnergyStorage {
|
||||
|
||||
// values that determine general function, are set by inheriting classes if
|
||||
// needed. These should generally remain static.
|
||||
@@ -230,10 +228,37 @@ public abstract class AEBasePoweredBlockEntity extends AEBaseInvBlockEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAllAttributes(World world, BlockPos pos, BlockState state, AttributeList<?> to) {
|
||||
super.addAllAttributes(world, pos, state, to);
|
||||
public double getMaxInput(EnergySide side) {
|
||||
double attemptedInsert = AEConfig.instance().getPowerTransactionLimitTechReborn();
|
||||
double overflow = this.injectExternalPower(PowerUnits.TR, attemptedInsert, Actionable.SIMULATE);
|
||||
double couldInsert = attemptedInsert - overflow;
|
||||
if (couldInsert < 0.001) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FIXME FABRIC: Offer energy attributes
|
||||
return PowerUnits.AE.convertTo(PowerUnits.TR, couldInsert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStored(EnergySide energySide) {
|
||||
// This block acts as if it cannot actually store any energy
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStored(double v) {
|
||||
v = MathHelper.clamp(v, 0.001, getMaxStoredPower());
|
||||
this.injectExternalPower(PowerUnits.TR, v, Actionable.MODULATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxStoredPower() {
|
||||
return AEConfig.instance().getPowerTransactionLimitTechReborn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.INFINITE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class Platform {
|
||||
p = PowerUnits.AE.convertTo(displayUnits, p);
|
||||
|
||||
final String[] preFixes = { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" };
|
||||
String unitName = displayUnits.name();
|
||||
String unitName = displayUnits.getSymbolName();
|
||||
|
||||
String level = "";
|
||||
int offset = 0;
|
||||
|
||||
Reference in New Issue
Block a user