electric boiler, turbine, block state GUI fix

This commit is contained in:
HbmMods 2018-11-05 23:57:23 +01:00
parent f558718571
commit c5692c0533
43 changed files with 1688 additions and 122 deletions

View File

@ -42,6 +42,7 @@ potion.hbm_bang=! ! !
hbmfluid.none=Nichts
hbmfluid.water=Wasser
hbmfluid.steam=Dampf
hbmfluid.hotsteam=Dichter Dampf
hbmfluid.lava=Lava
hbmfluid.uf6=Uranhexafluorid
hbmfluid.puf6=Plutoniumhexafluorid
@ -333,6 +334,12 @@ container.battery=Energiespeicher
tile.machine_coal_off.name=Kohlegenerator
tile.machine_coal_on.name=Kohlegenerator
container.machineCoal=Kohlegenerator
tile.machine_boiler_off.name=Dampfkessel
tile.machine_boiler_on.name=Dampfkessel
container.machineBoiler=Dampfkessel
tile.machine_boiler_electric_off.name=Elektrischer Boiler
tile.machine_boiler_electric_on.name=Elektrischer Boiler
container.machineBoilerElectric=Elektrischer Boiler
tile.launch_pad.name=Raketenabschussrampe
container.launchPad=Raketenabschussrampe
tile.book_guide.name=Hbm's Nuclear Tech Mod Handbuch [LEGACY]

View File

@ -42,6 +42,7 @@ potion.hbm_bang=! ! !
hbmfluid.none=None
hbmfluid.water=Water
hbmfluid.steam=Steam
hbmfluid.hotsteam=Dense Steam
hbmfluid.lava=Lava
hbmfluid.uf6=Uranium Hexafluoride
hbmfluid.puf6=Plutonium Hexafluoride
@ -333,6 +334,12 @@ container.battery=Energy Storage
tile.machine_coal_off.name=Coal Generator
tile.machine_coal_on.name=Coal Generator
container.machineCoal=Coal Generator
tile.machine_boiler_off.name=Boiler
tile.machine_boiler_on.name=Boiler
container.machineBoiler=Boiler
tile.machine_boiler_electric_off.name=Electric Boiler
tile.machine_boiler_electric_on.name=Electric Boiler
container.machineBoilerElectric=Electric Boiler
tile.launch_pad.name=Missile Launch Pad
container.launchPad=Missile Launch Pad
tile.book_guide.name=Hbm's Nuclear Tech Mod Manual [LEGACY]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -449,6 +449,9 @@ public class ModBlocks {
public static Block machine_boiler_electric_on;
public static final int guiID_machine_boiler_electric = 73;
public static Block machine_turbine;
public static final int guiID_machine_turbine = 74;
public static Block machine_drill;
public static Block drill_pipe;
public static final int guiID_machine_drill = 45;
@ -959,9 +962,11 @@ public class ModBlocks {
machine_reactor_small = new MachineReactorSmall(Material.iron).setBlockName("machine_reactor_small").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_reactor_small");
machine_boiler_off = new MachineBoiler(false).setBlockName("machine_boiler_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_boiler_off");
machine_boiler_on = new MachineBoiler(true).setBlockName("machine_boiler_on").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_boiler_on");
machine_boiler_on = new MachineBoiler(true).setBlockName("machine_boiler_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_on");
machine_boiler_electric_off = new MachineBoiler(false).setBlockName("machine_boiler_electric_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_boiler_electric_off");
machine_boiler_electric_on = new MachineBoiler(true).setBlockName("machine_boiler_electric_on").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_boiler_electric_on");
machine_boiler_electric_on = new MachineBoiler(true).setBlockName("machine_boiler_electric_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_electric_on");
machine_turbine = new MachineTurbine(Material.iron).setBlockName("machine_turbine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_turbine");
machine_schrabidium_transmutator = new MachineSchrabidiumTransmutator(Material.iron).setBlockName("machine_schrabidium_transmutator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab);
@ -1338,6 +1343,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_boiler_on, machine_boiler_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_boiler_electric_on, machine_boiler_electric_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_boiler_electric_off, machine_boiler_electric_off.getUnlocalizedName());
GameRegistry.registerBlock(machine_turbine, machine_turbine.getUnlocalizedName());
GameRegistry.registerBlock(machine_shredder, machine_shredder.getUnlocalizedName());
//GameRegistry.registerBlock(machine_deuterium, machine_deuterium.getUnlocalizedName());
GameRegistry.registerBlock(machine_well, machine_well.getUnlocalizedName());

View File

@ -7,7 +7,6 @@ import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import com.hbm.tileentity.machine.TileEntityMachineCoal;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
@ -144,7 +143,7 @@ public class MachineBoiler extends BlockContainer {
if(itemStack.hasDisplayName())
{
((TileEntityMachineCoal)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
((TileEntityMachineBoiler)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
}
}
@ -214,7 +213,7 @@ public class MachineBoiler extends BlockContainer {
}
keepInventory = false;
world.setBlockMetadataWithNotify(x, y, z, i, 2);
world.setBlockMetadataWithNotify(x, y, z, i, 3);
if(entity != null) {
entity.validate();

View File

@ -0,0 +1,126 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityMachineTurbine;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class MachineTurbine extends BlockContainer {
private final Random field_149933_a = new Random();
@SideOnly(Side.CLIENT)
private IIcon iconTop;
public MachineTurbine(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_turbine_top");
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_turbine_base");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if(side == 0 || side == 1)
return this.iconTop;
return blockIcon;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityMachineTurbine();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote)
{
return true;
} else if(!player.isSneaking())
{
TileEntity te = world.getTileEntity(x, y, z);
TileEntityMachineTurbine entity = (TileEntityMachineTurbine) te;
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_turbine, world, x, y, z);
}
return true;
} else {
return false;
}
}
@Override
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_,
int p_149749_6_) {
ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_,
p_149749_4_);
if (tileentityfurnace != null) {
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
if (itemstack != null) {
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
while (itemstack.stackSize > 0) {
int j1 = this.field_149933_a.nextInt(21) + 10;
if (j1 > itemstack.stackSize) {
j1 = itemstack.stackSize;
}
itemstack.stackSize -= j1;
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1,
p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
}
float f3 = 0.05F;
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
p_149749_1_.spawnEntityInWorld(entityitem);
}
}
}
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
}
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
}
}

View File

@ -7,52 +7,54 @@ public class FluidTypeHandler {
public enum FluidType {
NONE (0x888888, 8947848, 0, 1, 1, "hbmfluid.none"),
WATER (0x3333FF, 3355647, 1, 1, 1, "hbmfluid.water"),
STEAM (0xe5e5e5, 15066597, 9, 2, 1, "hbmfluid.steam"),
COOLANT (0xd8fcff, 14220543, 2, 1, 1, "hbmfluid.coolant"),
WATER (0x3333FF, 3355647, 1, 1, 1, "hbmfluid.water"),
STEAM (0xe5e5e5, 15066597, 9, 2, 1, "hbmfluid.steam"),
HOTSTEAM (0xE7D6D6, 0xE7D6D6, 9, 2, 1, "hbmfluid.hotsteam"),
SUPERHOTSTEAM (0xE7B7B7, 0xE7B7B7, 9, 2, 1, "hbmfluid.superhotsteam"),
COOLANT (0xd8fcff, 14220543, 1, 1, 2, "hbmfluid.coolant"),
LAVA (0xFF3300, 16724736, 3, 1, 1, "hbmfluid.lava"),
LAVA (0xFF3300, 16724736, 3, 1, 1, "hbmfluid.lava"),
DEUTERIUM (0x0000FF, 255, 4, 1, 1, "hbmfluid.deuterium"),
TRITIUM (0x000099, 153, 5, 1, 1, "hbmfluid.tritium"),
DEUTERIUM (0x0000FF, 255, 4, 1, 1, "hbmfluid.deuterium"),
TRITIUM (0x000099, 153, 5, 1, 1, "hbmfluid.tritium"),
OIL (0x020202, 131586, 6, 1, 1, "hbmfluid.oil"),
HOTOIL (0x300900, 3148032, 8, 1, 1, "hbmfluid.hotoil"),
OIL (0x020202, 131586, 6, 1, 1, "hbmfluid.oil"),
HOTOIL (0x300900, 3148032, 8, 2, 1, "hbmfluid.hotoil"),
HEAVYOIL (0x141312, 1315602, 2, 2, 1, "hbmfluid.heavyoil"),
BITUMEN (0x1f2426, 2040870, 3, 2, 1, "hbmfluid.bitumen"),
SMEAR (0x190f01, 1642241, 7, 1, 1, "hbmfluid.smear"),
HEATINGOIL (0x211806, 2168838, 4, 2, 1, "hbmfluid.heatingoil"),
HEAVYOIL (0x141312, 1315602, 2, 2, 1, "hbmfluid.heavyoil"),
BITUMEN (0x1f2426, 2040870, 3, 2, 1, "hbmfluid.bitumen"),
SMEAR (0x190f01, 1642241, 7, 1, 1, "hbmfluid.smear"),
HEATINGOIL (0x211806, 2168838, 4, 2, 1, "hbmfluid.heatingoil"),
RECLAIMED (0x332b22, 3353378, 8, 1, 1, "hbmfluid.reclaimed"),
PETROIL (0x44413d, 4473149, 9, 1, 1, "hbmfluid.petroil"),
RECLAIMED (0x332b22, 3353378, 8, 1, 1, "hbmfluid.reclaimed"),
PETROIL (0x44413d, 4473149, 9, 1, 1, "hbmfluid.petroil"),
LUBRICANT (0x606060, 6316128, 10, 1, 1, "hbmfluid.lubricant"),
LUBRICANT (0x606060, 6316128, 10, 1, 1, "hbmfluid.lubricant"),
NAPHTHA (0x595744, 5855044, 5, 2, 1, "hbmfluid.naphtha"),
DIESEL (0xf2eed5, 15920853, 11, 1, 1, "hbmfluid.diesel"),
NAPHTHA (0x595744, 5855044, 5, 2, 1, "hbmfluid.naphtha"),
DIESEL (0xf2eed5, 15920853, 11, 1, 1, "hbmfluid.diesel"),
LIGHTOIL (0x8c7451, 9204817, 6, 2, 1, "hbmfluid.lightoil"),
KEROSENE (0xffa5d2, 16754130, 12, 1, 1, "hbmfluid.kerosene"),
LIGHTOIL (0x8c7451, 9204817, 6, 2, 1, "hbmfluid.lightoil"),
KEROSENE (0xffa5d2, 16754130, 12, 1, 1, "hbmfluid.kerosene"),
GAS (0xfffeed, 16776941, 13, 1, 1, "hbmfluid.gas"),
PETROLEUM (0x7cb7c9, 8173513, 7, 2, 1, "hbmfluid.petroleum"),
GAS (0xfffeed, 16776941, 13, 1, 1, "hbmfluid.gas"),
PETROLEUM (0x7cb7c9, 8173513, 7, 2, 1, "hbmfluid.petroleum"),
BIOGAS (0xbfd37c, 12571516, 12, 2, 1, "hbmfluid.biogas"),
BIOFUEL (0xeef274, 15659636, 13, 2, 1, "hbmfluid.biofuel"),
BIOGAS (0xbfd37c, 12571516, 12, 2, 1, "hbmfluid.biogas"),
BIOFUEL (0xeef274, 15659636, 13, 2, 1, "hbmfluid.biofuel"),
NITAN (0x8018ad, 8394925, 15, 2, 1, "hbmfluid.nitan"),
NITAN (0x8018ad, 8394925, 15, 2, 1, "hbmfluid.nitan"),
UF6 (0xD1CEBE, 13749950, 14, 1, 1, "hbmfluid.uf6"),
PUF6 (0x4C4C4C, 5000268, 15, 1, 1, "hbmfluid.puf6"),
SAS3 (0x4ffffc, 5242876, 14, 2, 1, "hbmfluid.sas3"),
UF6 (0xD1CEBE, 13749950, 14, 1, 1, "hbmfluid.uf6"),
PUF6 (0x4C4C4C, 5000268, 15, 1, 1, "hbmfluid.puf6"),
SAS3 (0x4ffffc, 5242876, 14, 2, 1, "hbmfluid.sas3"),
AMAT (0x010101, 65793, 0, 2, 1, "hbmfluid.amat"),
ASCHRAB (0xb50000, 11862016, 1, 2, 1, "hbmfluid.aschrab"),
AMAT (0x010101, 65793, 0, 2, 1, "hbmfluid.amat"),
ASCHRAB (0xb50000, 11862016, 1, 2, 1, "hbmfluid.aschrab"),
ACID (0xfff7aa, 16775082, 10, 2, 1, "hbmfluid.acid"),
WATZ (0x86653E, 8807742, 11, 2, 1, "hbmfluid.watz"),
CRYOGEL (0x32ffff, 3342335, 0, 1, 2, "hbmfluid.cryogel");
ACID (0xfff7aa, 16775082, 10, 2, 1, "hbmfluid.acid"),
WATZ (0x86653E, 8807742, 11, 2, 1, "hbmfluid.watz"),
CRYOGEL (0x32ffff, 3342335, 0, 1, 2, "hbmfluid.cryogel");
//Approximate HEX Color of the fluid, used for pipe rendering

View File

@ -34,6 +34,7 @@ import com.hbm.tileentity.machine.TileEntityFusionMultiblock;
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
import com.hbm.tileentity.machine.TileEntityMachineBattery;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import com.hbm.tileentity.machine.TileEntityMachineCMBFactory;
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
import com.hbm.tileentity.machine.TileEntityMachineChemplant;
@ -66,6 +67,7 @@ import com.hbm.tileentity.machine.TileEntityMachineShredder;
import com.hbm.tileentity.machine.TileEntityMachineSiren;
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
import com.hbm.tileentity.machine.TileEntityMachineTeleporter;
import com.hbm.tileentity.machine.TileEntityMachineTurbine;
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
import com.hbm.tileentity.machine.TileEntityMachineUF6Tank;
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
@ -728,6 +730,24 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_machine_boiler_electric:
{
if(entity instanceof TileEntityMachineBoilerElectric)
{
return new ContainerMachineBoilerElectric(player.inventory, (TileEntityMachineBoilerElectric) entity);
}
return null;
}
case ModBlocks.guiID_machine_turbine:
{
if(entity instanceof TileEntityMachineTurbine)
{
return new ContainerMachineTurbine(player.inventory, (TileEntityMachineTurbine) entity);
}
return null;
}
}
return null;
}
@ -1377,6 +1397,24 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_machine_boiler_electric:
{
if(entity instanceof TileEntityMachineBoilerElectric)
{
return new GUIMachineBoilerElectric(player.inventory, (TileEntityMachineBoilerElectric) entity);
}
return null;
}
case ModBlocks.guiID_machine_turbine:
{
if(entity instanceof TileEntityMachineTurbine)
{
return new GUIMachineTurbine(player.inventory, (TileEntityMachineTurbine) entity);
}
return null;
}
}
} else {
//CLIENTONLY GUIS

View File

@ -0,0 +1,142 @@
package com.hbm.handler.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.hbm.handler.nei.RefineryRecipeHandler.SmeltingSet;
import com.hbm.inventory.MachineRecipes;
import com.hbm.inventory.gui.GUIMachineBoiler;
import com.hbm.inventory.gui.GUIMachineBoilerElectric;
import com.hbm.inventory.gui.GUIMachineRefinery;
import com.hbm.lib.RefStrings;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.TemplateRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect;
import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRectHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
public class BoilerRecipeHandler extends TemplateRecipeHandler {
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
public LinkedList<Class<? extends GuiContainer>> guiGui = new LinkedList<Class<? extends GuiContainer>>();
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe
{
PositionedStack input;
PositionedStack result;
public SmeltingSet(ItemStack input, ItemStack result) {
input.stackSize = 1;
this.input = new PositionedStack(input, 21 + 9, 6 + 18);
this.result = new PositionedStack(result, 120, 24);
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 48, Arrays.asList(new PositionedStack[] {input}));
}
@Override
public PositionedStack getResult() {
return result;
}
}
@Override
public String getRecipeName() {
return "Boiler";
}
@Override
public String getGuiTexture() {
return RefStrings.MODID + ":textures/gui/gui_nei_boiler.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return null;
}
@Override
public TemplateRecipeHandler newInstance() {
return super.newInstance();
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if ((outputId.equals("ntmboiler")) && getClass() == BoilerRecipeHandler.class) {
Map<Object, Object> recipes = MachineRecipes.instance().getBoilerRecipes();
for (Map.Entry<Object, Object> recipe : recipes.entrySet()) {
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(),
(ItemStack)recipe.getValue()));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
Map<Object, Object> recipes = MachineRecipes.instance().getBoilerRecipes();
for (Map.Entry<Object, Object> recipe : recipes.entrySet()) {
if (compareFluidStacks((ItemStack)recipe.getValue(), result) ||
compareFluidStacks((ItemStack)recipe.getValue(), result))
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(),
(ItemStack)recipe.getValue()));
}
}
@Override
public void loadUsageRecipes(String inputId, Object... ingredients) {
if ((inputId.equals("ntmboiler")) && getClass() == BoilerRecipeHandler.class) {
loadCraftingRecipes("ntmboiler", new Object[0]);
} else {
super.loadUsageRecipes(inputId, ingredients);
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
Map<Object, Object> recipes = MachineRecipes.instance().getBoilerRecipes();
for (Map.Entry<Object, Object> recipe : recipes.entrySet()) {
if (compareFluidStacks(ingredient, (ItemStack)recipe.getKey()))
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(),
(ItemStack)recipe.getValue()));
}
}
private boolean compareFluidStacks(ItemStack sta1, ItemStack sta2) {
return sta1.getItem() == sta2.getItem() && sta1.getItemDamage() == sta2.getItemDamage();
}
@Override
public void drawExtras(int recipe) {
drawProgressBar(80, 23, 0, 85, 6, 17, 240, 3);
}
@Override
public void loadTransferRects() {
transferRectsGui = new LinkedList<RecipeTransferRect>();
guiGui = new LinkedList<Class<? extends GuiContainer>>();
transferRects.add(new RecipeTransferRect(new Rectangle(138 - 1 - 36 - 27 - 9, 23, 36, 18), "ntmboiler"));
transferRectsGui.add(new RecipeTransferRect(new Rectangle(18 * 2 + 2 + 36, 89 - 29 - 18 - 18, 18, 18 * 2), "ntmboiler"));
guiGui.add(GUIMachineBoiler.class);
guiGui.add(GUIMachineBoilerElectric.class);
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
}
}

View File

@ -477,12 +477,26 @@ public class MachineRecipes {
switch(type) {
case WATER: return new Object[] { FluidType.STEAM, 5, 5, 10000 };
case STEAM: return new Object[] { FluidType.HOTSTEAM, 5, 50, 45000 };
case OIL: return new Object[] { FluidType.HOTOIL, 5, 5, 35000 };
}
return null;
}
//return: FluidType, amount produced, amount required, HE produced
@SuppressWarnings("incomplete-switch")
public static Object[] getTurbineOutput(FluidType type) {
switch(type) {
case STEAM: return new Object[] { FluidType.WATER, 5, 5, 50 };
case HOTSTEAM: return new Object[] { FluidType.STEAM, 50, 5, 250 };
case SUPERHOTSTEAM: return new Object[] { FluidType.HOTSTEAM, 50, 5, 750 };
}
return null;
}
public static List<Item> stamps_flat = new ArrayList<Item>() {{
add(ModItems.stamp_stone_flat);
add(ModItems.stamp_iron_flat);
@ -4641,7 +4655,7 @@ public class MachineRecipes {
Map<Object, Object[]> recipes = new HashMap<Object, Object[]>();
ItemStack oil = new ItemStack(ModItems.fluid_icon, 1, Arrays.asList(FluidType.values()).indexOf(FluidType.OIL));
ItemStack oil = new ItemStack(ModItems.fluid_icon, 1, Arrays.asList(FluidType.values()).indexOf(FluidType.HOTOIL));
oil.stackTagCompound = new NBTTagCompound();
oil.stackTagCompound.setInteger("fill", 1000);
@ -4671,6 +4685,30 @@ public class MachineRecipes {
return recipes;
}
public Map<Object, Object> getBoilerRecipes() {
Map<Object, Object> recipes = new HashMap<Object, Object>();
for(int i = 0; i < FluidType.values().length; i++) {
Object[] outs = getBoilerOutput(FluidType.getEnum(i));
if(outs != null) {
ItemStack in = new ItemStack(ModItems.fluid_icon, 1, i);
in.stackTagCompound = new NBTTagCompound();
in.stackTagCompound.setInteger("fill", (Integer) outs[2]);
ItemStack out = new ItemStack(ModItems.fluid_icon, 1, ((FluidType)outs[0]).getID());
out.stackTagCompound = new NBTTagCompound();
out.stackTagCompound.setInteger("fill", (Integer) outs[1]);
recipes.put(in, out);
}
}
return recipes;
}
public static List<ItemStack> getChemInputFromTempate(ItemStack stack) {
if(stack == null || !(stack.getItem() instanceof ItemChemistryTemplate))

View File

@ -13,12 +13,8 @@ import net.minecraft.item.ItemStack;
public class ContainerElectricFurnace extends Container {
private TileEntityMachineElectricFurnace diFurnace;
private int dualCookTime;
private int lastItemBurnTime;
public ContainerElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace tedf) {
dualCookTime = 0;
lastItemBurnTime = 0;
diFurnace = tedf;
@ -43,7 +39,6 @@ public class ContainerElectricFurnace extends Container {
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.dualCookTime);
}
@Override
@ -86,29 +81,4 @@ public class ContainerElectricFurnace extends Container {
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.dualCookTime != this.diFurnace.dualCookTime)
{
par1.sendProgressBarUpdate(this, 0, this.diFurnace.dualCookTime);
}
}
this.dualCookTime = this.diFurnace.dualCookTime;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
diFurnace.dualCookTime = j;
}
}
}

View File

@ -0,0 +1,95 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineBoilerElectric extends Container {
private TileEntityMachineBoilerElectric diFurnace;
public ContainerMachineBoilerElectric(InventoryPlayer invPlayer, TileEntityMachineBoilerElectric tedf) {
diFurnace = tedf;
//Fluid ID
this.addSlotToContainer(new Slot(tedf, 0, 8, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 1, 8, 53));
//Input IO
this.addSlotToContainer(new Slot(tedf, 2, 44, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 3, 44, 53));
//Battery
this.addSlotToContainer(new Slot(tedf, 4, 98, 53));
//Output IO
this.addSlotToContainer(new Slot(tedf, 5, 152, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 6, 152, 53));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
{
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 6) {
if (!this.mergeItemStack(var5, 7, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 4, 5, false))
{
if (!this.mergeItemStack(var5, 2, 3, false))
if (!this.mergeItemStack(var5, 5, 6, false))
if (!this.mergeItemStack(var5, 0, 1, false))
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
}

View File

@ -13,11 +13,8 @@ import net.minecraft.item.ItemStack;
public class ContainerMachineCoal extends Container {
private TileEntityMachineCoal diFurnace;
private int burnTime;
public ContainerMachineCoal(InventoryPlayer invPlayer, TileEntityMachineCoal tedf) {
burnTime = 0;
diFurnace = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 44, 53 - 36));
@ -42,7 +39,6 @@ public class ContainerMachineCoal extends Container {
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.burnTime);
}
@Override
@ -86,29 +82,4 @@ public class ContainerMachineCoal extends Container {
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.burnTime != this.diFurnace.burnTime)
{
par1.sendProgressBarUpdate(this, 0, this.diFurnace.burnTime);
}
}
this.burnTime = this.diFurnace.burnTime;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
diFurnace.burnTime = j;
}
}
}

View File

@ -0,0 +1,94 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.machine.TileEntityMachineTurbine;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineTurbine extends Container {
private TileEntityMachineTurbine diFurnace;
public ContainerMachineTurbine(InventoryPlayer invPlayer, TileEntityMachineTurbine tedf) {
diFurnace = tedf;
//Fluid ID
this.addSlotToContainer(new Slot(tedf, 0, 8, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 1, 8, 53));
//Input IO
this.addSlotToContainer(new Slot(tedf, 2, 44, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 3, 44, 53));
//Battery
this.addSlotToContainer(new Slot(tedf, 4, 98, 53));
//Output IO
this.addSlotToContainer(new Slot(tedf, 5, 152, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 6, 152, 53));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
{
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 6) {
if (!this.mergeItemStack(var5, 7, this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 4, 5, false))
{
if (!this.mergeItemStack(var5, 2, 3, false))
if (!this.mergeItemStack(var5, 5, 6, false))
if (!this.mergeItemStack(var5, 0, 1, false))
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineBoiler;
import com.hbm.inventory.container.ContainerMachineGasCent;
@ -33,8 +34,32 @@ public class GUIMachineBoiler extends GuiInfoContainer {
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 102, guiTop + 16, 8, 18, mouseX, mouseY, new String[] { String.valueOf((int)((double)diFurnace.heat / 100D)) + "°C"});
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 97, guiTop + 34, 18, 18, mouseX, mouseY, new String[] { String.valueOf((int)(Math.ceil((double)diFurnace.burnTime / 20D))) + "s"});
String[] text = new String[] { "Heat produced:",
" 0.5°C/t",
" or 10°C/s",
"Heat consumed:",
" 0.15°C/t",
" or 3.0°C/s (base)",
" 0.25°C/t",
" or 5.0°C/t (once boiling point is reached)",
" 0.05°C/t",
" or 1.0°C/t (for every subsequent multiple of boiling point)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Boiling rate:",
" Base rate * amount of full multiples",
" of boiling points reached" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
if(diFurnace.tanks[1].getTankType().name().equals(FluidType.NONE.name())) {
String[] text2 = new String[] { "Error: Liquid can not be boiled!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
}
@Override
@ -51,12 +76,22 @@ public class GUIMachineBoiler extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
/*int i = (int)diFurnace.getPowerRemainingScaled(34);
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i);*/
if(diFurnace.burnTime > 0)
drawTexturedModalRect(guiLeft + 97, guiTop + 34, 176, 0, 18, 18);
int j = (int)diFurnace.getHeatScaled(17);
drawTexturedModalRect(guiLeft + 103, guiTop + 33 - j, 194, 16 - j, 6, j);
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineBoiler)
diFurnace = (TileEntityMachineBoiler) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
if(diFurnace.tanks[1].getTankType().name().equals(FluidType.NONE.name())) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);

View File

@ -0,0 +1,103 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineBoilerElectric;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineBoilerElectric extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_boiler_electric.png");
private TileEntityMachineBoilerElectric diFurnace;
public GUIMachineBoilerElectric(InventoryPlayer invPlayer, TileEntityMachineBoilerElectric tedf) {
super(new ContainerMachineBoilerElectric(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 168;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 102, guiTop + 16, 8, 18, mouseX, mouseY, new String[] { String.valueOf((int)((double)diFurnace.heat / 100D)) + "°C"});
String[] text = new String[] { "Heat produced:",
" 1.5°C/t",
" or 30°C/s",
"Heat consumed:",
" 0.15°C/t",
" or 3.0°C/s (base)",
" 0.25°C/t",
" or 5.0°C/t (once boiling point is reached)",
" 0.15°C/t",
" or 3.0°C/t (for every subsequent multiple of boiling point)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Boiling rate:",
" Base rate * amount of full multiples",
" of boiling points reached" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
if(diFurnace.tanks[1].getTankType().name().equals(FluidType.NONE.name())) {
String[] text2 = new String[] { "Error: Liquid can not be boiled!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 123, guiTop + 69 - 34, 7, 34, diFurnace.power, diFurnace.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.power > 0)
drawTexturedModalRect(guiLeft + 97, guiTop + 34, 176, 0, 18, 18);
int j = (int)diFurnace.getHeatScaled(17);
drawTexturedModalRect(guiLeft + 103, guiTop + 33 - j, 194, 16 - j, 6, j);
int i = (int)diFurnace.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 123, guiTop + 69 - i, 200, 34 - i, 7, i);
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineBoilerElectric)
diFurnace = (TileEntityMachineBoilerElectric) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
if(diFurnace.tanks[1].getTankType().name().equals(FluidType.NONE.name())) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -53,6 +53,8 @@ public class GUIMachineCoal extends GuiInfoContainer {
"the generator to function properly!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 79, guiTop + 34, 18, 18, mouseX, mouseY, new String[] { String.valueOf((int)(Math.ceil((double)diFurnace.burnTime / 20D))) + "s"});
}
@Override
@ -69,6 +71,9 @@ public class GUIMachineCoal extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineCoal)
diFurnace = (TileEntityMachineCoal) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
if(diFurnace.power > 0) {
int i = (int)diFurnace.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - i, 176, 52 - i, 16, i);

View File

@ -46,7 +46,19 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.hasPower()) {
//failsafe TE clone
//if initial TE invalidates, new TE is fetched
//if initial ZE is still present, it'll be used instead
//works so that container packets can still be used
//efficiency!
TileEntityMachineElectricFurnace fs = null;
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineElectricFurnace)
fs = (TileEntityMachineElectricFurnace) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
else
fs = diFurnace;
if(fs.hasPower()) {
int i = (int)diFurnace.getPowerRemainingScaled(52);
drawTexturedModalRect(guiLeft + 20, guiTop + 69 - i, 200, 52 - i, 16, i);
}
@ -56,7 +68,7 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 56, guiTop + 36, 176, 0, 15, 16);
}
int j1 = diFurnace.getDiFurnaceProgressScaled(24);
int j1 = fs.getDiFurnaceProgressScaled(24);
drawTexturedModalRect(guiLeft + 79, guiTop + 34, 176, 14, j1 + 1, 17);
}

View File

@ -0,0 +1,82 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineTurbine;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineTurbine;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineTurbine extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_turbine.png");
private TileEntityMachineTurbine diFurnace;
public GUIMachineTurbine(InventoryPlayer invPlayer, TileEntityMachineTurbine tedf) {
super(new ContainerMachineTurbine(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 168;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52);
if(diFurnace.tanks[1].getTankType().name().equals(FluidType.NONE.name())) {
String[] text2 = new String[] { "Error: Invalid fluid!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 123, guiTop + 69 - 34, 7, 34, diFurnace.power, diFurnace.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.tanks[0].getTankType().name().equals(FluidType.STEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 0, 14, 14);
}
if(diFurnace.tanks[0].getTankType().name().equals(FluidType.HOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 14, 14, 14);
}
if(diFurnace.tanks[0].getTankType().name().equals(FluidType.SUPERHOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 28, 14, 14);
}
int i = (int)diFurnace.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 123, guiTop + 69 - i, 176, 34 - i, 7, i);
if(diFurnace.tanks[1].getTankType().name().equals(FluidType.NONE.name())) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -1206,7 +1206,8 @@ public class Library {
}
}
if(tileentity instanceof IFluidAcceptor && newTact && !(tileentity instanceof TileEntityMachineFluidTank && ((TileEntityMachineFluidTank)tileentity).dna()))
if(tileentity instanceof IFluidAcceptor && newTact && !(tileentity instanceof TileEntityMachineFluidTank && ((TileEntityMachineFluidTank)tileentity).dna())
&& ((IFluidAcceptor)tileentity).getMaxFluidFill(type) > 0 && ((IFluidAcceptor)tileentity).getMaxFluidFill(type) - ((IFluidAcceptor)tileentity).getFluidFill(type) > 0)
{
that.getFluidList(type).add((IFluidAcceptor)tileentity);
}

View File

@ -544,7 +544,7 @@ public class CraftingManager {
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_reactor), 1), new Object[] { "LSL", "SCS", "LSL", 'S', "ingotSteel", 'L', "ingotLead", 'C', ModItems.reactor_core }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_nuke_furnace_off), 1), new Object[] { "SSS", "SFS", "CCC", 'S', "plateSteel", 'C', "plateCopper", 'F', Item.getItemFromBlock(Blocks.furnace) }));
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_rtg_furnace_off), 1), new Object[] { "NNN", "NFN", "UUU", 'N', "plateDenseLead", 'U', ModItems.rtg_unit, 'F', Item.getItemFromBlock(Blocks.furnace) }));
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 1), new Object[] { "BBB", "WFW", "RRR", 'B', ModItems.ingot_beryllium, 'R', ModItems.coil_tungsten, 'W', ModItems.wire_red_copper, 'F', Item.getItemFromBlock(Blocks.furnace) });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 1), new Object[] { "BBB", "WFW", "RRR", 'B', ModItems.ingot_beryllium, 'R', ModItems.coil_tungsten, 'W', ModItems.board_copper, 'F', Item.getItemFromBlock(Blocks.furnace) });
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_generator), 1), new Object[] { "SLS", "LCL", "SLS", 'C', ModItems.circuit_red_copper, 'L', ModItems.rod_quad_lead, 'S', "ingotSteel" }));
//GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_industrial_generator), 1), new Object[] { "PPP", "FGG", "WSS", 'P', ModItems.board_copper, 'F', ModItems.generator_front, 'G', ModItems.generator_steel, 'W', ModBlocks.red_wire_coated, 'S', ModItems.pedestal_steel });
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.red_wire_coated), 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.plate_polymer, 'I', "ingotRedstoneAlloy", 'R', ModItems.wire_red_copper }));
@ -558,6 +558,8 @@ public class CraftingManager {
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_battery), 1), new Object[] { "TST", "RIR", "TLT", 'T', "ingotTungsten", 'I', "ingotRedstoneAlloy", 'R', ModItems.wire_red_copper, 'S', "blockSulfur", 'L', "blockLead" }));
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_battery), 1), new Object[] { "TLT", "RIR", "TST", 'T', "ingotTungsten", 'I', "ingotRedstoneAlloy", 'R', ModItems.wire_red_copper, 'S', "blockSulfur", 'L', "blockLead" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_coal_off, 1), new Object[] { "STS", "SCS", "SFS", 'S', "ingotSteel", 'T', ModItems.tank_steel, 'C', "ingotRedstoneAlloy", 'F', Blocks.furnace }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_boiler_off, 1), new Object[] { "SPS", "TFT", "SPS", 'S', "ingotSteel", 'P', ModItems.board_copper, 'T', ModItems.tank_steel, 'F', Blocks.furnace }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_boiler_electric_off, 1), new Object[] { "SPS", "TFT", "SPS", 'S', "ingotDesh", 'P', ModItems.board_copper, 'T', ModItems.tank_steel, 'F', ModBlocks.machine_electric_furnace_off }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_converter_he_rf, 1), new Object[] { "SSS", "CRB", "SSS", 'S', "ingotSteel", 'C', ModItems.coil_copper, 'R', ModItems.coil_copper_torus, 'B', "blockRedstone" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_converter_rf_he, 1), new Object[] { "SSS", "BRC", "SSS", 'S', ModItems.ingot_beryllium, 'C', ModItems.coil_copper, 'R', ModItems.coil_copper_torus, 'B', "blockRedstone" }));
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_schrabidium_transmutator), 1), new Object[] { "TST", "ARA", "BBB", 'S', ModItems.nugget_schrabidium , 'T', "ingotTitanium", 'A', Item.getItemFromBlock(ModBlocks.factory_advanced_hull), 'R', Item.getItemFromBlock(ModBlocks.machine_reactor), 'B', Item.getItemFromBlock(ModBlocks.machine_battery) }));

View File

@ -310,6 +310,7 @@ import com.hbm.tileentity.machine.TileEntityMachineSiren;
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
import com.hbm.tileentity.machine.TileEntityMachineTeleporter;
import com.hbm.tileentity.machine.TileEntityMachineTransformer;
import com.hbm.tileentity.machine.TileEntityMachineTurbine;
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
import com.hbm.tileentity.machine.TileEntityMachineUF6Tank;
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
@ -726,6 +727,7 @@ public class MainRegistry
GameRegistry.registerTileEntity(TileEntityMachineGasCent.class, "tileentity_gas_centrifuge");
GameRegistry.registerTileEntity(TileEntityMachineBoiler.class, "tileentity_boiler");
GameRegistry.registerTileEntity(TileEntityMachineBoilerElectric.class, "tileentity_electric_boiler");
GameRegistry.registerTileEntity(TileEntityMachineTurbine.class, "tileentity_turbine");
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);

View File

@ -32,6 +32,8 @@ public class NEIConfig implements IConfigureNEI {
API.registerUsageHandler(new AssemblerRecipeHandler());
API.registerRecipeHandler(new RefineryRecipeHandler());
API.registerUsageHandler(new RefineryRecipeHandler());
API.registerRecipeHandler(new BoilerRecipeHandler());
API.registerUsageHandler(new BoilerRecipeHandler());
//API.registerRecipeHandler(new ModInfoHandler());
//API.registerUsageHandler(new ModInfoHandler());
API.registerRecipeHandler(new ChemplantRecipeHandler());

View File

@ -9,8 +9,11 @@ import com.hbm.tileentity.machine.TileEntityAMSBase;
import com.hbm.tileentity.machine.TileEntityAMSEmitter;
import com.hbm.tileentity.machine.TileEntityAMSLimiter;
import com.hbm.tileentity.machine.TileEntityMachineBoiler;
import com.hbm.tileentity.machine.TileEntityMachineBoilerElectric;
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
import com.hbm.tileentity.machine.TileEntityMachineCoal;
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
import com.hbm.tileentity.machine.TileEntityMachineReactorSmall;
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
@ -176,8 +179,26 @@ public class AuxGaugePacket implements IMessage {
if(m.id == 1)
boiler.burnTime = m.value;
}
if (te instanceof TileEntityMachineCoal) {
TileEntityMachineCoal coalgen = (TileEntityMachineCoal)te;
if(m.id == 0)
coalgen.burnTime = m.value;
}
if (te instanceof TileEntityMachineElectricFurnace) {
TileEntityMachineElectricFurnace furn = (TileEntityMachineElectricFurnace)te;
if(m.id == 0)
furn.dualCookTime = m.value;
}
if (te instanceof TileEntityMachineBoilerElectric) {
TileEntityMachineBoilerElectric boiler = (TileEntityMachineBoilerElectric)te;
if(m.id == 0)
boiler.heat = m.value;
}
} catch (Exception x) { }
} catch (Exception x) {}
return null;
}
}

View File

@ -35,6 +35,10 @@ public class TileEntityMachineBattery extends TileEntity implements ISidedInvent
private String customName;
public TileEntityMachineBattery() {
slots = new ItemStack[2];
}
public TileEntityMachineBattery(long maxPower) {
slots = new ItemStack[2];
this.maxPower = maxPower;

View File

@ -34,7 +34,7 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
private ItemStack slots[];
public int burnTime;
public int heat;
public int heat = 2000;
public static final int maxHeat = 50000;
public int age = 0;
public List<IFluidAcceptor> list = new ArrayList();
@ -218,6 +218,8 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
@Override
public void updateEntity() {
boolean mark = false;
if(!worldObj.isRemote)
{
age++;
@ -231,7 +233,6 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
tanks[0].setType(0, 1, slots);
tanks[0].loadTank(2, 3, slots);
//TODO: set tanks[1]'s type accordingly
Object[] outs = MachineRecipes.getBoilerOutput(tanks[0].getTankType());
@ -248,7 +249,7 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
boolean flag1 = false;
if(heat > 0) {
if(heat > 2000) {
heat -= 15;
}
@ -258,8 +259,10 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
flag1 = true;
}
if(burnTime == 0 && !flag1)
if(burnTime == 0 && flag1) {
MachineBoiler.updateBlockState(false, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
if(heat > maxHeat)
heat = maxHeat;
@ -271,8 +274,10 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
if(slots[4].stackSize <= 0)
slots[4] = null;
if(!flag1)
if(!flag1) {
MachineBoiler.updateBlockState(true, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
}
if(outs != null) {
@ -290,13 +295,17 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
}
}
if(heat < 0) {
heat = 0;
if(heat < 2000) {
heat = 2000;
}
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, heat, 0));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, burnTime, 1));
}
if(mark) {
this.markDirty();
}
}
public boolean isItemValid() {

View File

@ -1,7 +1,413 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineBoiler;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.MachineRecipes;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
public class TileEntityMachineBoilerElectric extends TileEntity {
public class TileEntityMachineBoilerElectric extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IConsumer {
private ItemStack slots[];
public long power;
public int heat = 2000;
public static final long maxPower = 10000;
public static final int maxHeat = 80000;
public int age = 0;
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank[] tanks;
private static final int[] slots_top = new int[] {4};
private static final int[] slots_bottom = new int[] {6};
private static final int[] slots_side = new int[] {4};
private String customName;
public TileEntityMachineBoilerElectric() {
slots = new ItemStack[7];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.WATER, 16000, 0);
tanks[1] = new FluidTank(FluidType.STEAM, 16000, 1);
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.machineElecricBoiler";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 4)
if(stack != null && stack.getItem() instanceof ItemBattery)
return true;
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
heat = nbt.getInteger("heat");
power = nbt.getLong("power");
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "steam");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("heat", heat);
nbt.setLong("power", power);
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "steam");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
public int getHeatScaled(int i) {
return (heat * i) / maxHeat;
}
public long getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void updateEntity() {
boolean mark = false;
if(!worldObj.isRemote)
{
age++;
if(age >= 20)
{
age = 0;
}
if(age == 9 || age == 19)
fillFluidInit(tanks[1].getTankType());
power = Library.chargeTEFromItems(slots, 4, power, maxPower);
tanks[0].setType(0, 1, slots);
tanks[0].loadTank(2, 3, slots);
Object[] outs = MachineRecipes.getBoilerOutput(tanks[0].getTankType());
if(outs == null) {
tanks[1].setTankType(FluidType.NONE);
} else {
tanks[1].setTankType((FluidType) outs[0]);
}
tanks[1].unloadTank(5, 6, slots);
for(int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord);
if(heat > 2000) {
heat -= 15;
}
if(power > 0) {
power -= 100;
heat += 150;
}
if(power <= 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_electric_on) {
power = 0;
MachineBoiler.updateBlockState(false, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
if(heat > maxHeat)
heat = maxHeat;
if(power > 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_electric_off) {
MachineBoiler.updateBlockState(true, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
if(outs != null) {
for(int i = 0; i < (heat / ((Integer)outs[3]).intValue()); i++) {
if(tanks[0].getFill() >= ((Integer)outs[2]).intValue() && tanks[1].getFill() + ((Integer)outs[1]).intValue() <= tanks[1].getMaxFill()) {
tanks[0].setFill(tanks[0].getFill() - ((Integer)outs[2]).intValue());
tanks[1].setFill(tanks[1].getFill() + ((Integer)outs[1]).intValue());
if(i == 0)
heat -= 25;
else
heat -= 15;
}
}
}
if(heat < 2000) {
heat = 2000;
}
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, heat, 0));
}
if(mark) {
this.markDirty();
}
}
public boolean isItemValid() {
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0)
{
return true;
}
return false;
}
@Override
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, getTact(), type);
}
@Override
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
}
@Override
public boolean getTact() {
if(age >= 0 && age < 10)
{
return true;
}
return false;
}
@Override
public void setFluidFill(int i, FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
}
@Override
public int getFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
return 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
return 0;
}
@Override
public void setFillstate(int fill, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
return list;
}
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list;
}
@Override
public void clearFluidList(FluidType type) {
list.clear();
}
@Override
public void setPower(long i) {
power = i;
}
@Override
public long getPower() {
return power;
}
@Override
public long getMaxPower() {
return maxPower;
}
}

