Started work on combustion generator.

This commit is contained in:
cp committed 2014-03-29 22:29:06 +08:00
1 parent 63ed1236fb
commit 70ab630ff0
12 files changed
+178 -16

No files matched your search

+21 -16
View File
@@ -46,6 +46,7 @@ import crazypants.enderio.machine.alloy.AlloyRecipeManager;
import crazypants.enderio.machine.alloy.BlockAlloySmelter;
import crazypants.enderio.machine.crusher.BlockCrusher;
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
import crazypants.enderio.machine.generator.BlockCombustionGenerator;
import crazypants.enderio.machine.generator.BlockStirlingGenerator;
import crazypants.enderio.machine.hypercube.BlockHyperCube;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
@@ -129,6 +130,7 @@ public class EnderIO {
// Machines
public static BlockStirlingGenerator blockStirlingGenerator;
public static BlockCombustionGenerator blockCombustionGenerator;
public static BlockSolarPanel blockSolarPanel;
public static BlockReservoir blockReservoir;
public static BlockAlloySmelter blockAlloySmelter;
@@ -180,6 +182,7 @@ public class EnderIO {
blockSolarPanel = BlockSolarPanel.create();
blockStirlingGenerator = BlockStirlingGenerator.create();
blockCombustionGenerator = BlockCombustionGenerator.create();
blockCrusher = BlockCrusher.create();
blockAlloySmelter = BlockAlloySmelter.create();
@@ -201,39 +204,41 @@ public class EnderIO {
blockElectricLight = BlockElectricLight.create();
blockLightNode = BlockLightNode.create();
blockReservoir = BlockReservoir.create();
blockFusedQuartz = BlockFusedQuartz.create();
itemFusedQuartzFrame = ItemFusedQuartzFrame.create();
blockConduitBundle = BlockConduitBundle.create();
blockConduitFacade = BlockConduitFacade.create();
itemConduitFacade = ItemConduitFacade.create();
itemRedstoneConduit = ItemRedstoneConduit.create();
itemPowerConduit = ItemPowerConduit.create();
itemLiquidConduit = ItemLiquidConduit.create();
itemItemConduit = ItemItemConduit.create();
Fluid f = new Fluid(Fluids.NUTRIENT_DISTILLATION_NAME).setDensity(1500).setViscosity(3000);
FluidRegistry.registerFluid(f);
fluidNutrientDistillation = FluidRegistry.getFluid(f.getName());
blockNutrientDistillation = BlockFluidEio.create(fluidNutrientDistillation, new MaterialLiquid(MapColor.brownColor));
itemBucketNutrientDistillation = ItemBucketEio.create(fluidNutrientDistillation);
f = new Fluid(Fluids.HOOTCH_NAME).setDensity(900).setViscosity(1000);
FluidRegistry.registerFluid(f);
fluidHootch = FluidRegistry.getFluid(f.getName());
blocHootch = BlockFluidEio.create(fluidHootch, new MaterialLiquid(MapColor.grayColor));
itemBucketHootch = ItemBucketEio.create(fluidHootch);
IronEngineFuel.addFuel("hootch", Config.hootchPowerPerCycle, Config.hootchPowerTotalBurnTime);
blockFusedQuartz = BlockFusedQuartz.create();
itemFusedQuartzFrame = ItemFusedQuartzFrame.create();
itemBasicCapacitor = ItemCapacitor.create();
itemMachinePart = ItemMachinePart.create();
itemMaterial = ItemMaterial.create();
itemAlloy = ItemAlloy.create();
itemPowderIngot = ItemPowderIngot.create();
blockConduitBundle = BlockConduitBundle.create();
blockConduitFacade = BlockConduitFacade.create();
itemConduitFacade = ItemConduitFacade.create();
itemRedstoneConduit = ItemRedstoneConduit.create();
itemPowerConduit = ItemPowerConduit.create();
itemLiquidConduit = ItemLiquidConduit.create();
itemItemConduit = ItemItemConduit.create();
itemBucketNutrientDistillation = ItemBucketEio.create(fluidNutrientDistillation);
itemBucketHootch = ItemBucketEio.create(fluidHootch);
itemYetaWench = ItemYetaWrench.create();
itemEnderface = ItemEnderface.create();
itemTravelStaff = ItemTravelStaff.create();
@@ -33,6 +33,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI_ID_TRAVEL_ACCESSABLE = 18;
public static final int GUI_ID_TRAVEL_AUTH = 19;
public static final int GUI_ID_STILL = 20;
public static final int GUI_ID_COMBUSTION_GEN = 21;
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
@@ -30,6 +30,7 @@ public enum ModObject {
// Machines
blockStirlingGenerator,
blockCombustionGenerator,
blockReservoir,
blockAlloySmelter,
blockSolarPanel,
@@ -355,6 +355,9 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements IIn
@Override
public ItemStack getStackInSlot(int slot) {
if(slot < 0 || slot >= inventory.length) {
return null;
}
return inventory[slot];
}
@@ -0,0 +1,45 @@
package crazypants.enderio.machine.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineBlock;
public class BlockCombustionGenerator extends AbstractMachineBlock<TileCombustionGenerator> {
public static BlockCombustionGenerator create() {
BlockCombustionGenerator gen = new BlockCombustionGenerator();
gen.init();
return gen;
}
protected BlockCombustionGenerator() {
super(ModObject.blockCombustionGenerator, TileCombustionGenerator.class);
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GuiCombustionGenerator(player.inventory, (TileCombustionGenerator) world.getTileEntity(x, y, z));
}
@Override
protected int getGuiId() {
return GuiHandler.GUI_ID_COMBUSTION_GEN;
}
@Override
protected String getMachineFrontIconKey(boolean active) {
if(active) {
return "enderio:combustionGenFrontOn";
}
return "enderio:combustionGenFront";
}
}
@@ -0,0 +1,50 @@
package crazypants.enderio.machine.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import org.lwjgl.opengl.GL11;
import crazypants.enderio.machine.GuiMachineBase;
import crazypants.render.RenderUtil;
public class GuiCombustionGenerator extends GuiMachineBase {
private TileCombustionGenerator entity;
public GuiCombustionGenerator(InventoryPlayer par1InventoryPlayer, TileCombustionGenerator te) {
super(te, new EmptyContainer());
this.entity = te;
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderUtil.bindTexture("enderio:textures/gui/combustionGen.png");
int sx = (width - xSize) / 2;
int sy = (height - ySize) / 2;
drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
int scaled;
if(entity.getProgress() < 1 && entity.getProgress() > 0) {
scaled = entity.getProgressScaled(12);
drawTexturedModalRect(sx + 80, sy + 65 - scaled, 176, 12 - scaled, 14, scaled + 2);
}
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
}
public static class EmptyContainer extends Container {
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
}
}
@@ -0,0 +1,56 @@
package crazypants.enderio.machine.generator;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.power.IPowerEmitter;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.SlotDefinition;
public class TileCombustionGenerator extends AbstractMachineEntity implements IPowerEmitter {
public TileCombustionGenerator() {
super(new SlotDefinition(-1, -1, -1, -1, -1, -1));
}
@Override
public String getInventoryName() {
return ModObject.blockCombustionGenerator.unlocalisedName;
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public String getMachineName() {
return ModObject.blockCombustionGenerator.unlocalisedName;
}
@Override
public boolean canEmitPowerFrom(ForgeDirection side) {
return true;
}
@Override
protected boolean isMachineItemValidForSlot(int i, ItemStack itemstack) {
return false;
}
@Override
public boolean isActive() {
return false;
}
@Override
public float getProgress() {
return 0;
}
@Override
protected boolean processTasks(boolean redstoneCheckPassed) {
return false;
}
}