Some tweaks.

This commit is contained in:
cp committed 2014-04-01 11:17:23 +08:00
1 parent af99ab4755
commit 125a285ca0
7 files changed
+109 -54

No files matched your search

+8 -3
View File
@@ -107,11 +107,12 @@ public final class Config {
public static float darkSteelPickEffeciencyBoostWhenPowered = 2;
public static int hootchPowerPerCycle = 6;
public static int hootchPowerTotalBurnTime = 12000;
public static int hootchPowerTotalBurnTime = 8000;
public static int rocketFuelPowerPerCycle = 9;
public static int rocketFuelPowerTotalBurnTime = 12000;
public static int rocketFuelPowerTotalBurnTime = (int)Math.round(hootchPowerTotalBurnTime * 1.2);
public static int fireWaterPowerPerCycle = 12;
public static int fireWaterPowerTotalBurnTime = 12000;
public static int fireWaterPowerTotalBurnTime = (int)Math.round(hootchPowerTotalBurnTime * 1.5);
public static float vatPowerUserPerTick = 2;
public static void load(FMLPreInitializationEvent event) {
configDirectory = new File(event.getModConfigurationDirectory(), "enderio");
@@ -182,6 +183,10 @@ public final class Config {
transceiverBucketTransmissionCost = config.get("Settings", "transceiverBucketTransmissionCost", transceiverBucketTransmissionCost,
"The cost in MJ of trasporting a bucket of fluid via a Dimensional Transceiver.").getDouble(transceiverBucketTransmissionCost);
vatPowerUserPerTick = (float)config.get("Settings", "vatPowerUserPerTick", vatPowerUserPerTick,
"Power use (MJ/t) used by the vat.").getDouble(vatPowerUserPerTick);
detailedPowerTrackingEnabled = config
.get(
"Settings",
@@ -1,5 +1,7 @@
package crazypants.enderio.machine.generator;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -14,14 +16,15 @@ import net.minecraftforge.fluids.FluidStack;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineBlock;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.util.Util;
public class BlockCombustionGenerator extends AbstractMachineBlock<TileCombustionGenerator> {
public static int renderId;
protected IIcon frontOn;
protected IIcon frontOff;
// protected IIcon frontOn;
// protected IIcon frontOff;
public static BlockCombustionGenerator create() {
BlockCombustionGenerator gen = new BlockCombustionGenerator();
@@ -36,8 +39,8 @@ public class BlockCombustionGenerator extends AbstractMachineBlock<TileCombustio
@Override
public void registerBlockIcons(IIconRegister iIconRegister) {
super.registerBlockIcons(iIconRegister);
frontOn = iIconRegister.registerIcon("enderio:combustionGenFrontOn");
frontOff = iIconRegister.registerIcon("enderio:combustionGenFront");
// frontOn = iIconRegister.registerIcon("enderio:combustionGenFrontOn");
// frontOff = iIconRegister.registerIcon("enderio:combustionGenFront");
}
@Override
@@ -108,17 +111,17 @@ public class BlockCombustionGenerator extends AbstractMachineBlock<TileCombustio
return false;
}
public IIcon getBlankSideIcon() {
return iconBuffer[0][3];
public IIcon getBackIcon() {
return iconBuffer[0][2];
}
public IIcon getFrontOn() {
return frontOn;
}
public IIcon getFrontOff() {
return frontOff;
}
// public IIcon getFrontOn() {
// return frontOn;
// }
//
// public IIcon getFrontOff() {
// return frontOff;
// }
@Override
public String getTopIconKey(boolean active) {
@@ -126,14 +129,43 @@ public class BlockCombustionGenerator extends AbstractMachineBlock<TileCombustio
}
@Override
public String getBackIconKey(boolean active) {
return getMachineFrontIconKey(active);
public String getMachineFrontIconKey(boolean active) {
if(active) {
return "enderio:combustionGenFrontOn";
}
return "enderio:combustionGenFront";
}
@Override
public String getMachineFrontIconKey(boolean active) {
public String getBackIconKey(boolean active) {
return "enderio:blankMachinePanel";
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
// If active, randomly throw some smoke around
if(isActive(world, x, y, z)) {
TileEntity te = world.getTileEntity(x, y, z);
int facing = 3;
if(te instanceof AbstractMachineEntity) {
AbstractMachineEntity me = (AbstractMachineEntity) te;
facing = me.facing;
}
ForgeDirection dir = ForgeDirection.getOrientation(facing);
int xmod = Math.abs(dir.offsetX);
int zmod = Math.abs(dir.offsetY);
float startX = x + (1.0F * zmod) + (0.5f * xmod);
float startY = y + 0.5F;
float startZ = z + (1.0F * xmod) + (0.5f * zmod);
for (int i = 0; i < 4; i++) {
float xOffset = (-0.2F - rand.nextFloat() * 0.6F);
float yOffset = -0.1F + rand.nextFloat() * 0.2F;
float zOffset = (-0.2F - rand.nextFloat() * 0.6F);
world.spawnParticle("smoke", startX + xOffset, startY + yOffset, startZ + zOffset, 0.0D, 0.0D, 0.0D);
}
}
}
}
@@ -48,17 +48,18 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
textures[1] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.SOUTH.ordinal());
textures[2] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.UP.ordinal());
textures[3] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.DOWN.ordinal());
textures[4] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.WEST.ordinal());
textures[5] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.EAST.ordinal());
textures[4] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.EAST.ordinal());
textures[5] = EnderIO.blockCombustionGenerator.getIcon(world, x, y, z, ForgeDirection.WEST.ordinal());
} else {
textures[0] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.NORTH.ordinal(), 0);
textures[1] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.SOUTH.ordinal(), 0);
textures[2] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.UP.ordinal(), 0);
textures[3] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.DOWN.ordinal(), 0);
textures[4] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.WEST.ordinal(), 0);
textures[5] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.EAST.ordinal(), 0);
textures[4] = EnderIO.blockCombustionGenerator.getIcon(ForgeDirection.WEST.ordinal(), 0);
}
float b = 1;
if(world instanceof World) {
b = RenderUtil.claculateTotalBrightnessForLocation((World) world, x, y, z);
@@ -70,12 +71,31 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
cols[i] = b * m;
}
//middle chunk
BoundingBox bb = BoundingBox.UNIT_CUBE;
bb = BoundingBox.UNIT_CUBE;
bb = bb.scale(1, 0.34, 1);
xform.set(x, y, z, facing);
CubeRenderer.render(bb, textures, xform, cols);
boolean scaleX = facing != 4 && facing != 5;
float scx = scaleX ? 0.7f : 1;
float scz = scaleX ? 1 : 0.7f;
//change the front texture to blank for the top and bottom sections
if(scaleX) {
textures[0] = EnderIO.blockCombustionGenerator.getBackIcon();
textures[1] = EnderIO.blockCombustionGenerator.getBackIcon();
} else {
textures[4] = EnderIO.blockCombustionGenerator.getBackIcon();
textures[5] = EnderIO.blockCombustionGenerator.getBackIcon();
}
//top 1/3
BoundingBox bb = BoundingBox.UNIT_CUBE;
bb = BoundingBox.UNIT_CUBE;
bb = bb.scale(scx, 0.25, scz);
bb = bb.translate(0, 0.29f, 0);
xform.set(x, y, z, facing);
@@ -89,29 +109,11 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
CubeRenderer.render(bb, textures, xform, cols);
IIcon tex = active ? EnderIO.blockCombustionGenerator.getFrontOn() : EnderIO.blockCombustionGenerator.getFrontOff();
//middle chunk
if(scaleX) {
textures[0] = tex;
textures[1] = tex;
} else {
textures[4] = tex;
textures[5] = tex;
}
bb = BoundingBox.UNIT_CUBE;
bb = bb.scale(1, 0.34, 1);
xform.set(x, y, z, facing);
CubeRenderer.render(bb, textures, xform, cols);
//top / bottom connectors
bb = BoundingBox.UNIT_CUBE.scale(0.35,1,0.35);
bb = bb.translate(x, y, z);
CubeRenderer.render(bb, textures[2], null, cols, false);
//tanks
float size = 0.34f;
bb = BoundingBox.UNIT_CUBE.scale(0.98, 0.98, 0.98);
@@ -124,7 +126,7 @@ public class CombustionGeneratorRenderer extends TileEntitySpecialRenderer imple
float tz = scaleX ? 0 : 0.25f * 1.25f;
bb = bb.translate(x + tx, y, z + tz);
tex = EnderIO.blockFusedQuartz.getDefaultFrameIcon(0);
IIcon tex = EnderIO.blockFusedQuartz.getDefaultFrameIcon(0);
CubeRenderer.render(bb, tex, null, cols, false);
bb = bb.translate(-tx * 2, 0, -tz * 2);
@@ -4,7 +4,6 @@ import java.awt.Color;
import java.awt.Rectangle;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.entity.RenderMooshroom;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -26,7 +25,7 @@ public class GuiCombustionGenerator extends GuiMachineBase {
public GuiCombustionGenerator(InventoryPlayer par1InventoryPlayer, TileCombustionGenerator te) {
super(te, new EmptyContainer());
this.gen = te;
addToolTip(new GuiToolTip(new Rectangle(48, 21, 15, 47), "") {
@Override
@@ -96,15 +95,15 @@ public class GuiCombustionGenerator extends GuiMachineBase {
//draw some gui over the top again to make the center shape
RenderUtil.bindTexture("enderio:textures/gui/combustionGen.png");
drawTexturedModalRect(x, y + 14, 0, 223, 33, 33);
y += 7;
}
if(gen.fuelTank.getFluidAmount() > 0) {
//right tank
x = guiLeft + 114;
y += 7;
RenderUtil.renderGuiTank(gen.fuelTank.getFluid(), 4000, gen.fuelTank.getFluidAmount() - 1000, x, y, zLevel, 15, 47);
if(gen.isActive()) {
txt = gen.getNumTicksPerMbFuel() + " t/MB";
sw = fr.getStringWidth(txt);
@@ -33,6 +33,8 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
private PowerDistributor powerDis;
private float transmitted;
private boolean inPause = false;
public TileCombustionGenerator() {
super(new SlotDefinition(-1, -1, -1, -1, -1, -1));
powerHandler.configure(0, 0, 0, capacitorType.capacitor.getMaxEnergyStored());
@@ -125,6 +127,10 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
transmitEnergy();
if(storedEnergy >= capacitorType.capacitor.getMaxEnergyStored()) {
inPause = true;
}
return res;
}
@@ -152,9 +158,17 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
return false;
}
if(coolantTank.getFluidAmount() <= 0 || storedEnergy >= powerHandler.getMaxEnergyStored() - fuel.powerPerCycle) {
if(coolantTank.getFluidAmount() <= 0 || storedEnergy >= powerHandler.getMaxEnergyStored()) {
return false;
}
//once full, don't start again until we have drained 2 seconds worth of power to prevent
//flickering on and off constantly when powering a machine that draws less than this produces
if(inPause && storedEnergy >= (powerHandler.getMaxEnergyStored() - fuel.powerPerCycle) * 40) {
return false;
}
inPause = false;
Coolant coolant = IronEngineCoolant.getCoolant(coolantTank.getFluid());
if(coolant == null) {
return false;
@@ -167,12 +181,14 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IP
fuelTank.drain(1, true);
ticksRemaingFuel = getNumTicksPerMbFuel(fuel);
res = true;
tanksDirty = true;
}
ticksRemaingCoolant--;
if(ticksRemaingCoolant <= 0) {
coolantTank.drain(1, true);
ticksRemaingCoolant = getNumTicksPerMbCoolant(coolant, fuel);
res = true;
tanksDirty = true;
}
@@ -10,6 +10,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import crazypants.enderio.Config;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractPoweredTaskEntity;
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
@@ -192,7 +193,7 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler
@Override
protected float getPowerUsePerTick() {
return 1;
return Config.vatPowerUserPerTick;
}
}