Merge branch 'development' into 1.8
Conflicts: src/main/java/mekanism/generators/client/gui/GuiWindTurbine.java src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java src/main/java/mekanism/generators/common/MekanismGenerators.java src/main/java/mekanism/generators/common/tile/TileEntityHeatGenerator.java src/main/java/mekanism/generators/common/tile/TileEntityWindTurbine.java
This commit is contained in:
commit
69874de9d2
|
@ -71,8 +71,15 @@ public class MekanismConfig
|
|||
public static double advancedSolarGeneration;
|
||||
public static double bioGeneration;
|
||||
public static double heatGeneration;
|
||||
public static double heatGenerationLava;
|
||||
public static double heatGenerationNether;
|
||||
public static double solarGeneration;
|
||||
public static double windGeneration;
|
||||
|
||||
public static double windGenerationMin;
|
||||
public static double windGenerationMax;
|
||||
|
||||
public static int windGenerationMinY;
|
||||
public static int windGenerationMaxY;
|
||||
}
|
||||
|
||||
public static class tools
|
||||
|
|
|
@ -738,7 +738,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
{
|
||||
TileEntityElectricChest electricChest = (TileEntityElectricChest)tileEntity;
|
||||
|
||||
if(!entityplayer.isSneaking())
|
||||
if(!(entityplayer.isSneaking() || world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)))
|
||||
{
|
||||
if(electricChest.canAccess())
|
||||
{
|
||||
|
|
|
@ -71,9 +71,19 @@ public class ContainerChemicalOxidizer extends Container
|
|||
|
||||
if(RecipeHandler.getItemToGasOutput(slotStack, false, Recipe.CHEMICAL_OXIDIZER.get()) != null)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 1, true))
|
||||
if(slotID != 0)
|
||||
{
|
||||
return null;
|
||||
if(!mergeItemStack(slotStack, 0, 1, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(ChargeUtils.canBeDischarged(slotStack))
|
||||
|
|
|
@ -102,6 +102,7 @@ public class PacketElectricChest implements IMessageHandler<ElectricChestMessage
|
|||
{
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
|
||||
tileEntity.locked = message.locked;
|
||||
player.worldObj.notifyBlocksOfNeighborChange(message.coord4D.xCoord, message.coord4D.yCoord, message.coord4D.zCoord, tileEntity.getBlockType());
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
|
|||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
{
|
||||
return side == 1 ? new int[] {0} : new int[] {1};
|
||||
return side <= 1 ? new int[] {0} : new int[] {1};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.generators.client.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
|
@ -29,6 +30,8 @@ public class GuiWindTurbine extends GuiMekanism
|
|||
{
|
||||
public TileEntityWindTurbine tileEntity;
|
||||
|
||||
private DecimalFormat powerFormat = new DecimalFormat("0.##");
|
||||
|
||||
public GuiWindTurbine(InventoryPlayer inventory, TileEntityWindTurbine tentity)
|
||||
{
|
||||
super(new ContainerWindTurbine(inventory, tentity));
|
||||
|
@ -40,7 +43,7 @@ public class GuiWindTurbine extends GuiMekanism
|
|||
public List<String> getInfo()
|
||||
{
|
||||
return ListUtils.asList(
|
||||
"Producing: " + MekanismUtils.getEnergyDisplay(tileEntity.isActive ? generators.windGeneration*tileEntity.getMultiplier() : 0) + "/t",
|
||||
"Producing: " + MekanismUtils.getEnergyDisplay(tileEntity.isActive ? generators.windGenerationMin*tileEntity.getMultiplier() : 0) + "/t",
|
||||
"Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()),
|
||||
"Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t");
|
||||
}
|
||||
|
@ -57,7 +60,7 @@ public class GuiWindTurbine extends GuiMekanism
|
|||
fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.power") + ": " + generators.windGeneration*tileEntity.getMultiplier(), 51, 35, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.power") + ": " + powerFormat.format(generators.windGenerationMin*tileEntity.getMultiplier()), 51, 35, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00);
|
||||
|
||||
int size = 44;
|
||||
|
|
|
@ -75,11 +75,40 @@ public class GeneratorsCommonProxy
|
|||
generators.advancedSolarGeneration = Mekanism.configuration.get("generation", "AdvancedSolarGeneration", 300D).getDouble(300D);
|
||||
generators.bioGeneration = Mekanism.configuration.get("generation", "BioGeneration", 350D).getDouble(350D);
|
||||
generators.heatGeneration = Mekanism.configuration.get("generation", "HeatGeneration", 150D).getDouble(150D);
|
||||
generators.heatGenerationLava = Mekanism.configuration.get("generation", "HeatGenerationLava", 5D).getDouble(5D);
|
||||
generators.heatGenerationNether = Mekanism.configuration.get("generation", "HeatGenerationNether", 100D).getDouble(100D);
|
||||
generators.solarGeneration = Mekanism.configuration.get("generation", "SolarGeneration", 50D).getDouble(50D);
|
||||
generators.windGeneration = Mekanism.configuration.get("generation", "WindGeneration", 60D).getDouble(60D);
|
||||
loadWindConfiguration();
|
||||
|
||||
if(Mekanism.configuration.hasChanged())
|
||||
{
|
||||
Mekanism.configuration.save();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadWindConfiguration()
|
||||
{
|
||||
if(Mekanism.configuration.hasKey("generation", "WindGeneration"))
|
||||
{
|
||||
//Migrate the old wind generation config
|
||||
final double legacyWindGeneration = Mekanism.configuration.get("generation", "WindGeneration", 60D).getDouble(60D);
|
||||
final double windGenerationMax = legacyWindGeneration * 8D;
|
||||
Mekanism.configuration.getCategory("generation").remove("WindGeneration");
|
||||
|
||||
generators.windGenerationMin = Mekanism.configuration.get("generation", "WindGenerationMin", legacyWindGeneration).getDouble(legacyWindGeneration);
|
||||
generators.windGenerationMax = Mekanism.configuration.get("generation", "WindGenerationMax", windGenerationMax).getDouble(windGenerationMax);
|
||||
}
|
||||
else {
|
||||
generators.windGenerationMin = Mekanism.configuration.get("generation", "WindGenerationMin", 60D).getDouble(60D);
|
||||
generators.windGenerationMax = Mekanism.configuration.get("generation", "WindGenerationMax", 480D).getDouble(480D);
|
||||
}
|
||||
|
||||
//Ensure max > min to avoid division by zero later
|
||||
final int minY = Mekanism.configuration.get("generation", "WindGenerationMinY", 24).getInt(24);
|
||||
final int maxY = Mekanism.configuration.get("generation", "WindGenerationMaxY", 255).getInt(255);
|
||||
|
||||
generators.windGenerationMinY = minY;
|
||||
generators.windGenerationMaxY = Math.max(minY + 1, maxY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -148,8 +148,13 @@ public class MekanismGenerators implements IModule
|
|||
dataStream.writeDouble(generators.advancedSolarGeneration);
|
||||
dataStream.writeDouble(generators.bioGeneration);
|
||||
dataStream.writeDouble(generators.heatGeneration);
|
||||
dataStream.writeDouble(generators.heatGenerationLava);
|
||||
dataStream.writeDouble(generators.heatGenerationNether);
|
||||
dataStream.writeDouble(generators.solarGeneration);
|
||||
dataStream.writeDouble(generators.windGeneration);
|
||||
dataStream.writeDouble(generators.windGenerationMin);
|
||||
dataStream.writeDouble(generators.windGenerationMax);
|
||||
dataStream.writeInt(generators.windGenerationMinY);
|
||||
dataStream.writeInt(generators.windGenerationMaxY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,8 +163,13 @@ public class MekanismGenerators implements IModule
|
|||
generators.advancedSolarGeneration = dataStream.readDouble();
|
||||
generators.bioGeneration = dataStream.readDouble();
|
||||
generators.heatGeneration = dataStream.readDouble();
|
||||
generators.heatGenerationLava = dataStream.readDouble();
|
||||
generators.heatGenerationNether = dataStream.readDouble();
|
||||
generators.solarGeneration = dataStream.readDouble();
|
||||
generators.windGeneration = dataStream.readDouble();
|
||||
generators.windGenerationMin = dataStream.readDouble();
|
||||
generators.windGenerationMax = dataStream.readDouble();
|
||||
generators.windGenerationMinY = dataStream.readInt();
|
||||
generators.windGenerationMaxY = dataStream.readInt();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -5,13 +5,12 @@ import io.netty.buffer.ByteBuf;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.MekanismConfig.generators;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.common.ISustainedData;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.FluidContainerUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import mekanism.common.util.PipeUtils;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -30,7 +29,7 @@ import cpw.mods.fml.common.Optional.Method;
|
|||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
public class TileEntityHeatGenerator extends TileEntityGenerator implements IFluidHandler, ILaserReceptor, ISustainedData
|
||||
public class TileEntityHeatGenerator extends TileEntityGenerator implements IFluidHandler, ISustainedData
|
||||
{
|
||||
/** The FluidTank for this generator. */
|
||||
public FluidTank lavaTank = new FluidTank(24000);
|
||||
|
@ -184,24 +183,26 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
|
|||
|
||||
public double getBoost()
|
||||
{
|
||||
int boost = 0;
|
||||
int lavaBoost = 0;
|
||||
double netherBoost = 0D;
|
||||
|
||||
if(isLava(xCoord+1, yCoord, zCoord))
|
||||
boost+=5;
|
||||
lavaBoost+=1;
|
||||
if(isLava(xCoord-1, yCoord, zCoord))
|
||||
boost+=5;
|
||||
lavaBoost+=1;
|
||||
if(isLava(xCoord, yCoord+1, zCoord))
|
||||
boost+=5;
|
||||
lavaBoost+=1;
|
||||
if(isLava(xCoord, yCoord-1, zCoord))
|
||||
boost+=5;
|
||||
lavaBoost+=1;
|
||||
if(isLava(xCoord, yCoord, zCoord+1))
|
||||
boost+=5;
|
||||
lavaBoost+=1;
|
||||
if(isLava(xCoord, yCoord, zCoord-1))
|
||||
boost+=5;
|
||||
if(worldObj.provider.dimensionId == -1)
|
||||
boost+=100;
|
||||
lavaBoost+=1;
|
||||
|
||||
return boost;
|
||||
if(worldObj.provider.dimensionId == -1)
|
||||
netherBoost = generators.heatGenerationNether;
|
||||
|
||||
return (generators.heatGenerationLava * lavaBoost) + netherBoost;
|
||||
}
|
||||
|
||||
private boolean isLava(int x, int y, int z)
|
||||
|
@ -324,7 +325,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
|
|||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return fluid == FluidRegistry.LAVA;
|
||||
return fluid == FluidRegistry.LAVA && from != ForgeDirection.getOrientation(facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -336,27 +337,14 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
|
|||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if(from == ForgeDirection.getOrientation(facing))
|
||||
{
|
||||
return PipeUtils.EMPTY;
|
||||
}
|
||||
|
||||
return new FluidTankInfo[] {lavaTank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(double energy, ForgeDirection side)
|
||||
{
|
||||
setEnergy(getEnergy()+energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLasersDig()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double energyToDig()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSustainedData(ItemStack itemStack)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,6 @@ import mekanism.common.IBoundingBlock;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
|
@ -19,7 +18,7 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
|
|||
|
||||
public TileEntityWindTurbine()
|
||||
{
|
||||
super("WindTurbine", 200000, (generators.windGeneration*8)*2);
|
||||
super("WindTurbine", 200000, (generators.windGenerationMax)*2);
|
||||
inventory = new ItemStack[1];
|
||||
}
|
||||
|
||||
|
@ -35,7 +34,7 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
|
|||
if(canOperate())
|
||||
{
|
||||
setActive(true);
|
||||
setEnergy(electricityStored + (generators.windGeneration*getMultiplier()));
|
||||
setEnergy(electricityStored + (generators.windGenerationMin*getMultiplier()));
|
||||
}
|
||||
else {
|
||||
setActive(false);
|
||||
|
@ -43,10 +42,27 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
|
|||
}
|
||||
}
|
||||
|
||||
/** 0 - 8 **/
|
||||
/** Determines the current output multiplier, taking sky visibility and height into account. **/
|
||||
public float getMultiplier()
|
||||
{
|
||||
return worldObj.canBlockSeeTheSky(xCoord, yCoord+4, zCoord) ? (((float)yCoord+4)/(float)256)*8 : 0;
|
||||
if(worldObj.canBlockSeeTheSky(xCoord, yCoord+4, zCoord))
|
||||
{
|
||||
final float minY = (float) generators.windGenerationMinY;
|
||||
final float maxY = (float) generators.windGenerationMaxY;
|
||||
final float minG = (float) generators.windGenerationMin;
|
||||
final float maxG = (float) generators.windGenerationMax;
|
||||
|
||||
final float slope = (maxG - minG) / (maxY - minY);
|
||||
final float intercept = minG - slope * minY;
|
||||
|
||||
final float clampedY = Math.min(maxY, Math.max(minY, (float)(yCoord+4)));
|
||||
final float toGen = slope * clampedY + intercept;
|
||||
|
||||
return toGen / minG;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue