Removed all errors
This commit is contained in:
parent
591a5a2499
commit
11e71b6ddd
16 changed files with 108 additions and 647 deletions
|
@ -2,6 +2,7 @@ package dark.mech.steam;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -25,21 +26,21 @@ public class ItemRenderHelperS implements ISimpleBlockRenderingHandler
|
|||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (block.blockID == SteamPowerMain.boilers.blockID && metadata >= 0 && metadata <= 3)
|
||||
if (block.blockID == SteamPowerMain.blockBoiler.blockID && metadata >= 0 && metadata <= 3)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(SteamPowerMain.textureFile + "tankTexture.png"));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(SteamPowerMain.instance.PREFIX,SteamPowerMain.GUI_DIRECTORY + "tankTexture.png"));
|
||||
modelTank.generalRender(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (block.blockID == SteamPowerMain.heaters.blockID && metadata >= 0 && metadata <= 3)
|
||||
if (block.blockID == SteamPowerMain.blockHeater.blockID && metadata >= 0 && metadata <= 3)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(SteamPowerMain.textureFile + "Furnace.png"));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(SteamPowerMain.instance.PREFIX,SteamPowerMain.GUI_DIRECTORY + "Furnace.png"));
|
||||
modelFurnace.genRender(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package dark.mech.steam;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import dark.mech.steam.boiler.TileEntityBoiler;
|
||||
import dark.mech.steam.firebox.TileEntityFireBox;
|
||||
import dark.mech.steam.renders.RenderBoiler;
|
||||
import dark.mech.steam.renders.RenderFurnace;
|
||||
import dark.mech.steam.renders.RenderGearPiston;
|
||||
import dark.mech.steam.renders.RenderGenerator;
|
||||
import dark.mech.steam.steamengine.TileEntitySteamPiston;
|
||||
|
||||
public class SteamClientProxy extends SteamProxy
|
||||
|
@ -23,7 +19,7 @@ public class SteamClientProxy extends SteamProxy
|
|||
public void init()
|
||||
{
|
||||
ClientRegistry.registerTileEntity(TileEntityBoiler.class, "boiler", new RenderBoiler(0f));
|
||||
ClientRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox", new RenderFurnace());
|
||||
// ClientRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox", new RenderFurnace());
|
||||
ClientRegistry.registerTileEntity(TileEntitySteamPiston.class, "generator", new RenderGearPiston());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,16 +3,11 @@ package dark.mech.steam;
|
|||
import java.io.File;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
|
@ -20,74 +15,84 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import dark.core.DarkMain;
|
||||
import dark.core.ModPrefab;
|
||||
import dark.mech.steam.boiler.BlockBoiler;
|
||||
import dark.mech.steam.firebox.BlockHeaters;
|
||||
import dark.mech.steam.steamengine.BlockSteamPiston;
|
||||
import dark.mech.steam.steamengine.ItemSteamPiston;
|
||||
|
||||
@Mod(modid = "SteamPower", name = "Steam Power", version = "0.2.3", dependencies = "after:basicPipes")
|
||||
@Mod(modid = SteamPowerMain.MOD_NAME, name = SteamPowerMain.MOD_ID, version = DarkMain.VERSION, dependencies = ("after:" + DarkMain.MOD_ID))
|
||||
@NetworkMod(channels = { SteamPowerMain.channel }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
|
||||
public class SteamPowerMain
|
||||
public class SteamPowerMain extends ModPrefab
|
||||
{
|
||||
public static Configuration config = new Configuration((new File(cpw.mods.fml.common.Loader.instance().getConfigDir(), "SteamPower.cfg")));
|
||||
public static final String channel = "SPpack";
|
||||
public static String textureFile = "/dark/SteamPower/textures/";
|
||||
public final static int BLOCK_ID_PREFIX = 3100;
|
||||
// Blocks and items
|
||||
public static Block heaters = new BlockHeaters(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "Burners", BLOCK_ID_PREFIX).value)).setBlockName("machine");
|
||||
public static Block piston = new BlockSteamPiston(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "SteamPiston", BLOCK_ID_PREFIX + 1).value)).setBlockName("SteamEngien");
|
||||
public static Block boilers = new BlockBoiler(Integer.parseInt(config.get(Configuration.CATEGORY_BLOCK, "Boilers", BLOCK_ID_PREFIX + 2).value)).setBlockName("machine");
|
||||
public static Item itemEngine = new ItemSteamPiston(Integer.parseInt(config.get(Configuration.CATEGORY_ITEM, "SteamPistonItem", 30308).value)).setItemName("SteamEngine");
|
||||
|
||||
public static final String MOD_ID = "SteamPower";
|
||||
public static final String MOD_NAME = "Steam Power";
|
||||
public static final String channel = MOD_ID;
|
||||
|
||||
// Blocks and items
|
||||
public static Block blockHeater, blockPiston, blockBoiler;
|
||||
// extra configs
|
||||
public static int steamOutBoiler, boilerHeat, fireOutput;
|
||||
@Instance
|
||||
public static SteamPowerMain instance;
|
||||
|
||||
@SidedProxy(clientSide = "dark.SteamPower.SteamClientProxy", serverSide = "dark.SteamPower.SteamProxy")
|
||||
public static SteamProxy proxy;
|
||||
// extra configs
|
||||
public static int steamOutBoiler = Integer.parseInt(config.get(Configuration.CATEGORY_GENERAL, "steamOutPerCycle", 10).value);
|
||||
public static int boilerHeat = Integer.parseInt(config.get(Configuration.CATEGORY_GENERAL, "boilerInKJNeed", 4500).value);
|
||||
public static int fireOutput = Integer.parseInt(config.get(Configuration.CATEGORY_GENERAL, "fireBoxOutKJMax", 250).value);
|
||||
|
||||
@PreInit
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
instance = this;
|
||||
NetworkRegistry.instance().registerGuiHandler(this, this.proxy);
|
||||
super.preInit(event);
|
||||
|
||||
GameRegistry.registerBlock(blockHeater, "SPHeater");
|
||||
GameRegistry.registerBlock(blockPiston, "SPPiston");
|
||||
GameRegistry.registerBlock(blockBoiler, "SPBoiler");
|
||||
|
||||
proxy.preInit();
|
||||
|
||||
GameRegistry.registerBlock(heaters, "heater units");
|
||||
GameRegistry.registerBlock(piston, "steam piston");
|
||||
GameRegistry.registerBlock(boilers, "boiler tanks");
|
||||
}
|
||||
|
||||
@Init
|
||||
public void load(FMLInitializationEvent evt)
|
||||
@EventHandler
|
||||
public void load(FMLInitializationEvent event)
|
||||
{
|
||||
super.init(event);
|
||||
proxy.init();
|
||||
|
||||
// Burner Names
|
||||
|
||||
LanguageRegistry.addName((new ItemStack(heaters, 1, 0)), BlockHeaters.Burners.values()[0].name);
|
||||
// Boiler Names
|
||||
LanguageRegistry.addName((new ItemStack(boilers, 1, 0)), BlockBoiler.Boilers.values()[0].name);
|
||||
// Steam Piston Name
|
||||
LanguageRegistry.addName((new ItemStack(itemEngine, 1, 0)), "Steam Piston");
|
||||
|
||||
}
|
||||
|
||||
@PostInit
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
super.postInit(event);
|
||||
proxy.postInit();
|
||||
}
|
||||
|
||||
// Boiler basic
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(boilers, 1, 0), new Object[] { "TT", "VV", "TT", 'T', new ItemStack(BasicUtilitiesMain.parts, 1, 6), 'V', new ItemStack(BasicUtilitiesMain.parts, 1, 7) }));
|
||||
// Burner Coal
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(heaters, 1, 0), new Object[] { "@", "F", 'F', Block.stoneOvenIdle, '@', "plateSteel" }));
|
||||
// SteamPiston
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(itemEngine, 1, 0), new Object[] { "GGG", "VPV", "@T@", 'T', new ItemStack(BasicUtilitiesMain.parts, 1, 1), 'G', BasicUtilitiesMain.rod, '@', "plateSteel", 'P', Block.pistonBase, 'V', new ItemStack(BasicUtilitiesMain.parts, 1, 7), 'M', "motor" }));
|
||||
@Override
|
||||
public String getDomain()
|
||||
{
|
||||
return "steam";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
config.load();
|
||||
//blockHeater = new BlockHeaters(config.get("Heater", "HeaterBlockID", this.getNextID()).getInt());
|
||||
blockPiston = new BlockSteamPiston(config.getBlock(Configuration.CATEGORY_BLOCK, "Piston", this.getNextID()).getInt());
|
||||
blockBoiler = new BlockBoiler(config.get("Boiler", "BoilerBlockID", this.getNextID()).getInt());
|
||||
steamOutBoiler = config.get("Boiler", "SteamPerCycle", 10).getInt();
|
||||
boilerHeat = config.get("Boiler", "HeatNeeded", 4500).getInt();
|
||||
fireOutput = config.get("Heater", "MaxOutputEnergy", 250).getInt();
|
||||
|
||||
config.save();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadModMeta()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,6 @@ import net.minecraft.world.World;
|
|||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import dark.mech.steam.boiler.TileEntityBoiler;
|
||||
import dark.mech.steam.firebox.ContainerFireBox;
|
||||
import dark.mech.steam.firebox.GUIFireBox;
|
||||
import dark.mech.steam.firebox.TileEntityFireBox;
|
||||
import dark.mech.steam.steamengine.TileEntitySteamPiston;
|
||||
|
||||
public class SteamProxy implements IGuiHandler
|
||||
|
@ -22,7 +19,7 @@ public class SteamProxy implements IGuiHandler
|
|||
public void init()
|
||||
{
|
||||
GameRegistry.registerTileEntity(TileEntityBoiler.class, "boiler");
|
||||
GameRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox");
|
||||
//GameRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox");
|
||||
GameRegistry.registerTileEntity(TileEntitySteamPiston.class, "steamPiston");
|
||||
|
||||
}
|
||||
|
@ -42,7 +39,7 @@ public class SteamProxy implements IGuiHandler
|
|||
switch (ID)
|
||||
{
|
||||
case 0:
|
||||
return new GUIFireBox(player.inventory, ((TileEntityFireBox) tileEntity));
|
||||
//return new GUIFireBox(player.inventory, ((TileEntityFireBox) tileEntity));
|
||||
//case 1: return new GuiBoiler(player.inventory, ((TileEntityBoiler)tileEntity));
|
||||
//case 2: return new GUISteamPiston(player.inventory, ((TileEntitySteamPiston)tileEntity));
|
||||
}
|
||||
|
@ -61,7 +58,7 @@ public class SteamProxy implements IGuiHandler
|
|||
switch (ID)
|
||||
{
|
||||
case 0:
|
||||
return new ContainerFireBox(player.inventory, ((TileEntityFireBox) tileEntity));
|
||||
//return new ContainerFireBox(player.inventory, ((TileEntityFireBox) tileEntity));
|
||||
//default: return new ContainerFake(player.inventory, (IInventory) tileEntity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package dark.mech.steam.boiler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
||||
public class TileEntityBoiler extends TileEntity
|
||||
{
|
||||
|
||||
public TileEntity[] connectedBlocks = new TileEntity[6];
|
||||
public int tankCount;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
package dark.mech.steam.firebox;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import dark.core.blocks.BlockMachine;
|
||||
import dark.core.blocks.TileEntityMachine;
|
||||
import dark.core.helpers.MetaGroup;
|
||||
import dark.mech.steam.ItemRenderHelperS;
|
||||
import dark.mech.steam.SteamPowerMain;
|
||||
|
||||
public class BlockHeaters extends BlockMachine
|
||||
{
|
||||
/** Quick enum to help sort out meta data info */
|
||||
public enum Burners
|
||||
{
|
||||
Coal("FireBox", TileEntityFireBox.class, 0),
|
||||
Liquid("LiquidBurner", TileEntityLiquidBurner.class, -1),
|
||||
Lava("LavaBuffer", TileEntityLavaBuffer.class, -1),
|
||||
Bio("BioFurnace", null, -1);
|
||||
|
||||
public String name;
|
||||
public Class<? extends TileEntity> ent;
|
||||
public int gui;
|
||||
|
||||
private Burners(String name, Class<? extends TileEntity> tileEntity, int gui)
|
||||
{
|
||||
this.name = name;
|
||||
this.gui = gui;
|
||||
this.ent = tileEntity;
|
||||
}
|
||||
}
|
||||
|
||||
public BlockHeaters(int par1)
|
||||
{
|
||||
super("machine", SteamPowerMain.config, par1, Material.iron);
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(3f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(metadata));
|
||||
}
|
||||
|
||||
/** Called upon block activation (left or right click on the block.). The three integers
|
||||
* represent x,y,z of the block. */
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity blockEntity = (TileEntity) world.getBlockTileEntity(x, y, z);
|
||||
if (!world.isRemote && !player.isSneaking() && blockEntity instanceof TileEntityFireBox)
|
||||
{
|
||||
TileEntity var6 = (TileEntityFireBox) world.getBlockTileEntity(x, y, z);
|
||||
player.openGui(SteamPowerMain.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int meta)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Burners.values()[MetaGroupingHelper.getGrouping(meta)].ent.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when the block is placed in the world. */
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving user)
|
||||
{
|
||||
int angle = MathHelper.floor_double((user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine ent = (TileEntityMachine) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (ent instanceof TileEntityFireBox)
|
||||
{
|
||||
world.setBlockMetadata(x, y, z, angle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return ItemRenderHelperS.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package dark.mech.steam.firebox;
|
||||
|
||||
import java.awt.Container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerFireBox extends Container
|
||||
{
|
||||
private TileEntityFireBox tileEntity;
|
||||
|
||||
public ContainerFireBox(InventoryPlayer par1InventoryPlayer, TileEntityFireBox tileEntity)
|
||||
{
|
||||
this.tileEntity = tileEntity;
|
||||
this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34));
|
||||
int var3;
|
||||
|
||||
for (var3 = 0; var3 < 3; ++var3)
|
||||
{
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (var3 = 0; var3 < 9; ++var3)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.tileEntity.isUseableByPlayer(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/** Called to transfer a stack from one inventory to the other eg. when shift clicking. */
|
||||
public ItemStack transferStackInSlot(int par1)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package dark.mech.steam.firebox;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GUIFireBox extends GuiContainer
|
||||
{
|
||||
private TileEntityFireBox tileEntity;
|
||||
|
||||
private int containerWidth;
|
||||
private int containerHeight;
|
||||
|
||||
public GUIFireBox(InventoryPlayer par1InventoryPlayer, TileEntityFireBox tileEntity)
|
||||
{
|
||||
super(new ContainerFireBox(par1InventoryPlayer, tileEntity));
|
||||
this.tileEntity = tileEntity;
|
||||
}
|
||||
|
||||
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
this.fontRenderer.drawString("FireBox", 55, 6, 4210752);
|
||||
this.fontRenderer.drawString("HeatOut", 90, 33, 4210752);
|
||||
String displayText = "";
|
||||
if (!tileEntity.isConnected)
|
||||
{
|
||||
displayText = "No Boiler";
|
||||
}
|
||||
else if (tileEntity.storedItems[0] != null)
|
||||
{
|
||||
if (tileEntity.storedItems[0].getItem().shiftedIndex != Item.coal.shiftedIndex)
|
||||
{
|
||||
displayText = "No Fuel";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tileEntity.generateRate * 20 < 20)
|
||||
{
|
||||
displayText = "Hull Heat: " + (tileEntity.generateRate * 100) + "%";
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = getWattDisplay((tileEntity.generateRate * 20));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.fontRenderer.drawString(displayText, (int) (105 - displayText.length() * 1.25), 45, 4210752);
|
||||
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
/** Draw the background layer for the GuiContainer (everything behind the items) */
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
int var4 = this.mc.renderEngine.getTexture(dark.mech.steam + "SteamGUI.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(var4);
|
||||
containerWidth = (this.width - this.xSize) / 2;
|
||||
containerHeight = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
public static String getWattDisplay(int watts)
|
||||
{
|
||||
String displayWatt;
|
||||
if (watts > 1000)
|
||||
{
|
||||
displayWatt = roundTwoDecimals((double) watts / 1000) + " MJ";
|
||||
}
|
||||
else
|
||||
{
|
||||
displayWatt = watts + " KJ";
|
||||
}
|
||||
|
||||
return displayWatt;
|
||||
}
|
||||
|
||||
public static double roundTwoDecimals(double d)
|
||||
{
|
||||
DecimalFormat twoDForm = new DecimalFormat("#.##");
|
||||
return Double.valueOf(twoDForm.format(d));
|
||||
}
|
||||
}
|
|
@ -1,247 +0,0 @@
|
|||
package dark.mech.steam.firebox;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import dark.core.blocks.TileEntityMachine;
|
||||
import dark.mech.steam.boiler.TileEntityBoiler;
|
||||
|
||||
public class TileEntityFireBox extends TileEntityMachine implements IPacketReceiver, IInventory, ISidedInventory, IHeatCreator
|
||||
{
|
||||
// max heat generated per second
|
||||
|
||||
public boolean isConnected = false;
|
||||
public TileEntity[] connectedBlocks = { null, null, null, null, null, null };
|
||||
private int connectedUnits = 0;
|
||||
public static int maxGenerateRate = 250;
|
||||
public int generateRate = 0;
|
||||
int count = 0;
|
||||
public int itemCookTime = 0;
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if (count++ >= 10)
|
||||
{
|
||||
count = 0;
|
||||
addConnection();
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
sharCoal();
|
||||
}
|
||||
TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
if (blockEntity instanceof TileEntityBoiler)
|
||||
{
|
||||
isConnected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isConnected = false;
|
||||
}
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
|
||||
maxGenerateRate = dark.mech.steam + (connectedUnits * 10);
|
||||
|
||||
// The top slot is for recharging items. Check if the item is a
|
||||
// electric item. If so, recharge it.
|
||||
if (this.storedItems[0] != null && isConnected)
|
||||
{
|
||||
if (this.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex)
|
||||
{
|
||||
if (this.itemCookTime <= 0)
|
||||
{
|
||||
itemCookTime = Math.max(1600 - (int) (this.generateRate * 20), 400);
|
||||
this.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Starts generating electricity if the device is heated up
|
||||
if (this.itemCookTime > 0)
|
||||
{
|
||||
this.itemCookTime--;
|
||||
if (isConnected)
|
||||
{
|
||||
this.generateRate = Math.min(this.generateRate + Math.min((this.generateRate) + 1, 1), this.maxGenerateRate / 10);
|
||||
}
|
||||
}
|
||||
// Loose heat when the generator is not connected or if there is no
|
||||
// coal in the inventory.
|
||||
if (this.itemCookTime <= 0 || !isConnected)
|
||||
{
|
||||
this.generateRate = Math.max(this.generateRate - 5, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// gets all connected fireBoxes and shares its supply of coal
|
||||
public void sharCoal()
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
|
||||
if (connectedBlocks[i] instanceof TileEntityFireBox)
|
||||
{
|
||||
TileEntityFireBox connectedConsumer = (TileEntityFireBox) connectedBlocks[i];
|
||||
if (this.storedItems[0] != null)
|
||||
{
|
||||
if (this.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex && this.storedItems[0].stackSize > 0)
|
||||
{
|
||||
if (connectedConsumer.storedItems[0] != null)
|
||||
{
|
||||
if (connectedConsumer.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex)
|
||||
{
|
||||
if (connectedConsumer.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex)
|
||||
{
|
||||
int CSum = Math.round(this.storedItems[0].stackSize + connectedConsumer.storedItems[0].stackSize) / 2;
|
||||
if (this.storedItems[0].stackSize > connectedConsumer.storedItems[0].stackSize)
|
||||
{
|
||||
int transferC = 0;
|
||||
transferC = Math.round(CSum - connectedConsumer.storedItems[0].stackSize);
|
||||
connectedConsumer.storedItems[0].stackSize = connectedConsumer.storedItems[0].stackSize + transferC;
|
||||
this.storedItems[0].stackSize = this.storedItems[0].stackSize - transferC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
connectedConsumer.storedItems[0] = new ItemStack(this.storedItems[0].getItem(), 1, this.storedItems[0].getItemDamage());
|
||||
this.storedItems[0].stackSize -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addConnection()
|
||||
{
|
||||
connectedUnits = 0;
|
||||
TileEntity[] aEntity = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
|
||||
if (aEntity[i] instanceof TileEntityFireBox && i != 0 && i != 1)
|
||||
{
|
||||
this.connectedBlocks[i] = aEntity[i];
|
||||
connectedUnits += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connectedBlocks[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads a tile entity from NBT. */
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime");
|
||||
this.generateRate = par1NBTTagCompound.getInteger("generateRate");
|
||||
}
|
||||
|
||||
/** Writes a tile entity to NBT. */
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setInteger("itemCookTime", (int) this.itemCookTime);
|
||||
par1NBTTagCompound.setInteger("generateRate", (int) this.generateRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "FireBox";
|
||||
}
|
||||
|
||||
public float onProduceHeat(float jouls, ForgeDirection side)
|
||||
{
|
||||
if (side == ForgeDirection.UP)
|
||||
{
|
||||
return Math.min(generateRate, jouls);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getSendData()
|
||||
{
|
||||
return new Object[] { (int) generateRate, (int) itemCookTime };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
generateRate = dataStream.readInt();
|
||||
itemCookTime = dataStream.readInt();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventorySide(ForgeDirection side)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel()
|
||||
{
|
||||
return dark.mech.steam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatHeat(ForgeDirection dir)
|
||||
{
|
||||
if (dir == ForgeDirection.UP)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createHeat(ForgeDirection dir)
|
||||
{
|
||||
if (dir == ForgeDirection.UP)
|
||||
return this.generateRate;
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package dark.mech.steam.firebox;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityLavaBuffer extends TileEntity
|
||||
{
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package dark.mech.steam.firebox;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityLiquidBurner extends TileEntity
|
||||
{
|
||||
|
||||
}
|
|
@ -2,12 +2,16 @@ package dark.mech.steam.renders;
|
|||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import dark.core.client.RenderMachine;
|
||||
import dark.core.helpers.ConnectionHelper;
|
||||
import dark.mech.steam.SteamPowerMain;
|
||||
import dark.mech.steam.boiler.TileEntityBoiler;
|
||||
|
||||
public class RenderBoiler extends TileEntitySpecialRenderer
|
||||
public class RenderBoiler extends RenderMachine
|
||||
{
|
||||
int type = 0;
|
||||
private ModelTank model;
|
||||
|
@ -32,18 +36,18 @@ public class RenderBoiler extends TileEntitySpecialRenderer
|
|||
int meta = 0;
|
||||
if (connected[5] == null && connected[3] == null && connected[4] == null && connected[2] == null || ((TileEntityBoiler) tileEntity).tankCount < 2)
|
||||
{
|
||||
bindTextureByName(dark.mech.steam + "tankTexture.png");
|
||||
bindTextureByName(SteamPowerMain.instance.PREFIX, SteamPowerMain.MODEL_DIRECTORY + "tankTexture.png");
|
||||
model.generalRender(0.0625F);
|
||||
}
|
||||
else if (MHelper.corner(tileEntity) == 0 || ((TileEntityBoiler) tileEntity).tankCount > 2)
|
||||
else if (ConnectionHelper.corner(tileEntity) == 0 || ((TileEntityBoiler) tileEntity).tankCount > 2)
|
||||
{
|
||||
bindTextureByName(dark.mech.steam + "tankBlock.png");
|
||||
bindTextureByName(SteamPowerMain.instance.PREFIX, SteamPowerMain.MODEL_DIRECTORY + "tankBlock.png");
|
||||
model2.renderBlock(0.0625F);
|
||||
}
|
||||
else
|
||||
{
|
||||
int corner = MHelper.corner(tileEntity);
|
||||
bindTextureByName(dark.mech.steam + "CornerTank.png");
|
||||
int corner = ConnectionHelper.corner(tileEntity);
|
||||
bindTextureByName(SteamPowerMain.instance.PREFIX, SteamPowerMain.MODEL_DIRECTORY + "CornerTank.png");
|
||||
switch (corner)
|
||||
{
|
||||
case 1:
|
||||
|
@ -65,4 +69,11 @@ public class RenderBoiler extends TileEntitySpecialRenderer
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(int block, int meta)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
package dark.mech.steam.renders;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderFurnace extends TileEntitySpecialRenderer
|
||||
import dark.core.client.RenderMachine;
|
||||
import dark.mech.steam.SteamPowerMain;
|
||||
|
||||
public class RenderFurnace extends RenderMachine
|
||||
{
|
||||
int type = 0;
|
||||
private ModelFurnace model;
|
||||
|
@ -18,7 +21,7 @@ public class RenderFurnace extends TileEntitySpecialRenderer
|
|||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float d3)
|
||||
{
|
||||
bindTextureByName(dark.mech.steam + "Furnace.png");
|
||||
bindTextureByName(SteamPowerMain.instance.PREFIX, SteamPowerMain.MODEL_DIRECTORY + "Furnace.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
@ -42,4 +45,11 @@ public class RenderFurnace extends TileEntitySpecialRenderer
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(int block, int meta)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,12 +2,15 @@ package dark.mech.steam.renders;
|
|||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import dark.core.client.RenderMachine;
|
||||
import dark.mech.steam.SteamPowerMain;
|
||||
import dark.mech.steam.steamengine.TileEntitySteamPiston;
|
||||
|
||||
public class RenderGearPiston extends TileEntitySpecialRenderer
|
||||
public class RenderGearPiston extends RenderMachine
|
||||
{
|
||||
private ModelGearPiston model;
|
||||
|
||||
|
@ -18,7 +21,7 @@ public class RenderGearPiston extends TileEntitySpecialRenderer
|
|||
|
||||
public void renderTileEntityAt(TileEntitySteamPiston tileEntity, double d, double d1, double d2, float d3)
|
||||
{
|
||||
bindTextureByName(dark.mech.steam + "GearShaftPiston.png");
|
||||
bindTextureByName(SteamPowerMain.instance.PREFIX, SteamPowerMain.MODEL_DIRECTORY + "GearShaftPiston.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
@ -40,7 +43,7 @@ public class RenderGearPiston extends TileEntitySpecialRenderer
|
|||
break;
|
||||
}
|
||||
model.renderGear(0.0625F);
|
||||
model.renderR(0.0625F, tileEntity.pos);
|
||||
model.renderR(0.0625F, 0);//TODO fix
|
||||
model.renderBody(0.0625F);
|
||||
model.renderBack(0.0625F);
|
||||
model.renderFront(0.0625F);
|
||||
|
@ -56,4 +59,11 @@ public class RenderGearPiston extends TileEntitySpecialRenderer
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(int block, int meta)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package dark.mech.steam.renders;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderGenerator extends TileEntitySpecialRenderer
|
||||
{
|
||||
int type = 0;
|
||||
private ModelGenerator model;
|
||||
|
||||
public RenderGenerator()
|
||||
{
|
||||
model = new ModelGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3)
|
||||
{
|
||||
bindTextureByName(dark.mech.steam + "Generator.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.RenderMain(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -63,7 +63,7 @@ public class BlockSteamPiston extends BlockMachine
|
|||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return SteamPowerMain.itemEngine.itemID;
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue