Compare commits

...
4 Commits
Author SHA1 Message Date
Pilzinsel64 b5752a8338 Fix NullReferenceException at getCapacity->getBlockMetadata (#97)
* fix NullReferenceException on getBlockMetadata

* oh no-no, please be static, it's your present! :)
2023-02-10 22:23:59 +01:00
Pilzinsel64 29b0d711f7 Solar Panels: Use config for capacity RF (#94)
* make Solar Energy configurable

* spotlessApply

* calc capacity also for single solar panels

* getCapacity(,) sanity check 'panel' against null
2023-02-08 21:01:19 +01:00
Pilzinsel64 e41827fb69 fix Waila tooltip for Endergy Energy Conduits (#95) 2023-02-08 21:01:10 +01:00
D-Cysteine 628af062ba Fix for getTravelItemTravelSource (#96)
This bug does not currently have any gameplay effect, because the return value of this method is not used to determine teleport range. But we should fix it anyway.
2023-02-08 11:42:03 +01:00
4 changed files with 65 additions and 5 deletions

No files matched your search

@@ -288,6 +288,10 @@ public final class Config {
public static int maxPhotovoltaicAdvancedOutputRF = 40;
public static int maxPhotovoltaicVibrantOutputRF = 160;
public static int photovoltaicCellCapacityRF = 10000;
public static int photovoltaicAdvancedCellCapacityRF = 10000;
public static int photovoltaicVibrantCellCapacityRF = 10000;
public static int zombieGeneratorRfPerTick = 80;
public static int zombieGeneratorTicksPerBucketFuel = 12000;
@@ -808,6 +812,26 @@ public final class Config {
"Maximum output in RF/t of the Vibrant Photovoltaic Panels.")
.getInt(maxPhotovoltaicVibrantOutputRF);
photovoltaicCellCapacityRF = config.get(
sectionPower.name,
"photovoltaicCellCapacityRF",
photovoltaicCellCapacityRF,
"Maximum capacity in RF/t of the Photovoltaic Panels.").getInt(photovoltaicCellCapacityRF);
photovoltaicAdvancedCellCapacityRF = config
.get(
sectionPower.name,
"photovoltaicAdvancedCellCapacityRF",
photovoltaicAdvancedCellCapacityRF,
"Maximum capacity in RF/t of the Advanced Photovoltaic Panels.")
.getInt(photovoltaicAdvancedCellCapacityRF);
photovoltaicVibrantCellCapacityRF = config
.get(
sectionPower.name,
"photovoltaicVibrantCellCapacityRF",
photovoltaicVibrantCellCapacityRF,
"Maximum capacity in RF/t of the Vibrant Photovoltaic Panels.")
.getInt(photovoltaicVibrantCellCapacityRF);
useAlternateBinderRecipe = config
.get(
sectionRecipe.name,
@@ -10,6 +10,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.EnergyStorage;
import com.google.common.collect.Lists;
import crazypants.enderio.config.Config;
public class SolarPanelNetwork {
@@ -25,12 +26,13 @@ public class SolarPanelNetwork {
public SolarPanelNetwork() {
panels = Lists.newArrayList();
energy = new EnergyStorage(ENERGY_PER);
energy = new EnergyStorage(getCapacity());
}
SolarPanelNetwork(TileEntitySolarPanel initial) {
this();
panels.add(initial);
energy.setCapacity(getCapacity(initial, 1));
empty = false;
}
@@ -83,8 +85,42 @@ public class SolarPanelNetwork {
destroyNetwork();
}
private int getCapacity() {
int capacity = ENERGY_PER;
if (panels.size() > 0) {
TileEntitySolarPanel masterPanel = getMaster();
capacity = getCapacity(masterPanel, panels.size());
}
return capacity;
}
private static int getCapacity(TileEntitySolarPanel panel, int panelsCount) {
int capacity = ENERGY_PER;
if (panel != null && panel.hasWorldObj()) {
int meta = panel.getBlockMetadata();
switch (meta) {
case 0: // Default
capacity = Config.photovoltaicCellCapacityRF;
break;
case 1: // Advanced
capacity = Config.photovoltaicAdvancedCellCapacityRF;
break;
case 2: // Vibrant
capacity = Config.photovoltaicVibrantCellCapacityRF;
break;
}
}
capacity = capacity * panelsCount;
return capacity;
}
private void updateEnergy() {
energy.setCapacity(ENERGY_PER * panels.size());
energy.setCapacity(getCapacity());
energy.setMaxExtract(energy.getMaxEnergyStored());
}
@@ -554,8 +554,8 @@ public class TravelController {
return null;
}
ItemStack equipped = ep.getCurrentEquippedItem();
if (equipped.getItem() instanceof ItemTravelStaff) {
if (((ItemTravelStaff) equipped.getItem()).isActive(ep, equipped)) {
if (equipped.getItem() instanceof ItemTeleportStaff) {
if (((ItemTeleportStaff) equipped.getItem()).isActive(ep, equipped)) {
return TravelSource.TELEPORT_STAFF;
}
} else if (equipped.getItem() instanceof IItemOfTravel) {
@@ -301,7 +301,7 @@ public class WailaCompat implements IWailaDataProvider {
return;
}
if (itemStack.getItem() == EnderIO.itemPowerConduit) {
if (itemStack.getItem() == EnderIO.itemPowerConduit || itemStack.getItem() == EnderIO.itemPowerConduitEndergy) {
NBTTagCompound nbtRoot = _accessor.getNBTData();
if (nbtRoot.hasKey("storedEnergyRF")) {
int stored = nbtRoot.getInteger("storedEnergyRF");