View File

@ -26,6 +26,7 @@ import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
public class TileEntityMachineCoal extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
@ -257,7 +258,9 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
flag1 = true;
MachineCoal.updateBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, burnTime, 0));
generate();
}

View File

@ -5,6 +5,7 @@ import com.hbm.interfaces.IConsumer;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import net.minecraft.entity.player.EntityPlayer;
@ -218,7 +219,7 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
return false;
}
ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[1]);
//ItemStack itemStack = MachineRecipes.getShredderResult(this.slots[1]);
if(itemStack == null)
{
return false;
@ -243,7 +244,6 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
private void processItem() {
if(canProcess()) {
ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[1]);
//ItemStack itemStack = MachineRecipes.getShredderResult(this.slots[1]);
if(slots[2] == null)
{
@ -305,8 +305,9 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
}
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, dualCookTime, 0));
}

View File

@ -9,6 +9,7 @@ import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
@ -33,7 +34,7 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
public long power = 0;
public int sulfur = 0;
public static final int maxSulfur = 100;
public static final long maxPower = 100000;
public static final long maxPower = 1000;
public int age = 0;
public FluidTank[] tanks;
public List<IFluidAcceptor> list1 = new ArrayList();
@ -50,7 +51,7 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
public TileEntityMachineRefinery() {
slots = new ItemStack[12];
tanks = new FluidTank[5];
tanks[0] = new FluidTank(FluidType.OIL, 64000, 0);
tanks[0] = new FluidTank(FluidType.HOTOIL, 64000, 0);
tanks[1] = new FluidTank(FluidType.HEAVYOIL, 16000, 1);
tanks[2] = new FluidTank(FluidType.NAPHTHA, 16000, 2);
tanks[3] = new FluidTank(FluidType.LIGHTOIL, 16000, 3);
@ -127,7 +128,7 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
if(i == 0 && stack.getItem() instanceof ItemBattery)
return true;
if(i == 1 && stack.getItem() == ModItems.canister_oil)
if(i == 1 && FluidContainerRegistry.getFluidContent(stack, FluidType.HOTOIL) > 0)
return true;
if(stack.getItem() == ModItems.canister_empty) {
if(i == 3)
@ -274,7 +275,7 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
int lo = 15;
int pe = 10;
if(power >= 50 && tanks[0].getFill() >= 100 &&
if(power >= 5 && tanks[0].getFill() >= 100 &&
tanks[1].getFill() + ho <= tanks[1].getMaxFill() &&
tanks[2].getFill() + nt <= tanks[2].getMaxFill() &&
tanks[3].getFill() + lo <= tanks[3].getMaxFill() &&
@ -286,7 +287,7 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
tanks[3].setFill(tanks[3].getFill() + lo);
tanks[4].setFill(tanks[4].getFill() + pe);
sulfur += 1;
power -= 100;
power -= 5;
}
tanks[1].unloadTank(3, 4, slots);

View File

@ -0,0 +1,382 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.interfaces.ISource;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.MachineRecipes;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
public class TileEntityMachineTurbine extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, ISource {
private ItemStack slots[];
public long power;
public static final long maxPower = 1000000;
public int age = 0;
public List<IConsumer> list1 = new ArrayList();
public List<IFluidAcceptor> list2 = new ArrayList();
public FluidTank[] tanks;
private static final int[] slots_top = new int[] {4};
private static final int[] slots_bottom = new int[] {6};
private static final int[] slots_side = new int[] {4};
private String customName;
public TileEntityMachineTurbine() {
slots = new ItemStack[7];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.STEAM, 8000, 0);
tanks[1] = new FluidTank(FluidType.WATER, 8000, 1);
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.machineTurbine";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 4)
if(stack != null && stack.getItem() instanceof ItemBattery)
return true;
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "steam");
power = nbt.getLong("power");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "steam");
nbt.setLong("power", power);
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
public long getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void updateEntity() {
boolean mark = false;
if(!worldObj.isRemote)
{
age++;
if(age >= 20)
{
age = 0;
}
if(age == 9 || age == 19) {
fillFluidInit(tanks[1].getTankType());
ffgeuaInit();
}
tanks[0].setType(0, 1, slots);
tanks[0].loadTank(2, 3, slots);
Object[] outs = MachineRecipes.getTurbineOutput(tanks[0].getTankType());
if(outs == null) {
tanks[1].setTankType(FluidType.NONE);
} else {
tanks[1].setTankType((FluidType) outs[0]);
for(int i = 0; i < tanks[0].getFill() / 50 + 1; i++) {
if(tanks[0].getFill() >= (Integer)outs[2] && tanks[1].getFill() + (Integer)outs[1] <= tanks[1].getMaxFill()) {
tanks[0].setFill(tanks[0].getFill() - (Integer)outs[2]);
tanks[1].setFill(tanks[1].getFill() + (Integer)outs[1]);
power += (Integer)outs[3];
if(power > maxPower)
power = maxPower;
}
}
}
tanks[1].unloadTank(5, 6, slots);
for(int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord);
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
}
}
@Override
public void ffgeua(int x, int y, int z, boolean newTact) {
Library.ffgeua(x, y, z, newTact, this, worldObj);
}
@Override
public void ffgeuaInit() {
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
}
@Override
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, getTact(), type);
}
@Override
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
}
@Override
public boolean getTact() {
if(age >= 0 && age < 10)
{
return true;
}
return false;
}
@Override
public void setFluidFill(int i, FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
}
@Override
public int getFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
return 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
return 0;
}
@Override
public void setFillstate(int fill, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
return list;
}
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list2;
}
@Override
public void clearFluidList(FluidType type) {
list2.clear();
}
@Override
public long getSPower() {
return power;
}
@Override
public void setSPower(long i) {
this.power = i;
}
@Override
public List<IConsumer> getList() {
return list1;
}
@Override
public void clearList() {
this.list1.clear();
}
}