mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-24 22:14:42 +00:00
Adjusted powered spawner power IO to account for new mob specific multiplier.
This commit is contained in:
1 parent
ceb2434a17
commit
96679f3099
3 files changed
+28
-15
No files matched your search
@@ -31,7 +31,7 @@ public class PoweredSpawnerConfig {
|
||||
private final Map<String, Double> costs = new HashMap<String, Double>();
|
||||
|
||||
private final List<String> blackList = new ArrayList<String>();
|
||||
|
||||
|
||||
public double getCostMultiplierFor(String entity) {
|
||||
Double val = costs.get(entity);
|
||||
if(val == null) {
|
||||
@@ -78,7 +78,7 @@ public class PoweredSpawnerConfig {
|
||||
Log.error("Could not load Powered Spawner costs from " + IoUtil.getConfigFile(CORE_FILE_NAME).getAbsolutePath());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
//User
|
||||
configText = IoUtil.copyConfigFromJar(USER_FILE_NAME, false);
|
||||
@@ -86,7 +86,8 @@ public class PoweredSpawnerConfig {
|
||||
rootObj = root.getAsJsonObject();
|
||||
costsObj = rootObj.getAsJsonObject("costMultiplier");
|
||||
for (Entry<String, JsonElement> entry : costsObj.entrySet()) {
|
||||
costs.put(entry.getKey(), Double.valueOf(entry.getValue().getAsDouble()));
|
||||
double val = Double.valueOf(entry.getValue().getAsDouble());
|
||||
costs.put(entry.getKey(), val);
|
||||
}
|
||||
|
||||
blkList = rootObj.getAsJsonArray("blackList");
|
||||
@@ -103,7 +104,7 @@ public class PoweredSpawnerConfig {
|
||||
Log.error("Could not load user defined Powered Spawner costs from " + IoUtil.getConfigFile(USER_FILE_NAME).getAbsolutePath());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,21 +64,24 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
|
||||
@Override
|
||||
public void setCapacitor(Capacitors capacitorType) {
|
||||
this.capacitorType = capacitorType;
|
||||
this.capacitorType = capacitorType;
|
||||
ICapacitor refCap;
|
||||
switch (capacitorType) {
|
||||
case BASIC_CAPACITOR:
|
||||
capacitor = CAP_ONE;
|
||||
refCap = CAP_ONE;
|
||||
break;
|
||||
case ACTIVATED_CAPACITOR:
|
||||
capacitor = CAP_TWO;
|
||||
refCap = CAP_TWO;
|
||||
break;
|
||||
case ENDER_CAPACITOR:
|
||||
capacitor = CAP_THREE;
|
||||
refCap = CAP_THREE;
|
||||
break;
|
||||
default:
|
||||
capacitor = CAP_ONE;
|
||||
refCap = CAP_ONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
double multuplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(logic.getEntityNameToSpawn());
|
||||
capacitor = new BasicCapacitor((int)(refCap.getMaxEnergyExtracted() * multuplier), refCap.getMaxEnergyStored());
|
||||
forceClientUpdate = true;
|
||||
}
|
||||
|
||||
@@ -133,36 +136,38 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.readCustomNBT(nbtRoot);
|
||||
logic.readFromNBT(nbtRoot);
|
||||
super.readCustomNBT(nbtRoot);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeCustomNBT(nbtRoot);
|
||||
logic.writeToNBT(nbtRoot);
|
||||
super.writeCustomNBT(nbtRoot);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCommon(NBTTagCompound nbtRoot) {
|
||||
super.readCommon(nbtRoot);
|
||||
//Must read the mob type first so we no the multiplier to be used when calculating input/output power
|
||||
String mobType = BlockPoweredSpawner.readMobTypeFromNBT(nbtRoot);
|
||||
if(mobType == null) {
|
||||
mobType = NULL_ENTITY_NAME;
|
||||
}
|
||||
logic.setEntityName(mobType);
|
||||
super.readCommon(nbtRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCommon(NBTTagCompound nbtRoot) {
|
||||
super.writeCommon(nbtRoot);
|
||||
public void writeCommon(NBTTagCompound nbtRoot) {
|
||||
String mobType = logic.getEntityNameToSpawn();
|
||||
if(mobType == null || mobType.equals(NULL_ENTITY_NAME)) {
|
||||
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, null);
|
||||
} else {
|
||||
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, mobType);
|
||||
}
|
||||
super.writeCommon(nbtRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.enderio.machine.xp;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -69,4 +70,10 @@ public class BlockExperianceObelisk extends BlockEio implements IResourceTooltip
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iIconRegister) {
|
||||
//Not actualy used, but give it something so it doesn't print an error
|
||||
blockIcon = iIconRegister.registerIcon("enderio:blockAttractorSide");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user