Fix solar upgrade generating power when dark, add decaying generation

This commit is contained in:
tterrag1098 committed 2014-12-06 23:40:50 -05:00
1 parent ee7067016d
commit 7120725d84
3 files changed
+14 -10

No files matched your search

@@ -44,6 +44,8 @@ public class BlockDarkSteelLadder extends BlockLadder implements IResourceToolti
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if(entity.motionY >= 0.1) {
entity.setPosition(entity.posX, entity.posY + Config.darkSteelLadderSpeedBoost, entity.posZ);
} else if (entity.motionY <= 0.1) {
entity.setPosition(entity.posX, entity.posY - Config.darkSteelLadderSpeedBoost, entity.posZ);
}
}
@@ -1,8 +1,6 @@
package crazypants.enderio.item.darksteel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -25,8 +23,8 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.solar.TileEntitySolarPanel;
import crazypants.enderio.network.PacketHandler;
import crazypants.util.BlockCoord;
import crazypants.util.Util;
import crazypants.vecmath.VecmathUtil;
import crazypants.vecmath.Vector3d;
@@ -134,8 +132,8 @@ public class DarkSteelController {
}
private void updateSolar(EntityPlayer player) {
// no processing on client or if the player isn't under the sun
if (player.worldObj.isRemote || !player.worldObj.canBlockSeeTheSky(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY + 1), MathHelper.floor_double(player.posZ))) {
// no processing on client
if (player.worldObj.isRemote) {
return;
}
@@ -145,7 +143,8 @@ public class DarkSteelController {
return;
}
int RFperSecond = upgrade.getRFPerSec();
int RFperSecond = Math.round((float) upgrade.getRFPerSec() * TileEntitySolarPanel.calculateLightRatio(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY + 1), MathHelper.floor_double(player.posZ)));
int leftover = RFperSecond % 20;
boolean addExtraRF = player.worldObj.getTotalWorldTime() % 20 < leftover;
@@ -11,10 +11,9 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.PacketPowerStorage;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.power.BasicCapacitor;
import crazypants.enderio.power.IInternalPowerReceptor;
import crazypants.enderio.power.IPowerInterface;
@@ -135,8 +134,12 @@ public class TileEntitySolarPanel extends TileEntity implements IInternalPowerRe
}
float calculateLightRatio() {
int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted;
float sunAngle = worldObj.getCelestialAngleRadians(1.0F);
return calculateLightRatio(worldObj, xCoord, yCoord, zCoord);
}
public static float calculateLightRatio(World world, int x, int y, int z) {
int lightValue = world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) - world.skylightSubtracted;
float sunAngle = world.getCelestialAngleRadians(1.0F);
if(sunAngle < (float) Math.PI) {
sunAngle += (0.0F - sunAngle) * 0.2F;