Removing some junk
Might re-add some of this stuff back later but its in the way
This commit is contained in:
parent
fec18db641
commit
e04aa0b7aa
20 changed files with 378 additions and 1437 deletions
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -11,15 +11,11 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import dark.core.client.gui.GuiBatteryBox;
|
|
||||||
import dark.core.client.gui.GuiCoalGenerator;
|
import dark.core.client.gui.GuiCoalGenerator;
|
||||||
import dark.core.client.gui.GuiElectricFurnace;
|
|
||||||
import dark.core.client.renders.BlockRenderingHandler;
|
import dark.core.client.renders.BlockRenderingHandler;
|
||||||
import dark.core.client.renders.RenderTestCar;
|
import dark.core.client.renders.RenderTestCar;
|
||||||
import dark.core.common.CommonProxy;
|
import dark.core.common.CommonProxy;
|
||||||
import dark.core.common.machines.TileEntityBatteryBox;
|
import dark.core.common.machines.TileEntitySteamGen;
|
||||||
import dark.core.common.machines.TileEntityBasicGenerator;
|
|
||||||
import dark.core.common.machines.TileEntityElectricFurnace;
|
|
||||||
import dark.core.prefab.ModPrefab;
|
import dark.core.prefab.ModPrefab;
|
||||||
import dark.core.prefab.vehicles.EntityTestCar;
|
import dark.core.prefab.vehicles.EntityTestCar;
|
||||||
|
|
||||||
|
@ -58,17 +54,9 @@ public class ClientProxy extends CommonProxy
|
||||||
|
|
||||||
if (tileEntity != null)
|
if (tileEntity != null)
|
||||||
{
|
{
|
||||||
if (tileEntity instanceof TileEntityBatteryBox)
|
if (tileEntity instanceof TileEntitySteamGen)
|
||||||
{
|
{
|
||||||
return new GuiBatteryBox(player.inventory, ((TileEntityBatteryBox) tileEntity));
|
return new GuiCoalGenerator(player.inventory, ((TileEntitySteamGen) tileEntity));
|
||||||
}
|
|
||||||
else if (tileEntity instanceof TileEntityBasicGenerator)
|
|
||||||
{
|
|
||||||
return new GuiCoalGenerator(player.inventory, ((TileEntityBasicGenerator) tileEntity));
|
|
||||||
}
|
|
||||||
else if (tileEntity instanceof TileEntityElectricFurnace)
|
|
||||||
{
|
|
||||||
return new GuiElectricFurnace(player.inventory, ((TileEntityElectricFurnace) tileEntity));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
package dark.core.client.gui;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import dark.core.common.DarkMain;
|
|
||||||
import dark.core.common.machines.ContainerBatteryBox;
|
|
||||||
import dark.core.common.machines.TileEntityBatteryBox;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class GuiBatteryBox extends GuiContainer
|
|
||||||
{
|
|
||||||
private static final ResourceLocation batteryBoxTexture = new ResourceLocation(DarkMain.getInstance().DOMAIN, DarkMain.GUI_DIRECTORY + "battery_box.png");
|
|
||||||
|
|
||||||
private TileEntityBatteryBox tileEntity;
|
|
||||||
|
|
||||||
private int containerWidth;
|
|
||||||
private int containerHeight;
|
|
||||||
|
|
||||||
public GuiBatteryBox(InventoryPlayer par1InventoryPlayer, TileEntityBatteryBox batteryBox)
|
|
||||||
{
|
|
||||||
super(new ContainerBatteryBox(par1InventoryPlayer, batteryBox));
|
|
||||||
this.tileEntity = batteryBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
|
|
||||||
@Override
|
|
||||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
|
||||||
{
|
|
||||||
this.fontRenderer.drawString(this.tileEntity.getInvName(), 65, 6, 4210752);
|
|
||||||
String displayJoules = ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES) + " of";
|
|
||||||
String displayMaxJoules = ElectricityDisplay.getDisplay(tileEntity.getMaxEnergyStored(), ElectricUnit.JOULES);
|
|
||||||
String displayVoltage = "Voltage: " + (int) (this.tileEntity.getVoltage() * 1000);
|
|
||||||
|
|
||||||
this.fontRenderer.drawString(displayJoules, 122 - this.fontRenderer.getStringWidth(displayJoules) / 2, 30, 4210752);
|
|
||||||
this.fontRenderer.drawString(displayMaxJoules, 122 - this.fontRenderer.getStringWidth(displayMaxJoules) / 2, 40, 4210752);
|
|
||||||
this.fontRenderer.drawString(displayVoltage, 122 - this.fontRenderer.getStringWidth(displayVoltage) / 2, 60, 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)
|
|
||||||
{
|
|
||||||
this.mc.renderEngine.bindTexture(batteryBoxTexture);
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
|
|
||||||
this.containerWidth = (this.width - this.xSize) / 2;
|
|
||||||
this.containerHeight = (this.height - this.ySize) / 2;
|
|
||||||
// Background energy bar
|
|
||||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
|
|
||||||
// Foreground energy bar
|
|
||||||
int scale = (int) ((this.tileEntity.getEnergyStored() / this.tileEntity.getMaxEnergyStored()) * 72);
|
|
||||||
this.drawTexturedModalRect(containerWidth + 87, containerHeight + 52, 176, 0, scale, 20);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,19 +13,19 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import dark.core.common.DarkMain;
|
import dark.core.common.DarkMain;
|
||||||
import dark.core.common.machines.ContainerCoalGenerator;
|
import dark.core.common.machines.ContainerCoalGenerator;
|
||||||
import dark.core.common.machines.TileEntityBasicGenerator;
|
import dark.core.common.machines.TileEntitySteamGen;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiCoalGenerator extends GuiContainer
|
public class GuiCoalGenerator extends GuiContainer
|
||||||
{
|
{
|
||||||
private static final ResourceLocation coalGeneratorTexture = new ResourceLocation(DarkMain.getInstance().DOMAIN, DarkMain.GUI_DIRECTORY + "coal_generator.png");
|
private static final ResourceLocation coalGeneratorTexture = new ResourceLocation(DarkMain.getInstance().DOMAIN, DarkMain.GUI_DIRECTORY + "coal_generator.png");
|
||||||
|
|
||||||
private TileEntityBasicGenerator tileEntity;
|
private TileEntitySteamGen tileEntity;
|
||||||
|
|
||||||
private int containerWidth;
|
private int containerWidth;
|
||||||
private int containerHeight;
|
private int containerHeight;
|
||||||
|
|
||||||
public GuiCoalGenerator(InventoryPlayer par1InventoryPlayer, TileEntityBasicGenerator tileEntity)
|
public GuiCoalGenerator(InventoryPlayer par1InventoryPlayer, TileEntitySteamGen tileEntity)
|
||||||
{
|
{
|
||||||
super(new ContainerCoalGenerator(par1InventoryPlayer, tileEntity));
|
super(new ContainerCoalGenerator(par1InventoryPlayer, tileEntity));
|
||||||
this.tileEntity = tileEntity;
|
this.tileEntity = tileEntity;
|
||||||
|
@ -43,9 +43,9 @@ public class GuiCoalGenerator extends GuiContainer
|
||||||
{
|
{
|
||||||
displayText = "Not Generating";
|
displayText = "Not Generating";
|
||||||
}
|
}
|
||||||
else if (this.tileEntity.generateWatts < TileEntityBasicGenerator.MIN_GENERATE_WATTS)
|
else if (this.tileEntity.generateWatts < TileEntitySteamGen.MIN_GENERATE_WATTS)
|
||||||
{
|
{
|
||||||
displayText = "Hull Heat: " + (int) (this.tileEntity.generateWatts / TileEntityBasicGenerator.MIN_GENERATE_WATTS * 100) + "%";
|
displayText = "Hull Heat: " + (int) (this.tileEntity.generateWatts / TileEntitySteamGen.MIN_GENERATE_WATTS * 100) + "%";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
package dark.core.client.gui;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import dark.core.common.DarkMain;
|
|
||||||
import dark.core.common.machines.ContainerElectricFurnace;
|
|
||||||
import dark.core.common.machines.TileEntityElectricFurnace;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class GuiElectricFurnace extends GuiContainer
|
|
||||||
{
|
|
||||||
private static final ResourceLocation electricFurnaceTexture = new ResourceLocation(DarkMain.getInstance().DOMAIN, DarkMain.GUI_DIRECTORY + "electric_furnace.png");
|
|
||||||
|
|
||||||
private TileEntityElectricFurnace tileEntity;
|
|
||||||
|
|
||||||
private int containerWidth;
|
|
||||||
private int containerHeight;
|
|
||||||
|
|
||||||
public GuiElectricFurnace(InventoryPlayer par1InventoryPlayer, TileEntityElectricFurnace tileEntity)
|
|
||||||
{
|
|
||||||
super(new ContainerElectricFurnace(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(this.tileEntity.getInvName(), 45, 6, 4210752);
|
|
||||||
this.fontRenderer.drawString("Smelting:", 10, 28, 4210752);
|
|
||||||
this.fontRenderer.drawString("Battery:", 10, 53, 4210752);
|
|
||||||
String displayText = "";
|
|
||||||
|
|
||||||
if (this.tileEntity.processTicks > 0)
|
|
||||||
{
|
|
||||||
displayText = "Smelting";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
displayText = "Idle";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fontRenderer.drawString("Status: " + displayText, 82, 45, 4210752);
|
|
||||||
this.fontRenderer.drawString(ElectricityDisplay.getDisplay(tileEntity.WATTS_PER_TICK * 20, ElectricUnit.WATT), 82, 56, 4210752);
|
|
||||||
this.fontRenderer.drawString("Voltage: " + (int) (this.tileEntity.getVoltage() * 1000), 82, 68, 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)
|
|
||||||
{
|
|
||||||
this.mc.renderEngine.bindTexture(electricFurnaceTexture);
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
|
|
||||||
containerWidth = (this.width - this.xSize) / 2;
|
|
||||||
containerHeight = (this.height - this.ySize) / 2;
|
|
||||||
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
|
|
||||||
|
|
||||||
if (this.tileEntity.processTicks > 0)
|
|
||||||
{
|
|
||||||
int scale = (int) (((double) this.tileEntity.processTicks / (double) TileEntityElectricFurnace.PROCESS_TIME_REQUIRED) * 23);
|
|
||||||
this.drawTexturedModalRect(containerWidth + 77, containerHeight + 24, 176, 0, 23 - scale, 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,16 +4,15 @@
|
||||||
// Keep in mind that you still need to fill in some blanks
|
// Keep in mind that you still need to fill in some blanks
|
||||||
// - ZeuX
|
// - ZeuX
|
||||||
|
|
||||||
|
package dark.core.client.models;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
public class ModelSteamGen extends ModelMachine
|
||||||
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public class ModelFurnace extends ModelBase
|
|
||||||
{
|
{
|
||||||
//fields
|
//fields
|
||||||
ModelRenderer body;
|
ModelRenderer body;
|
||||||
ModelRenderer top;
|
ModelRenderer top;
|
||||||
ModelRenderer bot;
|
ModelRenderer bot;
|
||||||
|
@ -47,261 +46,255 @@ public class ModelFurnace extends ModelBase
|
||||||
ModelRenderer pipe4;
|
ModelRenderer pipe4;
|
||||||
ModelRenderer gauge;
|
ModelRenderer gauge;
|
||||||
ModelRenderer gaugeNeedle;
|
ModelRenderer gaugeNeedle;
|
||||||
|
|
||||||
public ModelFurnace()
|
public ModelSteamGen()
|
||||||
{
|
{
|
||||||
textureWidth = 128;
|
textureWidth = 128;
|
||||||
textureHeight = 128;
|
textureHeight = 128;
|
||||||
|
|
||||||
body = new ModelRenderer(this, 0, 25);
|
body = new ModelRenderer(this, 0, 25);
|
||||||
body.addBox(-7.5F, 0F, -7.5F, 15, 9, 12);
|
body.addBox(-7.5F, 0F, -7.5F, 15, 9, 12);
|
||||||
body.setRotationPoint(0F, 10F, 3F);
|
body.setRotationPoint(0F, 10F, 3F);
|
||||||
body.setTextureSize(128, 128);
|
body.setTextureSize(128, 128);
|
||||||
body.mirror = true;
|
body.mirror = true;
|
||||||
setRotation(body, 0F, 0F, 0F);
|
setRotation(body, 0F, 0F, 0F);
|
||||||
top = new ModelRenderer(this, 0, 0);
|
top = new ModelRenderer(this, 0, 0);
|
||||||
top.addBox(-8F, 0F, -8F, 16, 2, 15);
|
top.addBox(-8F, 0F, -8F, 16, 2, 15);
|
||||||
top.setRotationPoint(0F, 8F, 1F);
|
top.setRotationPoint(0F, 8F, 1F);
|
||||||
top.setTextureSize(128, 128);
|
top.setTextureSize(128, 128);
|
||||||
top.mirror = true;
|
top.mirror = true;
|
||||||
setRotation(top, 0F, 0F, 0F);
|
setRotation(top, 0F, 0F, 0F);
|
||||||
bot = new ModelRenderer(this, 0, 97);
|
bot = new ModelRenderer(this, 0, 97);
|
||||||
bot.addBox(-8F, 0F, -6F, 16, 5, 12);
|
bot.addBox(-8F, 0F, -6F, 16, 5, 12);
|
||||||
bot.setRotationPoint(0F, 19F, 2F);
|
bot.setRotationPoint(0F, 19F, 2F);
|
||||||
bot.setTextureSize(128, 128);
|
bot.setTextureSize(128, 128);
|
||||||
bot.mirror = true;
|
bot.mirror = true;
|
||||||
setRotation(bot, 0F, 0F, 0F);
|
setRotation(bot, 0F, 0F, 0F);
|
||||||
tank = new ModelRenderer(this, 58, 81);
|
tank = new ModelRenderer(this, 58, 81);
|
||||||
tank.addBox(-2F, 1F, -8.5F, 5, 5, 1);
|
tank.addBox(-2F, 1F, -8.5F, 5, 5, 1);
|
||||||
tank.setRotationPoint(-3F, 11F, 3F);
|
tank.setRotationPoint(-3F, 11F, 3F);
|
||||||
tank.setTextureSize(128, 128);
|
tank.setTextureSize(128, 128);
|
||||||
tank.mirror = true;
|
tank.mirror = true;
|
||||||
setRotation(tank, 0F, 0F, 0F);
|
setRotation(tank, 0F, 0F, 0F);
|
||||||
tank2 = new ModelRenderer(this, 72, 83);
|
tank2 = new ModelRenderer(this, 72, 83);
|
||||||
tank2.addBox(0F, -1F, -8F, 1, 3, 1);
|
tank2.addBox(0F, -1F, -8F, 1, 3, 1);
|
||||||
tank2.setRotationPoint(0F, 14F, 3F);
|
tank2.setRotationPoint(0F, 14F, 3F);
|
||||||
tank2.setTextureSize(128, 128);
|
tank2.setTextureSize(128, 128);
|
||||||
tank2.mirror = true;
|
tank2.mirror = true;
|
||||||
setRotation(tank2, 0F, 0F, 0F);
|
setRotation(tank2, 0F, 0F, 0F);
|
||||||
tank3 = new ModelRenderer(this, 60, 78);
|
tank3 = new ModelRenderer(this, 60, 78);
|
||||||
tank3.addBox(-1F, 1F, -8F, 3, 1, 1);
|
tank3.addBox(-1F, 1F, -8F, 3, 1, 1);
|
||||||
tank3.setRotationPoint(-3F, 10F, 3F);
|
tank3.setRotationPoint(-3F, 10F, 3F);
|
||||||
tank3.setTextureSize(128, 128);
|
tank3.setTextureSize(128, 128);
|
||||||
tank3.mirror = true;
|
tank3.mirror = true;
|
||||||
setRotation(tank3, 0F, 0F, 0F);
|
setRotation(tank3, 0F, 0F, 0F);
|
||||||
tank4 = new ModelRenderer(this, 60, 88);
|
tank4 = new ModelRenderer(this, 60, 88);
|
||||||
tank4.addBox(-1F, 1F, -8F, 3, 1, 1);
|
tank4.addBox(-1F, 1F, -8F, 3, 1, 1);
|
||||||
tank4.setRotationPoint(-3F, 16F, 3F);
|
tank4.setRotationPoint(-3F, 16F, 3F);
|
||||||
tank4.setTextureSize(128, 128);
|
tank4.setTextureSize(128, 128);
|
||||||
tank4.mirror = true;
|
tank4.mirror = true;
|
||||||
setRotation(tank4, 0F, 0F, 0F);
|
setRotation(tank4, 0F, 0F, 0F);
|
||||||
tank5 = new ModelRenderer(this, 52, 83);
|
tank5 = new ModelRenderer(this, 52, 83);
|
||||||
tank5.addBox(0F, -1F, -8F, 1, 3, 1);
|
tank5.addBox(0F, -1F, -8F, 1, 3, 1);
|
||||||
tank5.setRotationPoint(-6F, 14F, 3F);
|
tank5.setRotationPoint(-6F, 14F, 3F);
|
||||||
tank5.setTextureSize(128, 128);
|
tank5.setTextureSize(128, 128);
|
||||||
tank5.mirror = true;
|
tank5.mirror = true;
|
||||||
setRotation(tank5, 0F, 0F, 0F);
|
setRotation(tank5, 0F, 0F, 0F);
|
||||||
tank6 = new ModelRenderer(this, 37, 81);
|
tank6 = new ModelRenderer(this, 37, 81);
|
||||||
tank6.addBox(-1F, 2F, -8.8F, 3, 3, 1);
|
tank6.addBox(-1F, 2F, -8.8F, 3, 3, 1);
|
||||||
tank6.setRotationPoint(-3F, 11F, 3F);
|
tank6.setRotationPoint(-3F, 11F, 3F);
|
||||||
tank6.setTextureSize(128, 128);
|
tank6.setTextureSize(128, 128);
|
||||||
tank6.mirror = true;
|
tank6.mirror = true;
|
||||||
setRotation(tank6, 0F, 0F, 0F);
|
setRotation(tank6, 0F, 0F, 0F);
|
||||||
face = new ModelRenderer(this, 20, 116);
|
face = new ModelRenderer(this, 20, 116);
|
||||||
face.addBox(-8F, 0F, -6F, 16, 6, 2);
|
face.addBox(-8F, 0F, -6F, 16, 6, 2);
|
||||||
face.setRotationPoint(0F, 18F, 0F);
|
face.setRotationPoint(0F, 18F, 0F);
|
||||||
face.setTextureSize(128, 128);
|
face.setTextureSize(128, 128);
|
||||||
face.mirror = true;
|
face.mirror = true;
|
||||||
setRotation(face, 0F, 0F, 0F);
|
setRotation(face, 0F, 0F, 0F);
|
||||||
grill = new ModelRenderer(this, 44, 56);
|
grill = new ModelRenderer(this, 44, 56);
|
||||||
grill.addBox(0F, 0F, 0F, 1, 5, 1);
|
grill.addBox(0F, 0F, 0F, 1, 5, 1);
|
||||||
grill.setRotationPoint(-7.6F, 18.5F, -7F);
|
grill.setRotationPoint(-7.6F, 18.5F, -7F);
|
||||||
grill.setTextureSize(128, 128);
|
grill.setTextureSize(128, 128);
|
||||||
grill.mirror = true;
|
grill.mirror = true;
|
||||||
setRotation(grill, 0F, 0F, 0F);
|
setRotation(grill, 0F, 0F, 0F);
|
||||||
grill2 = new ModelRenderer(this, 38, 56);
|
grill2 = new ModelRenderer(this, 38, 56);
|
||||||
grill2.addBox(0F, 0F, 0F, 1, 5, 1);
|
grill2.addBox(0F, 0F, 0F, 1, 5, 1);
|
||||||
grill2.setRotationPoint(6.4F, 18.5F, -7F);
|
grill2.setRotationPoint(6.4F, 18.5F, -7F);
|
||||||
grill2.setTextureSize(128, 128);
|
grill2.setTextureSize(128, 128);
|
||||||
grill2.mirror = true;
|
grill2.mirror = true;
|
||||||
setRotation(grill2, 0F, 0F, 0F);
|
setRotation(grill2, 0F, 0F, 0F);
|
||||||
grill3 = new ModelRenderer(this, 0, 49);
|
grill3 = new ModelRenderer(this, 0, 49);
|
||||||
grill3.addBox(0F, 0F, 0F, 13, 1, 1);
|
grill3.addBox(0F, 0F, 0F, 13, 1, 1);
|
||||||
grill3.setRotationPoint(-6.6F, 18.5F, -7F);
|
grill3.setRotationPoint(-6.6F, 18.5F, -7F);
|
||||||
grill3.setTextureSize(128, 128);
|
grill3.setTextureSize(128, 128);
|
||||||
grill3.mirror = true;
|
grill3.mirror = true;
|
||||||
setRotation(grill3, 0F, 0F, 0F);
|
setRotation(grill3, 0F, 0F, 0F);
|
||||||
grill4 = new ModelRenderer(this, 0, 52);
|
grill4 = new ModelRenderer(this, 0, 52);
|
||||||
grill4.addBox(0F, 0F, 0F, 13, 1, 1);
|
grill4.addBox(0F, 0F, 0F, 13, 1, 1);
|
||||||
grill4.setRotationPoint(-6.6F, 22.5F, -7F);
|
grill4.setRotationPoint(-6.6F, 22.5F, -7F);
|
||||||
grill4.setTextureSize(128, 128);
|
grill4.setTextureSize(128, 128);
|
||||||
grill4.mirror = true;
|
grill4.mirror = true;
|
||||||
setRotation(grill4, 0F, 0F, 0F);
|
setRotation(grill4, 0F, 0F, 0F);
|
||||||
grill5 = new ModelRenderer(this, 0, 56);
|
grill5 = new ModelRenderer(this, 0, 56);
|
||||||
grill5.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill5.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill5.setRotationPoint(-6.6F, 19.5F, -6F);
|
grill5.setRotationPoint(-6.6F, 19.5F, -6F);
|
||||||
grill5.setTextureSize(128, 128);
|
grill5.setTextureSize(128, 128);
|
||||||
grill5.mirror = true;
|
grill5.mirror = true;
|
||||||
setRotation(grill5, 0F, 0.7853982F, 0F);
|
setRotation(grill5, 0F, 0.7853982F, 0F);
|
||||||
grill6 = new ModelRenderer(this, 0, 56);
|
grill6 = new ModelRenderer(this, 0, 56);
|
||||||
grill6.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill6.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill6.setRotationPoint(5F, 19.5F, -6F);
|
grill6.setRotationPoint(5F, 19.5F, -6F);
|
||||||
grill6.setTextureSize(128, 128);
|
grill6.setTextureSize(128, 128);
|
||||||
grill6.mirror = true;
|
grill6.mirror = true;
|
||||||
setRotation(grill6, 0F, 0.7853982F, 0F);
|
setRotation(grill6, 0F, 0.7853982F, 0F);
|
||||||
grill7 = new ModelRenderer(this, 0, 56);
|
grill7 = new ModelRenderer(this, 0, 56);
|
||||||
grill7.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill7.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill7.setRotationPoint(4F, 19.5F, -6F);
|
grill7.setRotationPoint(4F, 19.5F, -6F);
|
||||||
grill7.setTextureSize(128, 128);
|
grill7.setTextureSize(128, 128);
|
||||||
grill7.mirror = true;
|
grill7.mirror = true;
|
||||||
setRotation(grill7, 0F, 0.7853982F, 0F);
|
setRotation(grill7, 0F, 0.7853982F, 0F);
|
||||||
grill8 = new ModelRenderer(this, 0, 56);
|
grill8 = new ModelRenderer(this, 0, 56);
|
||||||
grill8.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill8.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill8.setRotationPoint(3F, 19.5F, -6F);
|
grill8.setRotationPoint(3F, 19.5F, -6F);
|
||||||
grill8.setTextureSize(128, 128);
|
grill8.setTextureSize(128, 128);
|
||||||
grill8.mirror = true;
|
grill8.mirror = true;
|
||||||
setRotation(grill8, 0F, 0.7853982F, 0F);
|
setRotation(grill8, 0F, 0.7853982F, 0F);
|
||||||
grill9 = new ModelRenderer(this, 0, 56);
|
grill9 = new ModelRenderer(this, 0, 56);
|
||||||
grill9.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill9.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill9.setRotationPoint(2F, 19.5F, -6F);
|
grill9.setRotationPoint(2F, 19.5F, -6F);
|
||||||
grill9.setTextureSize(128, 128);
|
grill9.setTextureSize(128, 128);
|
||||||
grill9.mirror = true;
|
grill9.mirror = true;
|
||||||
setRotation(grill9, 0F, 0.7853982F, 0F);
|
setRotation(grill9, 0F, 0.7853982F, 0F);
|
||||||
grill10 = new ModelRenderer(this, 0, 56);
|
grill10 = new ModelRenderer(this, 0, 56);
|
||||||
grill10.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill10.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill10.setRotationPoint(-5.6F, 19.5F, -6F);
|
grill10.setRotationPoint(-5.6F, 19.5F, -6F);
|
||||||
grill10.setTextureSize(128, 128);
|
grill10.setTextureSize(128, 128);
|
||||||
grill10.mirror = true;
|
grill10.mirror = true;
|
||||||
setRotation(grill10, 0F, 0.7853982F, 0F);
|
setRotation(grill10, 0F, 0.7853982F, 0F);
|
||||||
grill11 = new ModelRenderer(this, 0, 56);
|
grill11 = new ModelRenderer(this, 0, 56);
|
||||||
grill11.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill11.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill11.setRotationPoint(-4.6F, 19.5F, -6F);
|
grill11.setRotationPoint(-4.6F, 19.5F, -6F);
|
||||||
grill11.setTextureSize(128, 128);
|
grill11.setTextureSize(128, 128);
|
||||||
grill11.mirror = true;
|
grill11.mirror = true;
|
||||||
setRotation(grill11, 0F, 0.7853982F, 0F);
|
setRotation(grill11, 0F, 0.7853982F, 0F);
|
||||||
grill12 = new ModelRenderer(this, 0, 56);
|
grill12 = new ModelRenderer(this, 0, 56);
|
||||||
grill12.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill12.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill12.setRotationPoint(-3.6F, 19.5F, -6F);
|
grill12.setRotationPoint(-3.6F, 19.5F, -6F);
|
||||||
grill12.setTextureSize(128, 128);
|
grill12.setTextureSize(128, 128);
|
||||||
grill12.mirror = true;
|
grill12.mirror = true;
|
||||||
setRotation(grill12, 0F, 0.7853982F, 0F);
|
setRotation(grill12, 0F, 0.7853982F, 0F);
|
||||||
grill13 = new ModelRenderer(this, 0, 56);
|
grill13 = new ModelRenderer(this, 0, 56);
|
||||||
grill13.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill13.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill13.setRotationPoint(-2.6F, 19.5F, -6F);
|
grill13.setRotationPoint(-2.6F, 19.5F, -6F);
|
||||||
grill13.setTextureSize(128, 128);
|
grill13.setTextureSize(128, 128);
|
||||||
grill13.mirror = true;
|
grill13.mirror = true;
|
||||||
setRotation(grill13, 0F, 0.7853982F, 0F);
|
setRotation(grill13, 0F, 0.7853982F, 0F);
|
||||||
grill14 = new ModelRenderer(this, 0, 56);
|
grill14 = new ModelRenderer(this, 0, 56);
|
||||||
grill14.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill14.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill14.setRotationPoint(-1.6F, 19.5F, -6F);
|
grill14.setRotationPoint(-1.6F, 19.5F, -6F);
|
||||||
grill14.setTextureSize(128, 128);
|
grill14.setTextureSize(128, 128);
|
||||||
grill14.mirror = true;
|
grill14.mirror = true;
|
||||||
setRotation(grill14, 0F, 0.7853982F, 0F);
|
setRotation(grill14, 0F, 0.7853982F, 0F);
|
||||||
grill15 = new ModelRenderer(this, 0, 56);
|
grill15 = new ModelRenderer(this, 0, 56);
|
||||||
grill15.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill15.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill15.setRotationPoint(1F, 19.5F, -6F);
|
grill15.setRotationPoint(1F, 19.5F, -6F);
|
||||||
grill15.setTextureSize(128, 128);
|
grill15.setTextureSize(128, 128);
|
||||||
grill15.mirror = true;
|
grill15.mirror = true;
|
||||||
setRotation(grill15, 0F, 0.7853982F, 0F);
|
setRotation(grill15, 0F, 0.7853982F, 0F);
|
||||||
grill16 = new ModelRenderer(this, 0, 56);
|
grill16 = new ModelRenderer(this, 0, 56);
|
||||||
grill16.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill16.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill16.setRotationPoint(0F, 19.5F, -6F);
|
grill16.setRotationPoint(0F, 19.5F, -6F);
|
||||||
grill16.setTextureSize(128, 128);
|
grill16.setTextureSize(128, 128);
|
||||||
grill16.mirror = true;
|
grill16.mirror = true;
|
||||||
setRotation(grill16, 0F, 0.7853982F, 0F);
|
setRotation(grill16, 0F, 0.7853982F, 0F);
|
||||||
grill17 = new ModelRenderer(this, 0, 56);
|
grill17 = new ModelRenderer(this, 0, 56);
|
||||||
grill17.addBox(0F, 0F, 0F, 1, 3, 1);
|
grill17.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||||
grill17.setRotationPoint(-0.8F, 19.5F, -6F);
|
grill17.setRotationPoint(-0.8F, 19.5F, -6F);
|
||||||
grill17.setTextureSize(128, 128);
|
grill17.setTextureSize(128, 128);
|
||||||
grill17.mirror = true;
|
grill17.mirror = true;
|
||||||
setRotation(grill17, 0F, 0.7853982F, 0F);
|
setRotation(grill17, 0F, 0.7853982F, 0F);
|
||||||
pipe = new ModelRenderer(this, 0, 76);
|
pipe = new ModelRenderer(this, 0, 76);
|
||||||
pipe.addBox(0F, -1F, -8.35F, 8, 1, 1);
|
pipe.addBox(0F, -1F, -8.35F, 8, 1, 1);
|
||||||
pipe.setRotationPoint(0F, 14F, 3F);
|
pipe.setRotationPoint(0F, 14F, 3F);
|
||||||
pipe.setTextureSize(128, 128);
|
pipe.setTextureSize(128, 128);
|
||||||
pipe.mirror = true;
|
pipe.mirror = true;
|
||||||
setRotation(pipe, 0F, 0F, 0F);
|
setRotation(pipe, 0F, 0F, 0F);
|
||||||
pipe2 = new ModelRenderer(this, 0, 81);
|
pipe2 = new ModelRenderer(this, 0, 81);
|
||||||
pipe2.addBox(0F, -1F, -8.35F, 1, 1, 8);
|
pipe2.addBox(0F, -1F, -8.35F, 1, 1, 8);
|
||||||
pipe2.setRotationPoint(7F, 14F, 4F);
|
pipe2.setRotationPoint(7F, 14F, 4F);
|
||||||
pipe2.setTextureSize(128, 128);
|
pipe2.setTextureSize(128, 128);
|
||||||
pipe2.mirror = true;
|
pipe2.mirror = true;
|
||||||
setRotation(pipe2, 0F, 0F, 0F);
|
setRotation(pipe2, 0F, 0F, 0F);
|
||||||
pipe3 = new ModelRenderer(this, 21, 81);
|
pipe3 = new ModelRenderer(this, 21, 81);
|
||||||
pipe3.addBox(0F, -1F, -8.35F, 1, 3, 1);
|
pipe3.addBox(0F, -1F, -8.35F, 1, 3, 1);
|
||||||
pipe3.setRotationPoint(7F, 11F, 11F);
|
pipe3.setRotationPoint(7F, 11F, 11F);
|
||||||
pipe3.setTextureSize(128, 128);
|
pipe3.setTextureSize(128, 128);
|
||||||
pipe3.mirror = true;
|
pipe3.mirror = true;
|
||||||
setRotation(pipe3, 0F, 0F, 0F);
|
setRotation(pipe3, 0F, 0F, 0F);
|
||||||
pipe4 = new ModelRenderer(this, 15, 59);
|
pipe4 = new ModelRenderer(this, 15, 59);
|
||||||
pipe4.addBox(0F, 0F, 0F, 1, 10, 1);
|
pipe4.addBox(0F, 0F, 0F, 1, 10, 1);
|
||||||
pipe4.setRotationPoint(4.4F, 9.5F, -4.8F);
|
pipe4.setRotationPoint(4.4F, 9.5F, -4.8F);
|
||||||
pipe4.setTextureSize(128, 128);
|
pipe4.setTextureSize(128, 128);
|
||||||
pipe4.mirror = true;
|
pipe4.mirror = true;
|
||||||
setRotation(pipe4, 0F, 0F, 0F);
|
setRotation(pipe4, 0F, 0F, 0F);
|
||||||
gauge = new ModelRenderer(this, 61, 56);
|
gauge = new ModelRenderer(this, 61, 56);
|
||||||
gauge.addBox(0F, 0F, 0F, 3, 3, 1);
|
gauge.addBox(0F, 0F, 0F, 3, 3, 1);
|
||||||
gauge.setRotationPoint(1.4F, 14.5F, -5F);
|
gauge.setRotationPoint(1.4F, 14.5F, -5F);
|
||||||
gauge.setTextureSize(128, 128);
|
gauge.setTextureSize(128, 128);
|
||||||
gauge.mirror = true;
|
gauge.mirror = true;
|
||||||
setRotation(gauge, 0F, 0F, 0F);
|
setRotation(gauge, 0F, 0F, 0F);
|
||||||
gaugeNeedle = new ModelRenderer(this, 56, 56);
|
gaugeNeedle = new ModelRenderer(this, 56, 56);
|
||||||
gaugeNeedle.addBox(0F, -2F, 0F, 1, 3, 0);
|
gaugeNeedle.addBox(0F, -2F, 0F, 1, 3, 0);
|
||||||
gaugeNeedle.setRotationPoint(2.4F, 16.5F, -5.1F);
|
gaugeNeedle.setRotationPoint(2.4F, 16.5F, -5.1F);
|
||||||
gaugeNeedle.setTextureSize(128, 128);
|
gaugeNeedle.setTextureSize(128, 128);
|
||||||
gaugeNeedle.mirror = true;
|
gaugeNeedle.mirror = true;
|
||||||
setRotation(gaugeNeedle, 0F, 0F, 0F);
|
setRotation(gaugeNeedle, 0F, 0F, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
@Override
|
||||||
{
|
public void render(float f5)
|
||||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
{
|
||||||
setRotationAngles(f, f1, f2, f3, f4, f5);
|
body.render(f5);
|
||||||
body.render(f5);
|
top.render(f5);
|
||||||
top.render(f5);
|
bot.render(f5);
|
||||||
bot.render(f5);
|
tank.render(f5);
|
||||||
tank.render(f5);
|
tank2.render(f5);
|
||||||
tank2.render(f5);
|
tank3.render(f5);
|
||||||
tank3.render(f5);
|
tank4.render(f5);
|
||||||
tank4.render(f5);
|
tank5.render(f5);
|
||||||
tank5.render(f5);
|
tank6.render(f5);
|
||||||
tank6.render(f5);
|
face.render(f5);
|
||||||
face.render(f5);
|
grill.render(f5);
|
||||||
grill.render(f5);
|
grill2.render(f5);
|
||||||
grill2.render(f5);
|
grill3.render(f5);
|
||||||
grill3.render(f5);
|
grill4.render(f5);
|
||||||
grill4.render(f5);
|
grill5.render(f5);
|
||||||
grill5.render(f5);
|
grill6.render(f5);
|
||||||
grill6.render(f5);
|
grill7.render(f5);
|
||||||
grill7.render(f5);
|
grill8.render(f5);
|
||||||
grill8.render(f5);
|
grill9.render(f5);
|
||||||
grill9.render(f5);
|
grill10.render(f5);
|
||||||
grill10.render(f5);
|
grill11.render(f5);
|
||||||
grill11.render(f5);
|
grill12.render(f5);
|
||||||
grill12.render(f5);
|
grill13.render(f5);
|
||||||
grill13.render(f5);
|
grill14.render(f5);
|
||||||
grill14.render(f5);
|
grill15.render(f5);
|
||||||
grill15.render(f5);
|
grill16.render(f5);
|
||||||
grill16.render(f5);
|
grill17.render(f5);
|
||||||
grill17.render(f5);
|
pipe.render(f5);
|
||||||
pipe.render(f5);
|
pipe2.render(f5);
|
||||||
pipe2.render(f5);
|
pipe3.render(f5);
|
||||||
pipe3.render(f5);
|
pipe4.render(f5);
|
||||||
pipe4.render(f5);
|
gauge.render(f5);
|
||||||
gauge.render(f5);
|
gaugeNeedle.render(f5);
|
||||||
gaugeNeedle.render(f5);
|
}
|
||||||
}
|
|
||||||
|
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
{
|
||||||
{
|
model.rotateAngleX = x;
|
||||||
model.rotateAngleX = x;
|
model.rotateAngleY = y;
|
||||||
model.rotateAngleY = y;
|
model.rotateAngleZ = z;
|
||||||
model.rotateAngleZ = z;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
|
|
||||||
{
|
|
||||||
super.setRotationAngles(f, f1, f2, f3, f4, f5);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
public class ModelCoalGenerator extends ModelMachine
|
public class ModelSteamTurbine extends ModelMachine
|
||||||
{
|
{
|
||||||
//fields
|
//fields
|
||||||
ModelRenderer base;
|
ModelRenderer base;
|
||||||
|
@ -36,7 +36,7 @@ public class ModelCoalGenerator extends ModelMachine
|
||||||
ModelRenderer gaugeFrame3;
|
ModelRenderer gaugeFrame3;
|
||||||
ModelRenderer gaugeDieal;
|
ModelRenderer gaugeDieal;
|
||||||
|
|
||||||
public ModelCoalGenerator()
|
public ModelSteamTurbine()
|
||||||
{
|
{
|
||||||
textureWidth = 256;
|
textureWidth = 256;
|
||||||
textureHeight = 256;
|
textureHeight = 256;
|
|
@ -8,25 +8,24 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import dark.core.client.models.ModelCoalGenerator;
|
import dark.core.client.models.ModelSteamGen;
|
||||||
|
import dark.core.client.models.ModelSteamTurbine;
|
||||||
import dark.core.client.models.ModelElecFurnace;
|
import dark.core.client.models.ModelElecFurnace;
|
||||||
import dark.core.client.models.ModelMachine;
|
import dark.core.client.models.ModelMachine;
|
||||||
import dark.core.common.DarkMain;
|
import dark.core.common.DarkMain;
|
||||||
|
import dark.core.common.machines.BlockBasicMachine;
|
||||||
import dark.core.prefab.ModPrefab;
|
import dark.core.prefab.ModPrefab;
|
||||||
import dark.core.prefab.machine.TileEntityMachine;
|
import dark.core.prefab.machine.TileEntityMachine;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderBasicMachine extends RenderTileMachine
|
public class RenderBasicMachine extends RenderTileMachine
|
||||||
{
|
{
|
||||||
public static final ModelCoalGenerator COAL_GEN_MODEL = new ModelCoalGenerator();
|
public static final ModelSteamTurbine TURBINE_MODEL = new ModelSteamTurbine();
|
||||||
public static final ModelElecFurnace ELEC_FURNACE_MODEL = new ModelElecFurnace();
|
public static final ModelSteamGen COAL_GEN_MODEL = new ModelSteamGen();
|
||||||
|
|
||||||
public static final ResourceLocation COAL_GEN_TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, ModPrefab.MODEL_DIRECTORY + "CoalGenerator.png");
|
public static final ResourceLocation TURBINE_TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, ModPrefab.MODEL_DIRECTORY + "SmallSteamFan.png");
|
||||||
public static final ResourceLocation FUEL_GEN_TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, ModPrefab.MODEL_DIRECTORY + ".png");
|
public static final ResourceLocation COAL_GEN_TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, ModPrefab.MODEL_DIRECTORY + "SteamGenerator.png");
|
||||||
public static final ResourceLocation ELEC_FURNACE_TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, ModPrefab.MODEL_DIRECTORY + "ElecFurnace.png");
|
|
||||||
public static final ResourceLocation BAT_BOX_TEXTURE = new ResourceLocation(DarkMain.getInstance().DOMAIN, ModPrefab.MODEL_DIRECTORY + ".png");
|
|
||||||
private static float rot1 = 0;
|
private static float rot1 = 0;
|
||||||
private static float rot2 = 45;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderModel(TileEntity tileEntity, double x, double y, double z, float size)
|
public void renderModel(TileEntity tileEntity, double x, double y, double z, float size)
|
||||||
|
@ -36,7 +35,6 @@ public class RenderBasicMachine extends RenderTileMachine
|
||||||
int type = meta / 4;
|
int type = meta / 4;
|
||||||
|
|
||||||
rot1 = MathHelper.wrapAngleTo180_float(rot1 + 1);
|
rot1 = MathHelper.wrapAngleTo180_float(rot1 + 1);
|
||||||
rot2 = MathHelper.wrapAngleTo180_float(rot1 + 2);
|
|
||||||
ModelMachine model = null;
|
ModelMachine model = null;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -45,12 +43,14 @@ public class RenderBasicMachine extends RenderTileMachine
|
||||||
model = COAL_GEN_MODEL;
|
model = COAL_GEN_MODEL;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
bindTexture(COAL_GEN_TEXTURE);
|
||||||
|
model = COAL_GEN_MODEL;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
bindTexture(TURBINE_TEXTURE);
|
||||||
|
model = TURBINE_MODEL;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
bindTexture(ELEC_FURNACE_TEXTURE);
|
|
||||||
model = ELEC_FURNACE_MODEL;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,13 +76,13 @@ public class RenderBasicMachine extends RenderTileMachine
|
||||||
model.render(0.0625F);
|
model.render(0.0625F);
|
||||||
if (tileEntity instanceof TileEntityMachine)
|
if (tileEntity instanceof TileEntityMachine)
|
||||||
{
|
{
|
||||||
if (model instanceof ModelCoalGenerator)
|
if (model instanceof ModelSteamTurbine)
|
||||||
{
|
{
|
||||||
if (((TileEntityMachine) tileEntity).isFunctioning())
|
if (((TileEntityMachine) tileEntity).isFunctioning())
|
||||||
{
|
{
|
||||||
GL11.glRotatef(this.rot1, 0f, 1f, 0f);
|
GL11.glRotatef(this.rot1, 0f, 1f, 0f);
|
||||||
}
|
}
|
||||||
((ModelCoalGenerator) model).renderFan(0.0625F);
|
((ModelSteamTurbine) model).renderFan(0.0625F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -7,12 +7,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
import dark.core.common.machines.ContainerBatteryBox;
|
|
||||||
import dark.core.common.machines.ContainerCoalGenerator;
|
import dark.core.common.machines.ContainerCoalGenerator;
|
||||||
import dark.core.common.machines.ContainerElectricFurnace;
|
import dark.core.common.machines.TileEntitySteamGen;
|
||||||
import dark.core.common.machines.TileEntityBatteryBox;
|
|
||||||
import dark.core.common.machines.TileEntityBasicGenerator;
|
|
||||||
import dark.core.common.machines.TileEntityElectricFurnace;
|
|
||||||
import dark.core.network.PacketManagerEffects;
|
import dark.core.network.PacketManagerEffects;
|
||||||
|
|
||||||
public class CommonProxy implements IGuiHandler
|
public class CommonProxy implements IGuiHandler
|
||||||
|
@ -63,17 +59,9 @@ public class CommonProxy implements IGuiHandler
|
||||||
|
|
||||||
if (tileEntity != null)
|
if (tileEntity != null)
|
||||||
{
|
{
|
||||||
if (tileEntity instanceof TileEntityBatteryBox)
|
if (tileEntity instanceof TileEntitySteamGen)
|
||||||
{
|
{
|
||||||
return new ContainerBatteryBox(player.inventory, ((TileEntityBatteryBox) tileEntity));
|
return new ContainerCoalGenerator(player.inventory, ((TileEntitySteamGen) tileEntity));
|
||||||
}
|
|
||||||
else if (tileEntity instanceof TileEntityBasicGenerator)
|
|
||||||
{
|
|
||||||
return new ContainerCoalGenerator(player.inventory, ((TileEntityBasicGenerator) tileEntity));
|
|
||||||
}
|
|
||||||
else if (tileEntity instanceof TileEntityElectricFurnace)
|
|
||||||
{
|
|
||||||
return new ContainerElectricFurnace(player.inventory, ((TileEntityElectricFurnace) tileEntity));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,15 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import universalelectricity.core.UniversalElectricity;
|
import universalelectricity.core.UniversalElectricity;
|
||||||
|
|
||||||
import com.builtbroken.common.Pair;
|
import com.builtbroken.common.Pair;
|
||||||
|
@ -25,22 +21,13 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import dark.core.client.renders.BlockRenderingHandler;
|
import dark.core.client.renders.BlockRenderingHandler;
|
||||||
import dark.core.client.renders.RenderBasicMachine;
|
import dark.core.client.renders.RenderBasicMachine;
|
||||||
import dark.core.common.CommonProxy;
|
|
||||||
import dark.core.common.DMCreativeTab;
|
import dark.core.common.DMCreativeTab;
|
||||||
import dark.core.common.DarkMain;
|
|
||||||
import dark.core.helpers.MathHelper;
|
import dark.core.helpers.MathHelper;
|
||||||
import dark.core.prefab.machine.BlockMachine;
|
import dark.core.prefab.machine.BlockMachine;
|
||||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||||
|
|
||||||
public class BlockBasicMachine extends BlockMachine
|
public class BlockBasicMachine extends BlockMachine
|
||||||
{
|
{
|
||||||
private Icon iconMachineSide;
|
|
||||||
private Icon iconInput;
|
|
||||||
private Icon iconOutput;
|
|
||||||
|
|
||||||
private Icon iconCoalGenerator;
|
|
||||||
private Icon iconBatteryBox;
|
|
||||||
private Icon iconElectricFurnace;
|
|
||||||
|
|
||||||
public BlockBasicMachine()
|
public BlockBasicMachine()
|
||||||
{
|
{
|
||||||
|
@ -48,129 +35,13 @@ public class BlockBasicMachine extends BlockMachine
|
||||||
this.setStepSound(soundMetalFootstep);
|
this.setStepSound(soundMetalFootstep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
|
||||||
{
|
|
||||||
this.blockIcon = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "machine");
|
|
||||||
this.iconInput = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "machine_input");
|
|
||||||
this.iconOutput = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "machine_output");
|
|
||||||
|
|
||||||
this.iconMachineSide = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "machine_side");
|
|
||||||
this.iconCoalGenerator = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "coalGenerator");
|
|
||||||
this.iconBatteryBox = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "batteryBox");
|
|
||||||
this.iconElectricFurnace = par1IconRegister.registerIcon(DarkMain.getInstance().PREFIX + "electricFurnace");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Icon getIcon(int side, int metadata)
|
|
||||||
{
|
|
||||||
if (side == 0 || side == 1)
|
|
||||||
{
|
|
||||||
return this.blockIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (metadata >= BasicMachineData.ELECTRIC_FURNACE.startMeta)
|
|
||||||
{
|
|
||||||
metadata -= BasicMachineData.ELECTRIC_FURNACE.startMeta;
|
|
||||||
|
|
||||||
// If it is the front side
|
|
||||||
if (side == metadata + 2)
|
|
||||||
{
|
|
||||||
return this.iconInput;
|
|
||||||
}
|
|
||||||
// If it is the back side
|
|
||||||
else if (side == ForgeDirection.getOrientation(metadata + 2).getOpposite().ordinal())
|
|
||||||
{
|
|
||||||
return this.iconElectricFurnace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (metadata >= BasicMachineData.BATTERY_BOX.startMeta)
|
|
||||||
{
|
|
||||||
metadata -= BasicMachineData.BATTERY_BOX.startMeta;
|
|
||||||
|
|
||||||
// If it is the front side
|
|
||||||
if (side == metadata + 2)
|
|
||||||
{
|
|
||||||
return this.iconOutput;
|
|
||||||
}
|
|
||||||
// If it is the back side
|
|
||||||
else if (side == ForgeDirection.getOrientation(metadata + 2).getOpposite().ordinal())
|
|
||||||
{
|
|
||||||
return this.iconInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.iconBatteryBox;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If it is the front side
|
|
||||||
if (side == metadata + 2)
|
|
||||||
{
|
|
||||||
return this.iconOutput;
|
|
||||||
}
|
|
||||||
// If it is the back side
|
|
||||||
else if (side == ForgeDirection.getOrientation(metadata + 2).getOpposite().ordinal())
|
|
||||||
{
|
|
||||||
return this.iconCoalGenerator;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.iconMachineSide;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
||||||
{
|
{
|
||||||
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
||||||
int metadata = world.getBlockMetadata(x, y, z);
|
int metadata = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
int angle = MathHelper.floor_double((entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
int angle = MathHelper.floor_double((entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||||
int change = 0;
|
world.setBlockMetadataWithNotify(x, y, z, (metadata / 4) + angle, 3);
|
||||||
|
|
||||||
switch (angle)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
change = 1;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
change = 2;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
change = 0;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
change = 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (metadata >= BasicMachineData.ELECTRIC_FURNACE.startMeta)
|
|
||||||
{
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, BasicMachineData.ELECTRIC_FURNACE.startMeta + change, 3);
|
|
||||||
}
|
|
||||||
else if (metadata >= BasicMachineData.BATTERY_BOX.startMeta)
|
|
||||||
{
|
|
||||||
switch (angle)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
change = 3;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
change = 1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
change = 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
change = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, BasicMachineData.BATTERY_BOX.startMeta + change, 3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, BasicMachineData.STEAM_FAN.startMeta + change, 3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -178,10 +49,10 @@ public class BlockBasicMachine extends BlockMachine
|
||||||
{
|
{
|
||||||
TileEntity tile = par1World.getBlockTileEntity(x, y, z);
|
TileEntity tile = par1World.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
if (tile instanceof TileEntityBasicGenerator)
|
if (tile instanceof TileEntitySteamGen)
|
||||||
{
|
{
|
||||||
TileEntityBasicGenerator tileEntity = (TileEntityBasicGenerator) tile;
|
TileEntitySteamGen tileEntity = (TileEntitySteamGen) tile;
|
||||||
if (tileEntity.generateWatts > 0)
|
if (tileEntity.isFunctioning())
|
||||||
{
|
{
|
||||||
int face = par1World.getBlockMetadata(x, y, z) % 4;
|
int face = par1World.getBlockMetadata(x, y, z) % 4;
|
||||||
float xx = x + 0.5F;
|
float xx = x + 0.5F;
|
||||||
|
@ -232,18 +103,16 @@ public class BlockBasicMachine extends BlockMachine
|
||||||
@Override
|
@Override
|
||||||
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
|
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
|
||||||
{
|
{
|
||||||
for (BasicMachineData data : BasicMachineData.values())
|
list.add(new Pair<String, Class<? extends TileEntity>>("DCTileSteamFan", TileEntitySteamFan.class));
|
||||||
{
|
list.add(new Pair<String, Class<? extends TileEntity>>("DCTileSteamPiston", TileEntitySteamPiston.class));
|
||||||
list.add(new Pair<String, Class<? extends TileEntity>>("DC" + data.unlocalizedName, data.clazz));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list)
|
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list)
|
||||||
{
|
{
|
||||||
list.add(new Pair(TileEntityBasicGenerator.class, new RenderBasicMachine()));
|
list.add(new Pair(TileEntitySteamPiston.class, new RenderBasicMachine()));
|
||||||
list.add(new Pair(TileEntityElectricFurnace.class, new RenderBasicMachine()));
|
list.add(new Pair(TileEntitySteamFan.class, new RenderBasicMachine()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -256,12 +125,6 @@ public class BlockBasicMachine extends BlockMachine
|
||||||
@Override
|
@Override
|
||||||
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!par1World.isRemote)
|
|
||||||
{
|
|
||||||
par5EntityPlayer.openGui(DarkMain.getInstance(), BasicMachineData.values()[par1World.getBlockMetadata(x, y, z) / 4].guiID, par1World, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,15 +149,19 @@ public class BlockBasicMachine extends BlockMachine
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, int metadata)
|
public TileEntity createTileEntity(World world, int metadata)
|
||||||
{
|
{
|
||||||
try
|
switch (metadata / 4)
|
||||||
{
|
{
|
||||||
return BasicMachineData.values()[metadata / 4].clazz.newInstance();
|
case 0:
|
||||||
|
return new TileEntitySteamFan();
|
||||||
|
case 1:
|
||||||
|
return new TileEntitySteamPiston();
|
||||||
|
case 2:
|
||||||
|
return new TileEntitySteamFan();
|
||||||
|
case 3:
|
||||||
|
return new TileEntitySteamFan();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
return super.createTileEntity(world, metadata);
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,28 +184,4 @@ public class BlockBasicMachine extends BlockMachine
|
||||||
{
|
{
|
||||||
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z) / 4);
|
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z) / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum BasicMachineData
|
|
||||||
{
|
|
||||||
/** Procures power from steam returning extra water back to the steam generator bellow it */
|
|
||||||
STEAM_FAN("steamfan", 0, CommonProxy.GUI_COAL_GEN, TileEntityBasicGenerator.class),
|
|
||||||
/** Procures power from steam returning extra water back to the steam generator bellow it */
|
|
||||||
STEAM_PISTON("steampiston", 4, CommonProxy.GUI_FUEL_GEN, TileEntityBasicGenerator.class),
|
|
||||||
BATTERY_BOX("batterybox", 8, CommonProxy.GUI_BATTERY_BOX, TileEntityBatteryBox.class),
|
|
||||||
ELECTRIC_FURNACE("electricfurnace", 12, CommonProxy.GUI_FURNACE_ELEC, TileEntityElectricFurnace.class);
|
|
||||||
|
|
||||||
public String unlocalizedName;
|
|
||||||
public int startMeta, guiID;
|
|
||||||
public boolean enabled = true;
|
|
||||||
public boolean allowCrafting = true;
|
|
||||||
public Class<? extends TileEntity> clazz;
|
|
||||||
|
|
||||||
private BasicMachineData(String name, int meta, int guiID, Class<? extends TileEntity> clazz)
|
|
||||||
{
|
|
||||||
this.unlocalizedName = name;
|
|
||||||
this.startMeta = meta;
|
|
||||||
this.guiID = guiID;
|
|
||||||
this.clazz = clazz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -135,9 +135,9 @@ public class BlockHeater extends BlockMachine
|
||||||
|
|
||||||
public static enum HeatMachineData
|
public static enum HeatMachineData
|
||||||
{
|
{
|
||||||
HEAT_COUPLE("themalcouple", 0, CommonProxy.GUI_COAL_GEN, TileEntityBasicGenerator.class),
|
HEAT_COUPLE("themalcouple", 0, CommonProxy.GUI_COAL_GEN, TileEntitySteamGen.class),
|
||||||
HEAT_EXCHANGE("heatexchanger", 4, CommonProxy.GUI_FUEL_GEN, TileEntityBasicGenerator.class),
|
HEAT_EXCHANGE("heatexchanger", 4, CommonProxy.GUI_FUEL_GEN, TileEntitySteamGen.class),
|
||||||
HEAT_PLATE("heatplate", 8, CommonProxy.GUI_BATTERY_BOX, TileEntityBatteryBox.class);
|
HEAT_PLATE("heatplate", 8, CommonProxy.GUI_BATTERY_BOX, null);
|
||||||
|
|
||||||
public String unlocalizedName;
|
public String unlocalizedName;
|
||||||
public int startMeta, guiID;
|
public int startMeta, guiID;
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
package dark.core.common.machines;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import universalelectricity.core.item.IItemElectric;
|
|
||||||
import universalelectricity.prefab.SlotSpecific;
|
|
||||||
|
|
||||||
public class ContainerBatteryBox extends Container
|
|
||||||
{
|
|
||||||
private TileEntityBatteryBox tileEntity;
|
|
||||||
|
|
||||||
public ContainerBatteryBox(InventoryPlayer par1InventoryPlayer, TileEntityBatteryBox batteryBox)
|
|
||||||
{
|
|
||||||
this.tileEntity = batteryBox;
|
|
||||||
// Top slot for battery output
|
|
||||||
this.addSlotToContainer(new SlotSpecific(batteryBox, 0, 33, 24, IItemElectric.class));
|
|
||||||
// Bottom slot for batter input
|
|
||||||
this.addSlotToContainer(new SlotSpecific(batteryBox, 1, 33, 48, IItemElectric.class));
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onContainerClosed(EntityPlayer entityplayer)
|
|
||||||
{
|
|
||||||
super.onContainerClosed(entityplayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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. */
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotID)
|
|
||||||
{
|
|
||||||
ItemStack returnStack = null;
|
|
||||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack())
|
|
||||||
{
|
|
||||||
ItemStack itemStack = slot.getStack();
|
|
||||||
returnStack = itemStack.copy();
|
|
||||||
|
|
||||||
if (slotID != 0 && slotID != 1)
|
|
||||||
{
|
|
||||||
if (this.getSlot(0).isItemValid(itemStack))
|
|
||||||
{
|
|
||||||
if (((IItemElectric) itemStack.getItem()).getElectricityStored(itemStack) > 0)
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(itemStack, 1, 2, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(itemStack, 0, 1, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (slotID >= 30 && slotID < 38 && !this.mergeItemStack(itemStack, 3, 30, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!this.mergeItemStack(itemStack, 3, 38, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemStack.stackSize == 0)
|
|
||||||
{
|
|
||||||
slot.putStack((ItemStack) null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
slot.onSlotChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemStack.stackSize == returnStack.stackSize)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
slot.onPickupFromSlot(par1EntityPlayer, itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,9 +9,9 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ContainerCoalGenerator extends Container
|
public class ContainerCoalGenerator extends Container
|
||||||
{
|
{
|
||||||
private TileEntityBasicGenerator tileEntity;
|
private TileEntitySteamGen tileEntity;
|
||||||
|
|
||||||
public ContainerCoalGenerator(InventoryPlayer par1InventoryPlayer, TileEntityBasicGenerator tileEntity)
|
public ContainerCoalGenerator(InventoryPlayer par1InventoryPlayer, TileEntitySteamGen tileEntity)
|
||||||
{
|
{
|
||||||
this.tileEntity = tileEntity;
|
this.tileEntity = tileEntity;
|
||||||
this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34));
|
this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34));
|
||||||
|
|
|
@ -1,130 +0,0 @@
|
||||||
package dark.core.common.machines;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.inventory.SlotFurnace;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
||||||
import universalelectricity.core.item.IItemElectric;
|
|
||||||
import universalelectricity.prefab.SlotSpecific;
|
|
||||||
|
|
||||||
public class ContainerElectricFurnace extends Container
|
|
||||||
{
|
|
||||||
private TileEntityElectricFurnace tileEntity;
|
|
||||||
|
|
||||||
public ContainerElectricFurnace(InventoryPlayer par1InventoryPlayer, TileEntityElectricFurnace tileEntity)
|
|
||||||
{
|
|
||||||
this.tileEntity = tileEntity;
|
|
||||||
|
|
||||||
// Electric Input Slot
|
|
||||||
this.addSlotToContainer(new SlotSpecific(tileEntity, 0, 55, 49, IItemElectric.class));
|
|
||||||
|
|
||||||
// To be smelted
|
|
||||||
this.addSlotToContainer(new Slot(tileEntity, 1, 55, 25));
|
|
||||||
|
|
||||||
// Smelting result
|
|
||||||
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, tileEntity, 2, 108, 25));
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onContainerClosed(EntityPlayer entityplayer)
|
|
||||||
{
|
|
||||||
super.onContainerClosed(entityplayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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. */
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1)
|
|
||||||
{
|
|
||||||
ItemStack var2 = null;
|
|
||||||
Slot var3 = (Slot) this.inventorySlots.get(par1);
|
|
||||||
|
|
||||||
if (var3 != null && var3.getHasStack())
|
|
||||||
{
|
|
||||||
ItemStack var4 = var3.getStack();
|
|
||||||
var2 = var4.copy();
|
|
||||||
|
|
||||||
if (par1 == 2)
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(var4, 3, 39, true))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var3.onSlotChange(var4, var2);
|
|
||||||
}
|
|
||||||
else if (par1 != 1 && par1 != 0)
|
|
||||||
{
|
|
||||||
if (var4.getItem() instanceof IItemElectric)
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(var4, 0, 1, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (FurnaceRecipes.smelting().getSmeltingResult(var4) != null)
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(var4, 1, 2, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (par1 >= 3 && par1 < 30)
|
|
||||||
{
|
|
||||||
if (!this.mergeItemStack(var4, 30, 39, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (par1 >= 30 && par1 < 39 && !this.mergeItemStack(var4, 3, 30, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!this.mergeItemStack(var4, 3, 39, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var4.stackSize == 0)
|
|
||||||
{
|
|
||||||
var3.putStack((ItemStack) null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var3.onSlotChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var4.stackSize == var2.stackSize)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var3.onPickupFromSlot(par1EntityPlayer, var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
package dark.core.common.machines;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntityFurnace;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import universalelectricity.core.electricity.ElectricityPack;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
||||||
import dark.core.network.PacketHandler;
|
|
||||||
import dark.core.prefab.machine.TileEntityEnergyMachine;
|
|
||||||
|
|
||||||
/** Simple compact generator designed to only power a few machines at a time
|
|
||||||
*
|
|
||||||
* @author DarkGuardsman */
|
|
||||||
public class TileEntityBasicGenerator extends TileEntityEnergyMachine
|
|
||||||
{
|
|
||||||
/** Maximum amount of energy needed to generate electricity */
|
|
||||||
public static float MAX_GENERATE_WATTS = 0.5f;
|
|
||||||
|
|
||||||
/** Amount of heat the coal generator needs before generating electricity. */
|
|
||||||
public static final float MIN_GENERATE_WATTS = MAX_GENERATE_WATTS * 0.1f;
|
|
||||||
|
|
||||||
private static float BASE_ACCELERATION = 0.000001f;
|
|
||||||
private static float BASE_DECCELERATION = 0.008f;
|
|
||||||
|
|
||||||
/** Per second */
|
|
||||||
public float generateWatts = 0;
|
|
||||||
|
|
||||||
/** The number of ticks that a fresh copy of the currently-burning item would keep the furnace
|
|
||||||
* burning for */
|
|
||||||
public int itemCookTime = 0;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
if (!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
//Consume item if cook time is too low
|
|
||||||
if (this.getInventory().getStackInSlot(0) != null && this.itemCookTime <= 10)
|
|
||||||
{
|
|
||||||
if (TileEntityFurnace.isItemFuel(this.getInventory().getStackInSlot(0)))
|
|
||||||
{
|
|
||||||
this.itemCookTime += TileEntityFurnace.getItemBurnTime(this.getInventory().getStackInSlot(0));
|
|
||||||
this.decrStackSize(0, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update item cook time & power output
|
|
||||||
if (this.itemCookTime-- > 0)
|
|
||||||
{
|
|
||||||
this.generateWatts = Math.min(this.generateWatts + Math.min((this.generateWatts * 0.007F + BASE_ACCELERATION), 0.007F), TileEntityBasicGenerator.MAX_GENERATE_WATTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Decrease generator output if nothing is burning
|
|
||||||
if (this.itemCookTime <= 0)
|
|
||||||
{
|
|
||||||
this.generateWatts = Math.max(this.generateWatts - BASE_DECCELERATION, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.generateWatts >= MIN_GENERATE_WATTS)
|
|
||||||
{
|
|
||||||
this.produceAllSides();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Does this tile have power to run and do work */
|
|
||||||
@Override
|
|
||||||
public boolean canFunction()
|
|
||||||
{
|
|
||||||
return !this.isDisabled() && this.generateWatts > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean simplePacket(String id, ByteArrayDataInput dataStream, Player player)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (this.worldObj.isRemote && super.simplePacket(id, dataStream, player))
|
|
||||||
{
|
|
||||||
if (id.equalsIgnoreCase("gen"))
|
|
||||||
{
|
|
||||||
this.generateWatts = dataStream.readFloat();
|
|
||||||
this.itemCookTime = dataStream.readInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendGUIPacket(EntityPlayer entity)
|
|
||||||
{
|
|
||||||
if (entity != null)
|
|
||||||
{
|
|
||||||
PacketDispatcher.sendPacketToPlayer(PacketHandler.instance().getTilePacket(this.getChannel(), this, "gen", this.generateWatts, this.itemCookTime), (Player) entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Reads a tile entity from NBT. */
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(par1NBTTagCompound);
|
|
||||||
this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime");
|
|
||||||
this.generateWatts = par1NBTTagCompound.getFloat("generateRate");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a tile entity to NBT. */
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(par1NBTTagCompound);
|
|
||||||
par1NBTTagCompound.setInteger("itemCookTime", this.itemCookTime);
|
|
||||||
par1NBTTagCompound.setFloat("generateRate", this.generateWatts);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInvName()
|
|
||||||
{
|
|
||||||
return LanguageRegistry.instance().getStringLocalization("gui.coalgen.name");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canStore(ItemStack stack, int slot, ForgeDirection side)
|
|
||||||
{
|
|
||||||
return TileEntityFurnace.isItemFuel(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canRemove(ItemStack stack, int slot, ForgeDirection side)
|
|
||||||
{
|
|
||||||
if (slot >= this.getSizeInventory())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float receiveElectricity(ForgeDirection from, ElectricityPack electricityPack, boolean doReceive)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getRequest(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getProvide(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
if (direction == ForgeDirection.getOrientation(this.getBlockMetadata() + 2))
|
|
||||||
{
|
|
||||||
return this.generateWatts < TileEntityBasicGenerator.MIN_GENERATE_WATTS ? 0 : this.generateWatts;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<ForgeDirection> getInputDirections()
|
|
||||||
{
|
|
||||||
return EnumSet.noneOf(ForgeDirection.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<ForgeDirection> getOutputDirections()
|
|
||||||
{
|
|
||||||
return EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata() + 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getMaxEnergyStored()
|
|
||||||
{
|
|
||||||
return MAX_GENERATE_WATTS;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,129 +0,0 @@
|
||||||
package dark.core.common.machines;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.network.packet.Packet;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
|
||||||
import dark.core.common.machines.BlockBasicMachine.BasicMachineData;
|
|
||||||
import dark.core.network.PacketHandler;
|
|
||||||
import dark.core.prefab.machine.TileEntityEnergyMachine;
|
|
||||||
|
|
||||||
public class TileEntityBatteryBox extends TileEntityEnergyMachine
|
|
||||||
{
|
|
||||||
int slotBatteryIn = 0, slotBatteryOut = 1;
|
|
||||||
public final Set<EntityPlayer> playersUsing = new HashSet<EntityPlayer>();
|
|
||||||
|
|
||||||
public TileEntityBatteryBox()
|
|
||||||
{
|
|
||||||
this.invSlots = 2;
|
|
||||||
this.MAX_WATTS = 2500;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
if (!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
this.recharge(this.getInventory().getStackInSlot(this.slotBatteryIn));
|
|
||||||
this.discharge(this.getInventory().getStackInSlot(this.slotBatteryOut));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gradually lose energy. */
|
|
||||||
this.setEnergyStored(this.getEnergyStored() - 0.00005f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendGUIPacket(EntityPlayer player)
|
|
||||||
{
|
|
||||||
if (!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
PacketDispatcher.sendPacketToPlayer(getDescriptionPacket(), (Player) player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet getDescriptionPacket()
|
|
||||||
{
|
|
||||||
return PacketHandler.instance().getTilePacket(this.getChannel(), this, "energy", this.getEnergyStored());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!super.simplePacket(id, dis, player) && this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
if (id.equalsIgnoreCase("energy"))
|
|
||||||
{
|
|
||||||
this.setEnergyStored(dis.readFloat());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
|
|
||||||
{
|
|
||||||
return this.isBatteryItem(itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int slotID)
|
|
||||||
{
|
|
||||||
return new int[] { 0, 1 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slotID, ItemStack itemstack, int side)
|
|
||||||
{
|
|
||||||
return this.isItemValidForSlot(slotID, itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
|
|
||||||
{
|
|
||||||
return this.isItemValidForSlot(slotID, itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getRequest(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
return getInputDirections().contains(direction) ? this.getMaxEnergyStored() - this.getEnergyStored() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getProvide(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
return getOutputDirections().contains(direction) ? Math.min(1.3F, this.getEnergyStored()) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<ForgeDirection> getInputDirections()
|
|
||||||
{
|
|
||||||
return EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata() - BasicMachineData.BATTERY_BOX.startMeta + 2).getOpposite(), ForgeDirection.UNKNOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<ForgeDirection> getOutputDirections()
|
|
||||||
{
|
|
||||||
return EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata() - BasicMachineData.BATTERY_BOX.startMeta + 2), ForgeDirection.UNKNOWN);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,240 +0,0 @@
|
||||||
package dark.core.common.machines;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.network.packet.Packet;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import universalelectricity.core.item.IItemElectric;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
||||||
import dark.core.network.PacketHandler;
|
|
||||||
import dark.core.prefab.machine.TileEntityEnergyMachine;
|
|
||||||
|
|
||||||
public class TileEntityElectricFurnace extends TileEntityEnergyMachine
|
|
||||||
{
|
|
||||||
int batterySlot = 0, inputSlot = 1, outputSlot = 2;
|
|
||||||
|
|
||||||
/** The amount of processing time required. */
|
|
||||||
public static final int PROCESS_TIME_REQUIRED = 130;
|
|
||||||
|
|
||||||
/** The amount of ticks this machine has been processing. */
|
|
||||||
public int processTicks = 0;
|
|
||||||
|
|
||||||
public TileEntityElectricFurnace()
|
|
||||||
{
|
|
||||||
super(0.5f);
|
|
||||||
this.invSlots = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
this.discharge(this.getInventory().getStackInSlot(this.batterySlot));
|
|
||||||
|
|
||||||
/** Attempts to smelt an item. */
|
|
||||||
if (!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
if (this.canProcess())
|
|
||||||
{
|
|
||||||
if (this.getEnergyStored() >= WATTS_PER_TICK)
|
|
||||||
{
|
|
||||||
if (this.processTicks == 0)
|
|
||||||
{
|
|
||||||
this.processTicks = PROCESS_TIME_REQUIRED;
|
|
||||||
}
|
|
||||||
else if (this.processTicks > 0)
|
|
||||||
{
|
|
||||||
this.processTicks--;
|
|
||||||
|
|
||||||
/** Process the item when the process timer is done. */
|
|
||||||
if (this.processTicks < 1)
|
|
||||||
{
|
|
||||||
this.smeltItem();
|
|
||||||
this.processTicks = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.processTicks = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.processTicks = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setEnergyStored(this.getEnergyStored() - WATTS_PER_TICK);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.processTicks = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getRequest(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
if (this.canProcess())
|
|
||||||
{
|
|
||||||
return WATTS_PER_TICK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet getDescriptionPacket()
|
|
||||||
{
|
|
||||||
return PacketHandler.instance().getTilePacket(this.getChannel(), this, "processTicks", this.processTicks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendGUIPacket(EntityPlayer player)
|
|
||||||
{
|
|
||||||
if (!this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
PacketDispatcher.sendPacketToPlayer(getDescriptionPacket(), (Player) player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (this.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
if (id.equalsIgnoreCase("processTicks"))
|
|
||||||
{
|
|
||||||
this.processTicks = dis.readInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return Is this machine able to process its specific task? */
|
|
||||||
public boolean canProcess()
|
|
||||||
{
|
|
||||||
if (FurnaceRecipes.smelting().getSmeltingResult(this.getInventory().getStackInSlot(1)) == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getInventory().getStackInSlot(1) == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getInventory().getStackInSlot(this.outputSlot) != null)
|
|
||||||
{
|
|
||||||
if (!this.getInventory().getStackInSlot(this.outputSlot).isItemEqual(FurnaceRecipes.smelting().getSmeltingResult(this.getInventory().getStackInSlot(1))))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getInventory().getStackInSlot(this.outputSlot).stackSize + 1 > 64)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Turn one item from the furnace source stack into the appropriate smelted item in the furnace
|
|
||||||
* result stack */
|
|
||||||
public void smeltItem()
|
|
||||||
{
|
|
||||||
if (this.canProcess())
|
|
||||||
{
|
|
||||||
ItemStack resultItemStack = FurnaceRecipes.smelting().getSmeltingResult(this.getInventory().getStackInSlot(this.inputSlot));
|
|
||||||
|
|
||||||
if (this.getInventory().getStackInSlot(this.outputSlot) == null)
|
|
||||||
{
|
|
||||||
this.getInventory().getContainedItems()[this.outputSlot] = resultItemStack.copy();
|
|
||||||
}
|
|
||||||
else if (this.getInventory().getStackInSlot(this.outputSlot).isItemEqual(resultItemStack))
|
|
||||||
{
|
|
||||||
this.getInventory().getContainedItems()[this.outputSlot].stackSize++;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getInventory().getStackInSlot(1).stackSize--;
|
|
||||||
|
|
||||||
if (this.getInventory().getStackInSlot(this.inputSlot).stackSize <= 0)
|
|
||||||
{
|
|
||||||
this.getInventory().getContainedItems()[this.inputSlot] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Reads a tile entity from NBT. */
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
|
||||||
{
|
|
||||||
super.readFromNBT(par1NBTTagCompound);
|
|
||||||
this.processTicks = par1NBTTagCompound.getInteger("smeltingTicks");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a tile entity to NBT. */
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
|
||||||
{
|
|
||||||
super.writeToNBT(par1NBTTagCompound);
|
|
||||||
par1NBTTagCompound.setInteger("smeltingTicks", this.processTicks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInvName()
|
|
||||||
{
|
|
||||||
return LanguageRegistry.instance().getStringLocalization("gui.electricfurnace.name");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true if automation is allowed to insert the given stack (ignoring stack size) into
|
|
||||||
* the given slot. */
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slotID, ItemStack itemStack)
|
|
||||||
{
|
|
||||||
return slotID == 1 ? FurnaceRecipes.smelting().getSmeltingResult(itemStack) != null : (slotID == 0 ? itemStack.getItem() instanceof IItemElectric : false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the size of the side inventory. */
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
return side == 0 ? new int[] { 2 } : (side == 1 ? new int[] { 0, 1 } : new int[] { 0 });
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slotID, ItemStack par2ItemStack, int par3)
|
|
||||||
{
|
|
||||||
return this.isItemValidForSlot(slotID, par2ItemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slotID, ItemStack par2ItemStack, int par3)
|
|
||||||
{
|
|
||||||
return slotID == 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getProvide(ForgeDirection direction)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
10
src/dark/core/common/machines/TileEntitySteamFan.java
Normal file
10
src/dark/core/common/machines/TileEntitySteamFan.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package dark.core.common.machines;
|
||||||
|
|
||||||
|
public class TileEntitySteamFan extends TileEntitySteamPiston
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void updateAnimation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
46
src/dark/core/common/machines/TileEntitySteamGen.java
Normal file
46
src/dark/core/common/machines/TileEntitySteamGen.java
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package dark.core.common.machines;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import universalelectricity.core.electricity.ElectricityPack;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
|
import dark.core.network.PacketHandler;
|
||||||
|
import dark.core.prefab.machine.TileEntityEnergyMachine;
|
||||||
|
import dark.core.prefab.machine.TileEntityMachine;
|
||||||
|
|
||||||
|
/** Simple compact generator designed to only power a few machines at a time
|
||||||
|
*
|
||||||
|
* @author DarkGuardsman */
|
||||||
|
public class TileEntitySteamGen extends TileEntityMachine
|
||||||
|
{
|
||||||
|
/** Maximum amount of energy needed to generate electricity */
|
||||||
|
public static float MAX_GENERATE_WATTS = 0.5f;
|
||||||
|
|
||||||
|
/** Amount of heat the coal generator needs before generating electricity. */
|
||||||
|
public static final float MIN_GENERATE_WATTS = MAX_GENERATE_WATTS * 0.1f;
|
||||||
|
|
||||||
|
private static float BASE_ACCELERATION = 0.000001f;
|
||||||
|
private static float BASE_DECCELERATION = 0.008f;
|
||||||
|
|
||||||
|
/** The number of ticks that a fresh copy of the currently-burning item would keep the furnace
|
||||||
|
* burning for */
|
||||||
|
public int itemCookTime = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity()
|
||||||
|
{
|
||||||
|
super.updateEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
16
src/dark/core/common/machines/TileEntitySteamPiston.java
Normal file
16
src/dark/core/common/machines/TileEntitySteamPiston.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package dark.core.common.machines;
|
||||||
|
|
||||||
|
import dark.core.prefab.machine.TileEntityEnergyMachine;
|
||||||
|
|
||||||
|
public class TileEntitySteamPiston extends TileEntityEnergyMachine
|
||||||
|
{
|
||||||
|
protected float wattPerSteam = 32.0f;
|
||||||
|
protected float maxWattOutput = 500f;
|
||||||
|
protected float maxSteamInput = 50f;
|
||||||
|
|
||||||
|
protected void updateAnimation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue