v5.0.1 Beta #1

*Gave the Hydrogen Generator a model.
*Gave the Electrolytic Separator a model.
*Gave the Heat Generator a model.
*Fixed Energy Cubes dropping two of themselves.
*Updated javadocs.
*Added option to change Electrolytic Separator output.
*Added three tiers of Smelting Factory.
*Other minor changes.
This commit is contained in:
Aidan Brady 2012-12-19 15:23:55 -05:00
parent 88bed492ee
commit 75e762fd35
53 changed files with 2129 additions and 291 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -15,9 +15,13 @@ public interface IAccessibleGui
/**
* The mod's instance object
* @return mod instance
* @return what the @Instance field is named in your mod.
*/
public String getInstanceName();
/**
* Gets the mod's main class path as a string. For Mekanism I would return "mekanism.common.Mekanism"
* @return
*/
public String getClassPath();
}

View file

@ -0,0 +1,21 @@
package mekanism.api;
/**
* Implement this if your machine/generator has some form of active state.
* @author aidancbrady
*
*/
public interface IActiveState
{
/**
* Gets the active state as a boolean.
* @return active state
*/
public boolean getActive();
/**
* Sets the active state to a new value.
* @param active - new active state
*/
public void setActive(boolean active);
}

View file

@ -39,10 +39,4 @@ public interface IElectricMachine
* @return recipes
*/
public List getRecipes();
/**
* Sets this machine's active state, sending a packet to the server if it differs from the previous update.
* @param active
*/
public void setActive(boolean active);
}

View file

@ -1,43 +1,11 @@
package mekanism.api;
import mekanism.api.Tier.EnergyCubeTier;
import net.minecraft.src.*;
public interface IEnergyCube
{
public EnumTier getTier(ItemStack itemstack);
public EnergyCubeTier getTier(ItemStack itemstack);
public void setTier(ItemStack itemstack, EnumTier tier);
public static enum EnumTier
{
BASIC("Basic", 1000000, 10000),
ADVANCED("Advanced", 2500000, 25000),
ULTIMATE("Ultimate", 5000000, 50000);
public double MAX_ELECTRICITY;
public double VOLTAGE;
public int DIVIDER;
public String name;
public static EnumTier getFromName(String gasName)
{
for(EnumTier tier : values())
{
if(gasName.contains(tier.name))
{
return tier;
}
}
System.out.println("[Mekanism] Invalid tier identifier when retrieving with name.");
return BASIC;
}
private EnumTier(String s, double maxEnergy, int divider)
{
name = s;
MAX_ELECTRICITY = maxEnergy;
DIVIDER = divider;
}
}
public void setTier(ItemStack itemstack, EnergyCubeTier tier);
}

View file

@ -0,0 +1,84 @@
package mekanism.api;
/**
* Tier information for Mekanism. This currently includes tiers for Energy Cubes and Smelting Factories.
* @author aidancbrady
*
*/
public final class Tier
{
/**
* The tiers used by the Energy Cube and their corresponding values.
* @author aidancbrady
*
*/
public static enum EnergyCubeTier
{
BASIC("Basic", 1000000, 10000),
ADVANCED("Advanced", 2500000, 25000),
ULTIMATE("Ultimate", 5000000, 50000);
public double MAX_ELECTRICITY;
public double VOLTAGE;
public int DIVIDER;
public String name;
public static EnergyCubeTier getFromName(String tierName)
{
for(EnergyCubeTier tier : values())
{
if(tierName.contains(tier.name))
{
return tier;
}
}
System.out.println("[Mekanism] Invalid tier identifier when retrieving with name.");
return BASIC;
}
private EnergyCubeTier(String s, double maxEnergy, int divider)
{
name = s;
MAX_ELECTRICITY = maxEnergy;
DIVIDER = divider;
}
}
/**
* The tiers used by the Smelting Factory and their corresponding values.
* @author aidancbrady
*
*/
public static enum SmeltingFactoryTier
{
BASIC("Basic", 3, "GuiBasicSmeltingFactory.png"),
ADVANCED("Advanced", 5, "GuiAdvancedSmeltingFactory.png"),
ULTIMATE("Ultimate", 7, "GuiUltimateSmeltingFactory.png");
public int processes;
public String guiTexturePath;
public String name;
public static SmeltingFactoryTier getFromName(String tierName)
{
for(SmeltingFactoryTier tier : values())
{
if(tierName.contains(tier.name))
{
return tier;
}
}
System.out.println("[Mekanism] Invalid tier identifier when retrieving with name.");
return BASIC;
}
private SmeltingFactoryTier(String s, int process, String gui)
{
name = s;
processes = process;
guiTexturePath = gui;
}
}
}

View file

@ -73,7 +73,7 @@ public class BlockBasic extends Block
list.add(new ItemStack(i, 1, 3));
list.add(new ItemStack(i, 1, 4));
list.add(new ItemStack(i, 1, 5));
list.add(new ItemStack(i, 1, 6));
//list.add(new ItemStack(i, 1, 6));
}
@Override
@ -134,7 +134,12 @@ public class BlockBasic extends Block
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return metadata == 6 ? new TileEntityControlPanel() : null;
switch(metadata)
{
case 6:
return new TileEntityControlPanel();
}
return null;
}
@Override

View file

@ -11,7 +11,7 @@ import universalelectricity.core.implement.IItemElectric;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import mekanism.api.IEnergyCube;
import mekanism.api.IEnergyCube.EnumTier;
import mekanism.api.Tier.EnergyCubeTier;
import mekanism.generators.common.MekanismGenerators;
import mekanism.generators.common.BlockGenerator.GeneratorType;
import net.minecraft.src.*;
@ -116,7 +116,7 @@ public class BlockEnergyCube extends BlockContainer
int metadata = world.getBlockMetadata(x, y, z);
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getBlockTileEntity(x, y, z);
if(tileEntity.tier == EnumTier.BASIC)
if(tileEntity.tier == EnergyCubeTier.BASIC)
{
if(side == tileEntity.facing)
{
@ -126,7 +126,7 @@ public class BlockEnergyCube extends BlockContainer
return 21;
}
}
else if(tileEntity.tier == EnumTier.ADVANCED)
else if(tileEntity.tier == EnergyCubeTier.ADVANCED)
{
if(side == tileEntity.facing)
{
@ -136,7 +136,7 @@ public class BlockEnergyCube extends BlockContainer
return 22;
}
}
else if(tileEntity.tier == EnumTier.ULTIMATE)
else if(tileEntity.tier == EnergyCubeTier.ULTIMATE)
{
if(side == tileEntity.facing)
{
@ -206,21 +206,22 @@ public class BlockEnergyCube extends BlockContainer
electricItem.setJoules(tileEntity.electricityStored, entityItem.item);
world.spawnEntityInWorld(entityItem);
if(Mekanism.hooks.IC2Loaded)
{
EnergyNet.getForWorld(tileEntity.worldObj).removeTileEntity(tileEntity);
}
}
super.breakBlock(world, x, y, z, i1, i2);
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int i, CreativeTabs creativetabs, List list)
{
for(EnumTier tier : EnumTier.values())
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
ItemStack discharged = new ItemStack(this);
discharged.setItemDamage(100);

View file

@ -18,6 +18,9 @@ import net.minecraftforge.common.ForgeDirection;
* 2: Combiner
* 3: Crusher
* 4: Theoretical Elementizer
* 5: Basic Smelting Factory
* 6: Advanced Smelting Factory
* 7: Ultimate Smelting Factory
* @author AidanBrady
*
*/
@ -36,8 +39,6 @@ public class BlockMachine extends BlockContainer
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
{
if(!(world.getBlockMetadata(x, y, z) == 6))
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@ -53,14 +54,13 @@ public class BlockMachine extends BlockContainer
tileEntity.setFacing((short)change);
}
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
if (isActive(world, x, y, z))
if (MekanismUtils.isActive(world, x, y, z))
{
float xRandom = (float)x + 0.5F;
float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
@ -148,6 +148,36 @@ public class BlockMachine extends BlockContainer
return 19;
}
}
else if(meta == 5)
{
if(side == 3)
{
return 41;
}
else {
return 44;
}
}
else if(meta == 6)
{
if(side == 3)
{
return 42;
}
else {
return 45;
}
}
else if(meta == 7)
{
if(side == 3)
{
return 43;
}
else {
return 46;
}
}
else {
return 0;
}
@ -164,7 +194,7 @@ public class BlockMachine extends BlockContainer
{
if(side == tileEntity.facing)
{
return isActive(world, x, y, z) ? 8 : 9;
return MekanismUtils.isActive(world, x, y, z) ? 8 : 9;
}
else {
return 2;
@ -174,8 +204,7 @@ public class BlockMachine extends BlockContainer
{
if(side == tileEntity.facing)
{
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+2 : 14;
return MekanismUtils.isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+2 : 14;
}
else {
return 2;
@ -185,7 +214,7 @@ public class BlockMachine extends BlockContainer
{
if(side == tileEntity.facing)
{
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+3 : 15;
return MekanismUtils.isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+3 : 15;
}
else {
return 2;
@ -195,7 +224,7 @@ public class BlockMachine extends BlockContainer
{
if(side == tileEntity.facing)
{
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+1 : 13;
return MekanismUtils.isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+1 : 13;
}
else {
return 2;
@ -205,22 +234,52 @@ public class BlockMachine extends BlockContainer
{
if(side == 0 || side == 1)
{
return isActive(world, x, y, z) ? 20 : 18;
return MekanismUtils.isActive(world, x, y, z) ? 20 : 18;
}
else {
if(side == tileEntity.facing)
{
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+4 : 16;
return MekanismUtils.isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+4 : 16;
}
else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal())
{
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+5 : 17;
return MekanismUtils.isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+5 : 17;
}
else {
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+6 : 19;
return MekanismUtils.isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+6 : 19;
}
}
}
else if(metadata == 5)
{
if(side == tileEntity.facing)
{
return 41;
}
else {
return 44;
}
}
else if(metadata == 6)
{
if(side == tileEntity.facing)
{
return 42;
}
else {
return 45;
}
}
else if(metadata == 7)
{
if(side == tileEntity.facing)
{
return 43;
}
else {
return 46;
}
}
else {
return 0;
}
@ -241,24 +300,9 @@ public class BlockMachine extends BlockContainer
list.add(new ItemStack(i, 1, 2));
list.add(new ItemStack(i, 1, 3));
list.add(new ItemStack(i, 1, 4));
}
/**
* Checks if a machine is in it's active state.
* @param world
* @param x
* @param y
* @param z
* @return if machine is active
*/
public boolean isActive(IBlockAccess world, int x, int y, int z)
{
TileEntityBasicMachine tileEntity = (TileEntityBasicMachine)world.getBlockTileEntity(x, y, z);
if(tileEntity != null)
{
return tileEntity.isActive;
}
return false;
list.add(new ItemStack(i, 1, 5));
list.add(new ItemStack(i, 1, 6));
list.add(new ItemStack(i, 1, 7));
}
@Override
@ -303,11 +347,6 @@ public class BlockMachine extends BlockContainer
}
}
}
if(Mekanism.hooks.IC2Loaded)
{
EnergyNet.getForWorld(tileEntity.worldObj).removeTileEntity(tileEntity);
}
}
super.breakBlock(world, x, y, z, i1, i2);
@ -328,7 +367,7 @@ public class BlockMachine extends BlockContainer
{
if(!entityplayer.isSneaking())
{
entityplayer.openGui(Mekanism.instance, MachineType.getGuiID(metadata), world, x, y, z);
entityplayer.openGui(Mekanism.instance, MachineType.getFromMetadata(metadata).guiId, world, x, y, z);
return true;
}
}
@ -345,29 +384,7 @@ public class BlockMachine extends BlockContainer
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{
if(metadata == MachineType.ENRICHMENT_CHAMBER.meta)
{
return new TileEntityEnrichmentChamber();
}
else if(metadata == MachineType.PLATINUM_COMPRESSOR.meta)
{
return new TileEntityPlatinumCompressor();
}
else if(metadata == MachineType.COMBINER.meta)
{
return new TileEntityCombiner();
}
else if(metadata == MachineType.CRUSHER.meta)
{
return new TileEntityCrusher();
}
else if(metadata == MachineType.THEORETICAL_ELEMENTIZER.meta)
{
return new TileEntityTheoreticalElementizer();
}
else {
return null;
}
return MachineType.getFromMetadata(metadata).create();
}
@Override
@ -378,24 +395,43 @@ public class BlockMachine extends BlockContainer
public static enum MachineType
{
ENRICHMENT_CHAMBER(0, 3),
PLATINUM_COMPRESSOR(1, 4),
COMBINER(2, 5),
CRUSHER(3, 6),
THEORETICAL_ELEMENTIZER(4, 7);
ENRICHMENT_CHAMBER(0, 3, TileEntityEnrichmentChamber.class),
PLATINUM_COMPRESSOR(1, 4, TileEntityPlatinumCompressor.class),
COMBINER(2, 5, TileEntityCombiner.class),
CRUSHER(3, 6, TileEntityCrusher.class),
THEORETICAL_ELEMENTIZER(4, 7, TileEntityTheoreticalElementizer.class),
BASIC_SMELTING_FACTORY(5, 11, TileEntitySmeltingFactory.class),
ADVANCED_SMELTING_FACTORY(6, 11, TileEntityAdvancedSmeltingFactory.class),
ULTIMATE_SMELTING_FACTORY(7, 11, TileEntityUltimateSmeltingFactory.class);
private int meta;
private int guiId;
public int meta;
public int guiId;
public Class<? extends TileEntity> tileEntityClass;
private MachineType(int i, int j)
private MachineType(int i, int j, Class<? extends TileEntity> tileClass)
{
meta = i;
guiId = j;
tileEntityClass = tileClass;
}
public static int getGuiID(int meta)
public static MachineType getFromMetadata(int meta)
{
return values()[meta].guiId;
return values()[meta];
}
public TileEntity create()
{
TileEntity tileEntity;
try {
tileEntity = tileEntityClass.newInstance();
return tileEntity;
} catch(Exception e) {
System.err.println("[Mekanism] Unable to indirectly create tile entity.");
e.printStackTrace();
return null;
}
}
@Override

View file

@ -126,6 +126,8 @@ public class CommonProxy
return new ContainerEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity);
case 10:
return new ContainerGasTank(player.inventory, (TileEntityGasTank)tileEntity);
case 11:
return new ContainerSmeltingFactory(player.inventory, (TileEntitySmeltingFactory)tileEntity);
}
return null;
}

View file

@ -0,0 +1,195 @@
package mekanism.common;
import ic2.api.IElectricItem;
import universalelectricity.core.implement.IItemElectric;
import mekanism.api.ItemMachineUpgrade;
import mekanism.api.Tier.SmeltingFactoryTier;
import net.minecraft.src.*;
public class ContainerSmeltingFactory extends Container
{
private TileEntitySmeltingFactory tileEntity;
public ContainerSmeltingFactory(InventoryPlayer inventory, TileEntitySmeltingFactory tentity)
{
tileEntity = tentity;
addSlotToContainer(new SlotMachineUpgrade(tentity, 0, 7, 7));
addSlotToContainer(new SlotEnergy(tentity, 1, 7, 35));
if(tileEntity.tier == SmeltingFactoryTier.BASIC)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 55 + (i*38);
addSlotToContainer(new Slot(tentity, 2+i*2, xAxis, 13));
addSlotToContainer(new SlotFurnace(inventory.player, tentity, 3+i*2, xAxis, 57));
}
}
else if(tileEntity.tier == SmeltingFactoryTier.ADVANCED)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 35 + (i*26);
addSlotToContainer(new Slot(tentity, 2+i*2, xAxis, 13));
addSlotToContainer(new SlotFurnace(inventory.player, tentity, 3+i*2, xAxis, 57));
}
}
else if(tileEntity.tier == SmeltingFactoryTier.ULTIMATE)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 29 + (i*19);
addSlotToContainer(new Slot(tentity, 2+i*2, xAxis, 13));
addSlotToContainer(new SlotFurnace(inventory.player, tentity, 3+i*2, xAxis, 57));
}
}
int slotX;
for (slotX = 0; slotX < 3; ++slotX)
{
for (int slotY = 0; slotY < 9; ++slotY)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
}
for (slotX = 0; slotX < 9; ++slotX)
{
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
}
tileEntity.openChest();
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
tileEntity.closeChest();
}
@Override
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return tileEntity.isUseableByPlayer(par1EntityPlayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot currentSlot = (Slot)inventorySlots.get(slotID);
if(currentSlot != null && currentSlot.getHasStack())
{
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(slotID == 3 || slotID == 5 || slotID == 7 || slotID == 9 || slotID == 11 || slotID == 13 || slotID == 15)
{
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
else if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex)
{
if(slotID != 1)
{
if(!mergeItemStack(slotStack, 1, 2, false))
{
return null;
}
}
else if(slotID == 1)
{
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
}
else if(FurnaceRecipes.smelting().getSmeltingResult(slotStack) != null)
{
if(slotID != 2 && slotID != 4 && slotID != 6 && slotID != 8 && slotID != 10 && slotID != 12 && slotID != 14)
{
if(!mergeItemStack(slotStack, 2, 3, false))
{
if(!mergeItemStack(slotStack, 4, 5, false))
{
if(!mergeItemStack(slotStack, 6, 7, false))
{
if(tileEntity.tier != SmeltingFactoryTier.BASIC)
{
if(!mergeItemStack(slotStack, 8, 9, false))
{
if(!mergeItemStack(slotStack, 10, 11, false))
{
if(tileEntity.tier != SmeltingFactoryTier.ADVANCED)
{
if(!mergeItemStack(slotStack, 12, 13, false))
{
if(!mergeItemStack(slotStack, 14, 15, false))
{
return null;
}
}
}
}
}
}
}
}
}
}
else {
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0)
{
if(!mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
{
return null;
}
}
}
if (slotStack.stackSize == 0)
{
currentSlot.putStack((ItemStack)null);
}
else
{
currentSlot.onSlotChanged();
}
if (slotStack.stackSize == stack.stackSize)
{
return null;
}
currentSlot.onPickupFromSlot(player, slotStack);
}
return stack;
}
}

View file

@ -6,6 +6,7 @@ import universalelectricity.core.electricity.ElectricInfo;
import universalelectricity.core.electricity.ElectricInfo.ElectricUnit;
import universalelectricity.core.implement.IItemElectric;
import mekanism.api.IEnergyCube;
import mekanism.api.Tier.EnergyCubeTier;
import net.minecraft.src.*;
public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEnergyCube
@ -38,7 +39,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
item.setTier(itemstack, item.getTier(itemstack));
}
public ItemStack getUnchargedItem(EnumTier tier)
public ItemStack getUnchargedItem(EnergyCubeTier tier)
{
ItemStack charged = new ItemStack(this);
setTier(charged, tier);
@ -103,7 +104,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
return getTier(itemstack).MAX_ELECTRICITY;
}
return EnumTier.BASIC.MAX_ELECTRICITY;
return EnergyCubeTier.BASIC.MAX_ELECTRICITY;
}
@Override
@ -162,23 +163,23 @@ public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric, IEn
}
@Override
public EnumTier getTier(ItemStack itemstack)
public EnergyCubeTier getTier(ItemStack itemstack)
{
if(itemstack.stackTagCompound == null)
{
return EnumTier.BASIC;
return EnergyCubeTier.BASIC;
}
if(itemstack.stackTagCompound.getString("tier") == null)
{
return EnumTier.BASIC;
return EnergyCubeTier.BASIC;
}
return EnumTier.getFromName(itemstack.stackTagCompound.getString("tier"));
return EnergyCubeTier.getFromName(itemstack.stackTagCompound.getString("tier"));
}
@Override
public void setTier(ItemStack itemstack, EnumTier tier)
public void setTier(ItemStack itemstack, EnergyCubeTier tier)
{
if (itemstack.stackTagCompound == null)
{

View file

@ -11,6 +11,9 @@ import net.minecraft.src.ItemStack;
* 2: Combiner
* 3: Crusher
* 4: Theoretical Elementizer
* 5: Basic Smelting Factory
* 6: Advanced Smelting Factory
* 7: Ultimate Smelting Factory
* @author AidanBrady
*
*/
@ -58,6 +61,15 @@ public class ItemBlockMachine extends ItemBlock
case 4:
name = "TheoreticalElementizer";
break;
case 5:
name = "BasicSmeltingFactory";
break;
case 6:
name = "AdvancedSmeltingFactory";
break;
case 7:
name = "UltimateSmeltingFactory";
break;
default:
name = "Unknown";
break;

View file

@ -5,7 +5,6 @@ import java.util.List;
import ic2.api.IElectricItem;
import mekanism.api.EnumGas;
import mekanism.api.IStorageTank;
import mekanism.api.IEnergyCube.EnumTier;
import net.minecraft.src.*;
public class ItemStorageTank extends ItemMekanism implements IStorageTank

View file

@ -15,8 +15,8 @@ import java.util.Random;
import java.util.logging.Logger;
import universalelectricity.prefab.multiblock.*;
import mekanism.api.IEnergyCube.EnumTier;
import mekanism.api.ItemMachineUpgrade;
import mekanism.api.Tier.EnergyCubeTier;
import mekanism.client.SoundHandler;
import net.minecraftforge.common.*;
import net.minecraftforge.event.ForgeSubscribe;
@ -47,7 +47,7 @@ import cpw.mods.fml.common.registry.TickRegistry;
* @author AidanBrady
*
*/
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.0.0")
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.0.1")
@NetworkMod(channels = {"Mekanism"}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class Mekanism
{
@ -69,7 +69,7 @@ public class Mekanism
public static Configuration configuration;
/** Mekanism version number */
public static Version versionNumber = new Version(5, 0, 0);
public static Version versionNumber = new Version(5, 0, 1);
/** Mekanism creative tab */
public static CreativeTabMekanism tabMekanism = new CreativeTabMekanism();
@ -236,27 +236,36 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(GasTank, new Object[] {
"PPP", "PDP", "PPP", Character.valueOf('P'), "ingotPlatinum", Character.valueOf('D'), "dustIron"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnumTier.BASIC), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnergyCubeTier.BASIC), new Object[] {
"ELE", "TIT", "ELE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('L'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnumTier.ADVANCED), new Object[] {
"EGE", "TBT", "EGE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('G'), Item.ingotGold, Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('B'), MekanismUtils.getEnergyCubeWithTier(EnumTier.BASIC)
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnergyCubeTier.ADVANCED), new Object[] {
"EGE", "TBT", "EGE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('G'), Item.ingotGold, Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('B'), MekanismUtils.getEnergyCubeWithTier(EnergyCubeTier.BASIC)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnumTier.ULTIMATE), new Object[] {
"EDE", "TAT", "EDE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('D'), Item.diamond, Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('A'), MekanismUtils.getEnergyCubeWithTier(EnumTier.ADVANCED)
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnergyCubeTier.ULTIMATE), new Object[] {
"EDE", "TAT", "EDE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('D'), Item.diamond, Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('A'), MekanismUtils.getEnergyCubeWithTier(EnergyCubeTier.ADVANCED)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ControlCircuit), new Object[] {
" P ", "PEP", " P ", Character.valueOf('P'), new ItemStack(Ingot, 1, 1), Character.valueOf('E'), EnrichedAlloy
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedIron, 6), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedIron, 2), new Object[] {
"A", "I", "A", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('I'), "dustIron"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedIron, 4), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedIron, 1), new Object[] {
"C", "I", "C", Character.valueOf('C'), "dustCopper", Character.valueOf('I'), "dustIron"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedIron, 4), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedIron, 1), new Object[] {
"T", "I", "T", Character.valueOf('T'), "dustTin", Character.valueOf('I'), "dustIron"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 5), new Object[] {
"CAC", "GIG", "CAC", Character.valueOf('C'), ControlCircuit, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('G'), "dustGold", Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 6), new Object[] {
"CAC", "DFD", "CAC", Character.valueOf('C'), ControlCircuit, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('D'), "dustDiamond", Character.valueOf('F'), new ItemStack(MachineBlock, 1, 5)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 7), new Object[] {
"CAC", "cFc", "CAC", Character.valueOf('C'), ControlCircuit, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('c'), AtomicCore, Character.valueOf('F'), new ItemStack(MachineBlock, 1, 6)
}));
if(extrasEnabled)
{
@ -345,6 +354,9 @@ public class Mekanism
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Combiner.name", "Combiner");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Crusher.name", "Crusher");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.TheoreticalElementizer.name", "Theoretical Elementizer");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.BasicSmeltingFactory.name", "Basic Smelting Factory");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.AdvancedSmeltingFactory.name", "Advanced Smelting Factory");
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.UltimateSmeltingFactory.name", "Ultimate Smelting Factory");
//Localization for OreBlock
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.PlatinumOre.name", "Platinum Ore");
@ -458,6 +470,7 @@ public class Mekanism
OreDictionary.registerOre("dustGold", new ItemStack(Dust, 1, 1));
OreDictionary.registerOre("dustPlatinum", new ItemStack(Dust, 1, 2));
OreDictionary.registerOre("dustObsidian", new ItemStack(Dust, 1, 3));
OreDictionary.registerOre("dustDiamond", new ItemStack(Dust, 1, 4));
OreDictionary.registerOre("ingotObsidian", new ItemStack(Ingot, 1, 0));
OreDictionary.registerOre("ingotPlatinum", new ItemStack(Ingot, 1, 1));
@ -620,6 +633,9 @@ public class Mekanism
GameRegistry.registerTileEntity(TileEntityMulti.class, "Multi");
GameRegistry.registerTileEntity(TileEntityControlPanel.class, "ControlPanel");
GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank");
GameRegistry.registerTileEntity(TileEntitySmeltingFactory.class, "SmeltingFactory");
GameRegistry.registerTileEntity(TileEntityAdvancedSmeltingFactory.class, "AdvancedSmeltingFactory");
GameRegistry.registerTileEntity(TileEntityUltimateSmeltingFactory.class, "UltimateSmeltingFactory");
//Load tile entities that have special renderers.
proxy.registerSpecialTileEntities();

View file

@ -1,7 +1,6 @@
package mekanism.common;
import cpw.mods.fml.common.Loader;
import railcraft.common.api.core.items.ItemRegistry;
import ic2.api.Ic2Recipes;
import net.minecraft.src.*;
@ -30,8 +29,6 @@ public final class MekanismHooks
public ItemStack IC2TinDust;
public ItemStack IC2CoalDust;
public ItemStack RailcraftObsidianDust;
public int BuildCraftFuelID = 3808;
public ItemStack BuildCraftFuelBucket;
@ -72,8 +69,6 @@ public final class MekanismHooks
}
if(RailcraftLoaded)
{
RailcraftObsidianDust = getRailcraftItem("dust.obsidian");
System.out.println("[Mekanism] Hooked into Railcraft successfully.");
}
if(BasicComponentsLoaded)
@ -120,11 +115,6 @@ public final class MekanismHooks
}
}
public ItemStack getRailcraftItem(String name)
{
return ItemRegistry.getItem(name, 1);
}
public ItemStack getBuildCraftItem(String name)
{
try {

View file

@ -16,8 +16,9 @@ import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.server.FMLServerHandler;
import mekanism.api.IActiveState;
import mekanism.api.IEnergyCube;
import mekanism.api.IEnergyCube.EnumTier;
import mekanism.api.Tier.EnergyCubeTier;
import mekanism.client.ThreadSendData;
import net.minecraft.src.*;
import net.minecraftforge.oredict.ShapedOreRecipe;
@ -207,9 +208,30 @@ public final class MekanismUtils
* @param tier - tier to add to the Energy Cube
* @return empty energy cube with defined tier
*/
public static ItemStack getEnergyCubeWithTier(EnumTier tier)
public static ItemStack getEnergyCubeWithTier(EnergyCubeTier tier)
{
ItemStack itemstack = ((ItemBlockEnergyCube)new ItemStack(Mekanism.EnergyCube).getItem()).getUnchargedItem(tier);
return itemstack;
}
/**
* Checks if a machine is in it's active state.
* @param world
* @param x
* @param y
* @param z
* @return if machine is active
*/
public static boolean isActive(IBlockAccess world, int x, int y, int z)
{
TileEntity tileEntity = (TileEntity)world.getBlockTileEntity(x, y, z);
if(tileEntity != null)
{
if(tileEntity instanceof IActiveState)
{
return ((IActiveState)tileEntity).getActive();
}
}
return false;
}
}

View file

@ -232,6 +232,13 @@ public class PacketHandler implements IPacketHandler
{
output.writeUTF((String)data);
}
else if(data instanceof int[])
{
for(int i : (int[])data)
{
output.writeInt(i);
}
}
}
Packet250CustomPayload packet = new Packet250CustomPayload();

View file

@ -68,6 +68,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
public void onUpdate()
{
super.onUpdate();
boolean testActive = operatingTicks > 0;
if(inventory[3] != null)
@ -230,17 +231,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
return;
}
ItemStack itemstack;
if (inventory[0].getItem().hasContainerItem())
{
itemstack = RecipeHandler.getOutput(inventory[0], false, getRecipes()).copy();
inventory[0] = new ItemStack(inventory[0].getItem().getContainerItem());
}
else
{
itemstack = RecipeHandler.getOutput(inventory[0], true, getRecipes()).copy();
}
ItemStack itemstack = RecipeHandler.getOutput(inventory[0], true, getRecipes());
if (inventory[0].stackSize <= 0)
{

View file

@ -0,0 +1,11 @@
package mekanism.common;
import mekanism.api.Tier.SmeltingFactoryTier;
public class TileEntityAdvancedSmeltingFactory extends TileEntitySmeltingFactory
{
public TileEntityAdvancedSmeltingFactory()
{
super(SmeltingFactoryTier.ADVANCED);
}
}

View file

@ -5,8 +5,10 @@ import com.google.common.io.ByteArrayDataInput;
import universalelectricity.prefab.tile.TileEntityDisableable;
import ic2.api.EnergyNet;
import ic2.api.IWrenchable;
import ic2.api.energy.EnergyTileLoadEvent;
import mekanism.api.ITileNetwork;
import net.minecraft.src.*;
import net.minecraftforge.common.MinecraftForge;
public abstract class TileEntityBasicBlock extends TileEntityDisableable implements IWrenchable, ITileNetwork
{
@ -27,16 +29,6 @@ public abstract class TileEntityBasicBlock extends TileEntityDisableable impleme
{
super.updateEntity();
if(!initialized && worldObj != null)
{
if(Mekanism.hooks.IC2Loaded)
{
EnergyNet.getForWorld(worldObj).addTileEntity(this);
}
initialized = true;
}
onUpdate();
if(!worldObj.isRemote)
@ -137,4 +129,10 @@ public abstract class TileEntityBasicBlock extends TileEntityDisableable impleme
{
return 1.0F;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
{
return new ItemStack(blockType.blockID, 1, blockMetadata);
}
}

View file

@ -27,15 +27,18 @@ import ic2.api.Direction;
import ic2.api.EnergyNet;
import ic2.api.IEnergySink;
import ic2.api.IWrenchable;
import ic2.api.energy.EnergyTileSinkEvent;
import mekanism.api.IActiveState;
import mekanism.api.IElectricMachine;
import mekanism.client.Sound;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import net.minecraftforge.common.MinecraftForge;
public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IEnergySink, IJouleStorage, IVoltage, IPeripheral
public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IEnergySink, IJouleStorage, IVoltage, IPeripheral, IActiveState
{
/** The Sound instance for this machine. */
@SideOnly(Side.CLIENT)
@ -95,12 +98,19 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
@Override
public void onUpdate()
{
super.onUpdate();
if(!registered && worldObj != null && !worldObj.isRemote)
{
Mekanism.manager.register(this);
registered = true;
}
if(demandsEnergy())
{
MinecraftForge.EVENT_BUS.post(new EnergyTileSinkEvent(this, (int)((MAX_ELECTRICITY-electricityStored)*Mekanism.TO_IC2)));
}
if(!worldObj.isRemote)
{
for(ForgeDirection direction : ForgeDirection.values())
@ -272,6 +282,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
return 120;
}
@Override
public boolean getActive()
{
return isActive;
}
@Override
public void setActive(boolean active)
{

View file

@ -6,13 +6,17 @@ import buildcraft.api.power.IPowerProvider;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerFramework;
import ic2.api.EnergyNet;
import ic2.api.IEnergyTile;
import ic2.api.IWrenchable;
import ic2.api.energy.EnergyTileLoadEvent;
import ic2.api.energy.EnergyTileUnloadEvent;
import mekanism.api.ITileNetwork;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import net.minecraftforge.common.MinecraftForge;
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements IWrenchable, ISidedInventory, IInventory, ITileNetwork, IPowerReceptor
public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements IWrenchable, ISidedInventory, IInventory, ITileNetwork, IPowerReceptor, IEnergyTile
{
/** How much energy is stored in this block. */
public double electricityStored;
@ -40,6 +44,34 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
}
}
@Override
public void onUpdate()
{
if(!initialized && worldObj != null)
{
if(Mekanism.hooks.IC2Loaded)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
}
initialized = true;
}
}
@Override
public void invalidate()
{
super.invalidate();
if(initialized)
{
if(Mekanism.hooks.IC2Loaded)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
}
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{

View file

@ -45,6 +45,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
public void onUpdate()
{
super.onUpdate();
boolean testActive = operatingTicks > 0;
if(inventory[1] != null)
@ -188,17 +189,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
return;
}
ItemStack itemstack;
if (inventory[0].getItem().hasContainerItem())
{
itemstack = RecipeHandler.getOutput(inventory[0], false, getRecipes()).copy();
inventory[0] = new ItemStack(inventory[0].getItem().getContainerItem());
}
else
{
itemstack = RecipeHandler.getOutput(inventory[0], true, getRecipes()).copy();
}
ItemStack itemstack = RecipeHandler.getOutput(inventory[0], true, getRecipes());
if (inventory[0].stackSize <= 0)
{

View file

@ -32,16 +32,17 @@ import ic2.api.IEnergySource;
import ic2.api.IEnergyStorage;
import ic2.api.IWrenchable;
import ic2.api.IElectricItem;
import mekanism.api.IEnergyCube.EnumTier;
import mekanism.api.EnumGas;
import mekanism.api.IEnergyCube;
import mekanism.api.ITileNetwork;
import mekanism.api.Tier.EnergyCubeTier;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEnergySink, IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IVoltage, IPeripheral
{
public EnumTier tier = EnumTier.BASIC;
public EnergyCubeTier tier = EnergyCubeTier.BASIC;
/** Output per tick this machine can transfer. */
public int output;
@ -244,13 +245,13 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
@Override
public int getStored()
{
return (int)(electricityStored*Mekanism.FROM_IC2);
return (int)(electricityStored*Mekanism.TO_IC2);
}
@Override
public int getCapacity()
{
return (int)(tier.MAX_ELECTRICITY*Mekanism.FROM_IC2);
return (int)(tier.MAX_ELECTRICITY*Mekanism.TO_IC2);
}
@Override
@ -407,7 +408,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
try {
facing = dataStream.readInt();
electricityStored = dataStream.readDouble();
tier = EnumTier.getFromName(dataStream.readUTF());
tier = EnergyCubeTier.getFromName(dataStream.readUTF());
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
} catch (Exception e)
{
@ -421,7 +422,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
{
super.readFromNBT(nbtTags);
tier = EnumTier.getFromName(nbtTags.getString("tier"));
tier = EnergyCubeTier.getFromName(nbtTags.getString("tier"));
}
@Override
@ -443,4 +444,37 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
{
PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, tier.name);
}
@Override
public void setStored(int energy)
{
setJoules(energy*Mekanism.FROM_IC2);
}
@Override
public int addEnergy(int amount)
{
setJoules(electricityStored + amount*Mekanism.FROM_IC2);
return (int)electricityStored;
}
@Override
public boolean isTeleporterCompatible(Direction side)
{
return side.toForgeDirection() == ForgeDirection.getOrientation(facing);
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
{
ItemStack itemStack = new ItemStack(Mekanism.EnergyCube);
IEnergyCube energyCube = (IEnergyCube)itemStack.getItem();
energyCube.setTier(itemStack, tier);
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
electricItem.setJoules(electricityStored, itemStack);
return itemStack;
}
}

View file

@ -0,0 +1,541 @@
package mekanism.common;
import universalelectricity.core.implement.IItemElectric;
import universalelectricity.core.implement.IJouleStorage;
import universalelectricity.core.implement.IVoltage;
import ic2.api.Direction;
import ic2.api.ElectricItem;
import ic2.api.IElectricItem;
import ic2.api.IEnergySink;
import ic2.api.energy.EnergyTileSinkEvent;
import mekanism.api.IActiveState;
import mekanism.api.Tier.EnergyCubeTier;
import mekanism.api.Tier.SmeltingFactoryTier;
import net.minecraft.src.*;
import net.minecraftforge.common.MinecraftForge;
import com.google.common.io.ByteArrayDataInput;
import dan200.computer.api.IComputerAccess;
import dan200.computer.api.IPeripheral;
public class TileEntitySmeltingFactory extends TileEntityElectricBlock implements IEnergySink, IJouleStorage, IVoltage, IPeripheral, IActiveState
{
/** This Smelting Factory's tier. */
public SmeltingFactoryTier tier;
/** An int[] used to track all current operations' progress. */
public int[] progress;
/** How many ticks it takes, by default, to run an operation. */
public int TICKS_REQUIRED = 200;
/** How much energy each operation consumes per tick. */
public int ENERGY_PER_TICK = 5;
/** How many ticks it takes, currently, to run an operation. */
public int currentTicksRequired;
/** The current electricity cap this machine can handle. */
public double currentMaxElectricity;
/** This machine's previous active state, used for calculating packets. */
public boolean prevActive;
/** This machine's active state. */
public boolean isActive;
public TileEntitySmeltingFactory()
{
this(SmeltingFactoryTier.BASIC);
}
public TileEntitySmeltingFactory(SmeltingFactoryTier type)
{
super(type.name + " Smelting Factory", type.processes*1000);
tier = type;
currentTicksRequired = TICKS_REQUIRED;
currentMaxElectricity = MAX_ELECTRICITY;
inventory = new ItemStack[2+type.processes*2];
progress = new int[type.processes];
isActive = false;
}
@Override
public void onUpdate()
{
super.onUpdate();
boolean testActive = false;
for(int i : progress)
{
if(i > 0)
{
testActive = true;
}
}
if(demandsEnergy())
{
MinecraftForge.EVENT_BUS.post(new EnergyTileSinkEvent(this, (int)((currentMaxElectricity-electricityStored)*Mekanism.TO_IC2)));
}
if(inventory[1] != null)
{
if(electricityStored < currentMaxElectricity)
{
if(inventory[1].getItem() instanceof IItemElectric)
{
IItemElectric electricItem = (IItemElectric)inventory[1].getItem();
if (electricItem.canProduceElectricity())
{
double joulesNeeded = currentMaxElectricity-electricityStored;
double joulesReceived = 0;
if(electricItem.getVoltage() <= joulesNeeded)
{
joulesReceived = electricItem.onUse(electricItem.getVoltage(), inventory[1]);
}
else if(electricItem.getVoltage() > joulesNeeded)
{
joulesReceived = electricItem.onUse(joulesNeeded, inventory[1]);
}
setJoules(electricityStored + joulesReceived);
}
}
else if(inventory[1].getItem() instanceof IElectricItem)
{
IElectricItem item = (IElectricItem)inventory[1].getItem();
if(item.canProvideEnergy())
{
double gain = ElectricItem.discharge(inventory[1], (int)((MAX_ELECTRICITY - electricityStored)*Mekanism.TO_IC2), 3, false, false)*Mekanism.FROM_IC2;
setJoules(electricityStored + gain);
}
}
}
if(inventory[1].itemID == Item.redstone.shiftedIndex && electricityStored <= (currentMaxElectricity-1000))
{
setJoules(electricityStored + 1000);
--inventory[1].stackSize;
if (inventory[1].stackSize <= 0)
{
inventory[1] = null;
}
}
}
if(inventory[0] != null)
{
int energyToAdd = 0;
int ticksToRemove = 0;
if(inventory[0].isItemEqual(new ItemStack(Mekanism.SpeedUpgrade)))
{
if(currentTicksRequired == TICKS_REQUIRED)
{
ticksToRemove = 150;
}
}
else if(inventory[0].isItemEqual(new ItemStack(Mekanism.EnergyUpgrade)))
{
if(currentMaxElectricity == MAX_ELECTRICITY)
{
energyToAdd = 600;
}
}
else if(inventory[0].isItemEqual(new ItemStack(Mekanism.UltimateUpgrade)))
{
if(currentTicksRequired == TICKS_REQUIRED)
{
ticksToRemove = 150;
}
if(currentMaxElectricity == MAX_ELECTRICITY)
{
energyToAdd = 600;
}
}
currentMaxElectricity += energyToAdd;
currentTicksRequired -= ticksToRemove;
}
else if(inventory[0] == null)
{
currentTicksRequired = TICKS_REQUIRED;
currentMaxElectricity = MAX_ELECTRICITY;
}
for(int mainSlot = 0; mainSlot < tier.processes; mainSlot++)
{
if(canOperate(getInputSlot(mainSlot), getOutputSlot(mainSlot)) && (progress[mainSlot]+1) < currentTicksRequired)
{
++progress[mainSlot];
electricityStored -= ENERGY_PER_TICK;
}
else if(canOperate(getInputSlot(mainSlot), getOutputSlot(mainSlot)) && (progress[mainSlot]+1) >= currentTicksRequired)
{
if(!worldObj.isRemote)
{
operate(getInputSlot(mainSlot), getOutputSlot(mainSlot));
}
progress[mainSlot] = 0;
electricityStored -= ENERGY_PER_TICK;
}
if(electricityStored < 0)
{
electricityStored = 0;
}
if(electricityStored > currentMaxElectricity)
{
electricityStored = currentMaxElectricity;
}
if(!canOperate(getInputSlot(mainSlot), getOutputSlot(mainSlot)))
{
progress[mainSlot] = 0;
}
}
if(!worldObj.isRemote)
{
boolean newActive = false;
boolean hasOperation = false;
for(int i = 0; i < tier.processes; i++)
{
if(canOperate(getInputSlot(i), getOutputSlot(i)))
{
hasOperation = true;
}
}
for(int i : progress)
{
if(i > 0)
{
newActive = true;
}
}
if(testActive != newActive)
{
if(newActive)
{
setActive(true);
}
else if(!hasOperation)
{
setActive(false);
}
}
}
}
public int getScaledProgress(int i, int process)
{
return progress[process]*i / currentTicksRequired;
}
/**
* Gets the scaled energy level for the GUI.
* @param i - multiplier
* @return scaled energy
*/
public int getScaledEnergyLevel(int i)
{
return (int)(electricityStored*i / currentMaxElectricity);
}
public boolean canOperate(int inputSlot, int outputSlot)
{
if (inventory[inputSlot] == null)
{
return false;
}
if(electricityStored < ENERGY_PER_TICK)
{
return false;
}
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[inputSlot]).copy();
if (itemstack == null)
{
return false;
}
if (inventory[outputSlot] == null)
{
return true;
}
if (!inventory[outputSlot].isItemEqual(itemstack))
{
return false;
}
else
{
return inventory[outputSlot].stackSize + itemstack.stackSize <= inventory[outputSlot].getMaxStackSize();
}
}
public void operate(int inputSlot, int outputSlot)
{
if (!canOperate(inputSlot, outputSlot))
{
return;
}
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[inputSlot]).copy();
inventory[inputSlot].stackSize--;
if (inventory[inputSlot].stackSize <= 0)
{
inventory[inputSlot] = null;
}
if (inventory[outputSlot] == null)
{
inventory[outputSlot] = itemstack;
}
else
{
inventory[outputSlot].stackSize += itemstack.stackSize;
}
}
@Override
public void handlePacketData(INetworkManager network, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
try {
facing = dataStream.readInt();
electricityStored = dataStream.readDouble();
currentTicksRequired = dataStream.readInt();
currentMaxElectricity = dataStream.readDouble();
isActive = dataStream.readBoolean();
for(int i = 0; i < tier.processes; i++)
{
progress[i] = dataStream.readInt();
}
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
} catch (Exception e)
{
System.out.println("[Mekanism] Error while handling tile entity packet.");
e.printStackTrace();
}
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{
super.readFromNBT(nbtTags);
currentTicksRequired = nbtTags.getInteger("currentTicksRequired");
currentMaxElectricity = nbtTags.getDouble("currentMaxElectricity");
isActive = nbtTags.getBoolean("isActive");
for(int i = 0; i < tier.processes; i++)
{
progress[i] = nbtTags.getInteger("progress" + i);
}
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
nbtTags.setInteger("currentTicksRequired", currentTicksRequired);
nbtTags.setDouble("currentMaxElectricity", currentMaxElectricity);
nbtTags.setBoolean("isActive", isActive);
for(int i = 0; i < tier.processes; i++)
{
nbtTags.setInteger("progress" + i, progress[i]);
}
}
@Override
public void sendPacket()
{
PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored, currentTicksRequired, currentMaxElectricity, isActive, progress);
}
@Override
public void sendPacketWithRange()
{
PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, currentTicksRequired, currentMaxElectricity, isActive, progress);
}
@Override
public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction)
{
return true;
}
public int getInputSlot(int operation)
{
return (operation+operation)+2;
}
public int getOutputSlot(int operation)
{
return (operation+operation)+3;
}
@Override
public String getType()
{
return getInvName();
}
@Override
public String[] getMethodNames()
{
return new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
}
@Override
public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception
{
switch(method)
{
case 0:
return new Object[] {electricityStored};
case 1:
if(arguments[0] == null)
{
return new Object[] {"Please provide a target operation."};
}
if(!(arguments[0] instanceof Double) && !(arguments[0] instanceof Integer))
{
return new Object[] {"Invalid characters."};
}
if((Integer)arguments[0] < 0 || (Integer)arguments[0] > progress.length)
{
return new Object[] {"No such operation found."};
}
return new Object[] {progress[(Integer)arguments[0]]};
case 2:
return new Object[] {facing};
case 3:
if(arguments[0] == null)
{
return new Object[] {"Please provide a target operation."};
}
if(!(arguments[0] instanceof Double) && !(arguments[0] instanceof Integer))
{
return new Object[] {"Invalid characters."};
}
if((Integer)arguments[0] < 0 || (Integer)arguments[0] > progress.length)
{
return new Object[] {"No such operation found."};
}
return new Object[] {canOperate(getInputSlot((Integer)arguments[0]), getOutputSlot((Integer)arguments[0]))};
case 4:
return new Object[] {currentMaxElectricity};
case 5:
return new Object[] {(currentMaxElectricity-electricityStored)};
default:
System.err.println("[Mekanism] Attempted to call unknown method with computer ID " + computer.getID());
return new Object[] {"Unknown command."};
}
}
@Override
public boolean canAttachToSide(int side)
{
return true;
}
@Override
public void attach(IComputerAccess computer, String computerSide) {}
@Override
public void detach(IComputerAccess computer) {}
@Override
public double getVoltage()
{
return 120;
}
@Override
public double getJoules(Object... data)
{
return electricityStored;
}
@Override
public void setJoules(double joules, Object... data)
{
electricityStored = Math.max(Math.min(joules, getMaxJoules()), 0);
}
@Override
public double getMaxJoules(Object... data)
{
return currentMaxElectricity;
}
@Override
public boolean demandsEnergy()
{
return electricityStored < currentMaxElectricity;
}
@Override
public void setActive(boolean active)
{
isActive = active;
if(prevActive != active)
{
sendPacket();
}
prevActive = active;
}
@Override
public boolean getActive()
{
return isActive;
}
@Override
public int injectEnergy(Direction direction, int i)
{
double givenEnergy = i*Mekanism.FROM_IC2;
double rejects = 0;
double neededEnergy = currentMaxElectricity-electricityStored;
if(givenEnergy < neededEnergy)
{
electricityStored += givenEnergy;
}
else if(givenEnergy > neededEnergy)
{
electricityStored += neededEnergy;
rejects = givenEnergy-neededEnergy;
}
return (int)(rejects*Mekanism.TO_IC2);
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common;
import mekanism.api.Tier.SmeltingFactoryTier;
public class TileEntityUltimateSmeltingFactory extends TileEntitySmeltingFactory
{
public TileEntityUltimateSmeltingFactory()
{
super(SmeltingFactoryTier.ULTIMATE);
}
}

View file

@ -329,11 +329,6 @@ public class BlockGenerator extends BlockContainer
world.spawnEntityInWorld(entityItem);
}
if(Mekanism.hooks.IC2Loaded)
{
EnergyNet.getForWorld(tileEntity.worldObj).removeTileEntity(tileEntity);
}
if(tileEntity instanceof IMultiBlock)
{
((IMultiBlock)tileEntity).onDestroy(tileEntity);
@ -367,7 +362,7 @@ public class BlockGenerator extends BlockContainer
{
if(!entityplayer.isSneaking())
{
entityplayer.openGui(MekanismGenerators.instance, GeneratorType.getGuiID(metadata), world, x, y, z);
entityplayer.openGui(MekanismGenerators.instance, GeneratorType.getFromMetadata(metadata).guiId, world, x, y, z);
return true;
}
}
@ -389,33 +384,7 @@ public class BlockGenerator extends BlockContainer
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{
if(metadata == GeneratorType.HEAT_GENERATOR.meta)
{
return new TileEntityHeatGenerator();
}
else if(metadata == GeneratorType.SOLAR_GENERATOR.meta)
{
return new TileEntitySolarGenerator();
}
else if(metadata == GeneratorType.ELECTROLYTIC_SEPARATOR.meta)
{
return new TileEntityElectrolyticSeparator();
}
else if(metadata == GeneratorType.HYDROGEN_GENERATOR.meta)
{
return new TileEntityHydrogenGenerator();
}
else if(metadata == GeneratorType.BIO_GENERATOR.meta)
{
return new TileEntityBioGenerator();
}
else if(metadata == GeneratorType.ADVANCED_SOLAR_GENERATOR.meta)
{
return new TileEntityAdvancedSolarGenerator();
}
else {
return null;
}
return GeneratorType.getFromMetadata(metadata).create();
}
@Override
@ -473,25 +442,43 @@ public class BlockGenerator extends BlockContainer
public static enum GeneratorType
{
HEAT_GENERATOR(0, 0),
SOLAR_GENERATOR(1, 1),
ELECTROLYTIC_SEPARATOR(2, 2),
HYDROGEN_GENERATOR(3, 3),
BIO_GENERATOR(4, 4),
ADVANCED_SOLAR_GENERATOR(5, 1);
HEAT_GENERATOR(0, 0, TileEntityHeatGenerator.class, true),
SOLAR_GENERATOR(1, 1, TileEntitySolarGenerator.class, false),
ELECTROLYTIC_SEPARATOR(2, 2, TileEntityElectrolyticSeparator.class, true),
HYDROGEN_GENERATOR(3, 3, TileEntityHydrogenGenerator.class, true),
BIO_GENERATOR(4, 4, TileEntityBioGenerator.class, true),
ADVANCED_SOLAR_GENERATOR(5, 1, TileEntityAdvancedSolarGenerator.class, true);
public int meta;
public int guiId;
public Class<? extends TileEntity> tileEntityClass;
public boolean hasModel;
private GeneratorType(int i, int j)
private GeneratorType(int i, int j, Class<? extends TileEntity> tileClass, boolean model)
{
meta = i;
guiId = j;
tileEntityClass = tileClass;
hasModel = model;
}
public static int getGuiID(int meta)
public static GeneratorType getFromMetadata(int meta)
{
return values()[meta].guiId;
return values()[meta];
}
public TileEntity create()
{
TileEntity tileEntity;
try {
tileEntity = tileEntityClass.newInstance();
return tileEntity;
} catch(Exception e) {
System.err.println("[Mekanism] Unable to indirectly create tile entity.");
e.printStackTrace();
return null;
}
}
@Override

View file

@ -26,6 +26,9 @@ public class GeneratorsCommonProxy
{
GameRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator");
GameRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator");
GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator");
GameRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator");
GameRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator");
}
/**

View file

@ -138,10 +138,7 @@ public class MekanismGenerators
public void addEntities()
{
GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator");
GameRegistry.registerTileEntity(TileEntitySolarGenerator.class, "SolarGenerator");
GameRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator");
GameRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator");
}
public void addBlocks()

View file

@ -89,6 +89,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
}
int fuel = getFuel(inventory[0]);
ItemStack prevStack = inventory[0].copy();
if(fuel > 0)
{
int fuelNeeded = bioFuelSlot.MAX_LIQUID - bioFuelSlot.liquidStored;
@ -98,6 +99,11 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
--inventory[0].stackSize;
}
if(prevStack.itemID == Mekanism.hooks.ForestryBiofuelBucket.itemID)
{
inventory[0] = Mekanism.hooks.ForestryBiofuelBucket;
}
if(inventory[0].stackSize == 0)
{
inventory[0] = null;

View file

@ -6,6 +6,7 @@ import ic2.api.Direction;
import ic2.api.ElectricItem;
import ic2.api.IElectricItem;
import ic2.api.IEnergySink;
import ic2.api.energy.EnergyTileSinkEvent;
import universalelectricity.core.electricity.ElectricInfo;
import universalelectricity.core.electricity.ElectricityConnections;
@ -30,6 +31,7 @@ import mekanism.common.PacketHandler;
import mekanism.common.TileEntityElectricBlock;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
@ -65,6 +67,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
@Override
public void onUpdate()
{
super.onUpdate();
if(demandsEnergy())
{
MinecraftForge.EVENT_BUS.post(new EnergyTileSinkEvent(this, (int)((MAX_ELECTRICITY-electricityStored)*Mekanism.TO_IC2)));
}
if(hydrogenStored > MAX_GAS)
{
hydrogenStored = MAX_GAS;

View file

@ -27,13 +27,14 @@ import universalelectricity.core.implement.IVoltage;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.tile.TileEntityConductor;
import mekanism.api.IActiveState;
import mekanism.common.Mekanism;
import mekanism.common.TileEntityElectricBlock;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IVoltage, IPeripheral
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IVoltage, IPeripheral, IActiveState
{
/** Output per tick this generator can transfer. */
public int output;
@ -61,17 +62,13 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
output = out;
isActive = false;
if(PowerFramework.currentFramework != null)
{
powerProvider = PowerFramework.currentFramework.createPowerProvider();
powerProvider.configure(0, 2, 2000, 1, (int)(MAX_ELECTRICITY*Mekanism.TO_BC));
}
}
@Override
public void onUpdate()
{
super.onUpdate();
if(electricityStored > 0)
{
TileEntity tileEntity = Vector3.getTileEntityFromSide(worldObj, Vector3.get(this), ForgeDirection.getOrientation(facing));
@ -151,10 +148,13 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
return (int)(electricityStored*i / MAX_ELECTRICITY);
}
/**
* Sets this block's active state to a new value.
* @param active - new active state
*/
@Override
public boolean getActive()
{
return isActive;
}
@Override
public void setActive(boolean active)
{
isActive = active;
@ -245,13 +245,13 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
@Override
public int getStored()
{
return (int)(electricityStored*Mekanism.FROM_IC2);
return (int)(electricityStored*Mekanism.TO_IC2);
}
@Override
public int getCapacity()
{
return (int)(MAX_ELECTRICITY*Mekanism.FROM_IC2);
return (int)(MAX_ELECTRICITY*Mekanism.TO_IC2);
}
@Override
@ -260,6 +260,25 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
return output;
}
@Override
public boolean isTeleporterCompatible(Direction side)
{
return side.toForgeDirection() == ForgeDirection.getOrientation(facing);
}
@Override
public int addEnergy(int amount)
{
setJoules(electricityStored + amount*Mekanism.FROM_IC2);
return (int)electricityStored;
}
@Override
public void setStored(int energy)
{
setJoules(energy*Mekanism.FROM_IC2);
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{

View file

@ -92,6 +92,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
}
int fuel = getFuel(inventory[0]);
ItemStack prevStack = inventory[0].copy();
if(fuel > 0)
{
int fuelNeeded = fuelSlot.MAX_LIQUID - fuelSlot.liquidStored;
@ -99,6 +100,11 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
{
fuelSlot.liquidStored += fuel;
--inventory[0].stackSize;
if(prevStack.itemID == Mekanism.hooks.BuildCraftFuelBucket.itemID)
{
inventory[0] = Mekanism.hooks.BuildCraftFuelBucket;
}
}
if(inventory[0].stackSize == 0)

View file

@ -27,6 +27,7 @@ import mekanism.common.TileEntityEnrichmentChamber;
import mekanism.common.TileEntityGasTank;
import mekanism.common.TileEntityPlatinumCompressor;
import mekanism.common.TileEntityEnergyCube;
import mekanism.common.TileEntitySmeltingFactory;
import mekanism.common.TileEntityTheoreticalElementizer;
import net.minecraft.client.Minecraft;
import net.minecraft.src.*;
@ -129,6 +130,8 @@ public class ClientProxy extends CommonProxy
return new GuiControlPanel((TileEntityControlPanel)tileEntity, player, world);
case 10:
return new GuiGasTank(player.inventory, (TileEntityGasTank)tileEntity);
case 11:
return new GuiSmeltingFactory(player.inventory, (TileEntitySmeltingFactory)tileEntity);
}
return null;
}

View file

@ -0,0 +1,77 @@
package mekanism.client;
import org.lwjgl.opengl.GL11;
import mekanism.api.Tier.SmeltingFactoryTier;
import mekanism.common.ContainerElectricMachine;
import mekanism.common.ContainerSmeltingFactory;
import mekanism.common.TileEntityElectricMachine;
import mekanism.common.TileEntitySmeltingFactory;
import net.minecraft.src.*;
public class GuiSmeltingFactory extends GuiContainer
{
public TileEntitySmeltingFactory tileEntity;
public GuiSmeltingFactory(InventoryPlayer inventory, TileEntitySmeltingFactory tentity)
{
super(new ContainerSmeltingFactory(inventory, tentity));
tileEntity = tentity;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
fontRenderer.drawString(tileEntity.fullName, 34, 4, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 93) + 2, 0x404040);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int texture = mc.renderEngine.getTexture("/resources/mekanism/gui/smelting/" + tileEntity.tier.guiTexturePath);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(texture);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
if(tileEntity.tier == SmeltingFactoryTier.BASIC)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 59 + (i*38);
displayInt = tileEntity.getScaledProgress(20, i);
drawTexturedModalRect(guiWidth + xAxis, guiHeight + 33, 176, 52, 8, displayInt);
}
}
if(tileEntity.tier == SmeltingFactoryTier.ADVANCED)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 39 + (i*26);
displayInt = tileEntity.getScaledProgress(20, i);
drawTexturedModalRect(guiWidth + xAxis, guiHeight + 33, 176, 52, 8, displayInt);
}
}
if(tileEntity.tier == SmeltingFactoryTier.ULTIMATE)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 33 + (i*19);
displayInt = tileEntity.getScaledProgress(20, i);
drawTexturedModalRect(guiWidth + xAxis, guiHeight + 33, 176, 52, 8, displayInt);
}
}
}
}

View file

@ -5,7 +5,7 @@ import java.util.Random;
import org.lwjgl.opengl.GL11;
import mekanism.api.IEnergyCube;
import mekanism.api.IEnergyCube.EnumTier;
import mekanism.api.Tier.EnergyCubeTier;
import mekanism.common.Mekanism;
import net.minecraft.src.*;
import net.minecraftforge.client.ForgeHooksClient;
@ -28,7 +28,7 @@ public class ItemRenderingHandler implements IItemRenderer
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
EnumTier tier = ((IEnergyCube)item.getItem()).getTier(item);
EnergyCubeTier tier = ((IEnergyCube)item.getItem()).getTier(item);
ForgeHooksClient.bindTexture(item.getItem().getTextureFile(), 0);
@ -37,7 +37,7 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
renderItem((RenderBlocks)data[0], tier == EnumTier.BASIC ? 0 : (tier == EnumTier.ADVANCED ? 1 : (tier == EnumTier.ULTIMATE ? 2 : 0)));
renderItem((RenderBlocks)data[0], tier == EnergyCubeTier.BASIC ? 0 : (tier == EnergyCubeTier.ADVANCED ? 1 : (tier == EnergyCubeTier.ULTIMATE ? 2 : 0)));
}
/**

View file

@ -17,8 +17,11 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
{
public ModelAdvancedSolarGenerator solarGenerator = new ModelAdvancedSolarGenerator();
public ModelAdvancedSolarGenerator advancedSolarGenerator = new ModelAdvancedSolarGenerator();
public ModelBioGenerator bioGenerator = new ModelBioGenerator();
public ModelHeatGenerator heatGenerator = new ModelHeatGenerator();
public ModelHydrogenGenerator hydrogenGenerator = new ModelHydrogenGenerator();
public ModelElectrolyticSeparator electrolyticSeparator = new ModelElectrolyticSeparator();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
@ -28,7 +31,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
if(block.blockID == MekanismGenerators.generatorID)
{
if(metadata == 4)
if(metadata == GeneratorType.BIO_GENERATOR.meta)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
@ -36,13 +39,36 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/BioGenerator.png"));
bioGenerator.render(0.0625F);
}
else if(metadata == 5)
else if(metadata == GeneratorType.ADVANCED_SOLAR_GENERATOR.meta)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.3F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/AdvancedSolarGenerator.png"));
solarGenerator.render(0.0F, 0.022F);
advancedSolarGenerator.render(0.0F, 0.022F);
}
else if(metadata == GeneratorType.HEAT_GENERATOR.meta)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
GL11.glTranslated(0.0F, -1.0F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/HeatGenerator.png"));
heatGenerator.render(0.0625F);
}
else if(metadata == GeneratorType.HYDROGEN_GENERATOR.meta)
{
GL11.glRotatef(180F, 0.0F, 1.0F, 1.0F);
GL11.glRotatef(90F, -1.0F, 0.0F, 0.0F);
GL11.glTranslated(0.0F, -1.0F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/HydrogenGenerator.png"));
hydrogenGenerator.render(0.0625F);
}
else if(metadata == GeneratorType.ELECTROLYTIC_SEPARATOR.meta)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslated(0.0F, -1.0F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/ElectrolyticSeparator.png"));
electrolyticSeparator.render(0.0625F);
}
else {
ForgeHooksClient.bindTexture(block.getTextureFile(), 0);
@ -60,7 +86,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
{
int metadata = world.getBlockMetadata(x, y, z);
if(metadata != 4 && metadata != 5)
if(!GeneratorType.getFromMetadata(metadata).hasModel)
{
renderer.renderStandardBlock(block, x, y, z);
renderer.func_83018_a(block);

View file

@ -25,6 +25,9 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
{
ClientRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator", new RenderAdvancedSolarGenerator(new ModelAdvancedSolarGenerator()));
ClientRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator", new RenderBioGenerator());
ClientRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator", new RenderHeatGenerator());
ClientRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator", new RenderHydrogenGenerator());
ClientRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator", new RenderElectrolyticSeparator());
}
@Override

View file

@ -2,6 +2,8 @@ package mekanism.generators.client;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import mekanism.api.EnumGas;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
@ -23,21 +25,15 @@ public class GuiElectrolyticSeparator extends GuiContainer
tileEntity = tentity;
}
/*@Override
public void initGui()
{
controlList.clear();
controlList.add(new GuiButton(1, width / 2 - 100, height / 4 + 96 + 12, ""));
}
@Override
protected void actionPerformed(GuiButton guibutton)
protected void mouseClicked(int x, int y, int button)
{
if(!guibutton.enabled)
{
return;
}
if(guibutton.id == 1)
super.mouseClicked(x, y, button);
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
{
if(tileEntity.outputType == EnumGas.OXYGEN)
{
@ -49,16 +45,16 @@ public class GuiElectrolyticSeparator extends GuiContainer
}
PacketHandler.sendTileEntityPacketToServer(tileEntity, tileEntity.outputType.name);
outputButton.displayString = tileEntity.outputType.name;
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}
}
}*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString("Output", 124, 73, 0x404040);
}
@Override
@ -70,6 +66,9 @@ public class GuiElectrolyticSeparator extends GuiContainer
guiWidth = (width - xSize) / 2;
guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
drawTexturedModalRect(guiWidth + 160, guiHeight + 73, 176, (tileEntity.outputType == EnumGas.OXYGEN ? 82 : 90), 8, 8);
int displayInt;
displayInt = tileEntity.getScaledWaterLevel(52);

View file

@ -0,0 +1,234 @@
package mekanism.generators.client;
import net.minecraft.src.*;
public class ModelElectrolyticSeparator extends ModelBase
{
ModelRenderer A;
ModelRenderer B;
ModelRenderer C;
ModelRenderer D;
ModelRenderer E;
ModelRenderer F;
ModelRenderer G;
ModelRenderer H;
ModelRenderer I;
ModelRenderer J;
ModelRenderer K;
ModelRenderer L;
ModelRenderer M;
ModelRenderer N;
ModelRenderer OUTPUT;
ModelRenderer P;
ModelRenderer Q;
ModelRenderer R;
ModelRenderer S;
ModelRenderer T;
ModelRenderer U;
ModelRenderer V;
public ModelElectrolyticSeparator()
{
textureWidth = 128;
textureHeight = 128;
A = new ModelRenderer(this, 0, 0);
A.addBox(-8F, 0F, -8F, 16, 1, 16);
A.setRotationPoint(0F, 23F, 0F);
A.setTextureSize(128, 128);
A.mirror = true;
setRotation(A, 0F, 0F, 0F);
B = new ModelRenderer(this, 85, 0);
B.addBox(-2F, 0F, -2F, 4, 10, 4);
B.setRotationPoint(4F, 12F, -4F);
B.setTextureSize(128, 128);
B.mirror = true;
setRotation(B, 0F, 1.570796F, 0F);
C = new ModelRenderer(this, 66, 0);
C.addBox(-2F, 0F, -2F, 4, 10, 4);
C.setRotationPoint(-4F, 12F, -4F);
C.setTextureSize(128, 128);
C.mirror = true;
setRotation(C, 0F, 1.570796F, 0F);
D = new ModelRenderer(this, 48, 19);
D.addBox(-1F, -1F, 0F, 2, 2, 6);
D.setRotationPoint(-2F, 18F, -4F);
D.setTextureSize(128, 128);
D.mirror = true;
setRotation(D, 0F, 1.570796F, 0F);
E = new ModelRenderer(this, 0, 19);
E.addBox(0F, 0F, -6F, 4, 15, 14);
E.setRotationPoint(0F, 8F, 8F);
E.setTextureSize(128, 128);
E.mirror = true;
setRotation(E, 0F, 1.570796F, 0F);
F = new ModelRenderer(this, 103, 0);
F.addBox(-3F, -1F, -1F, 6, 2, 2);
F.setRotationPoint(4F, 20F, 1F);
F.setTextureSize(128, 128);
F.mirror = true;
setRotation(F, 0F, 1.570796F, 0F);
G = new ModelRenderer(this, 103, 0);
G.addBox(-3F, 0F, 0F, 6, 2, 2);
G.setRotationPoint(-5F, 20F, 1F);
G.setTextureSize(128, 128);
G.mirror = true;
setRotation(G, 0F, 1.570796F, 0F);
H = new ModelRenderer(this, 0, 50);
H.addBox(-2F, 0F, 0F, 4, 12, 2);
H.setRotationPoint(-8F, 11F, 6F);
H.setTextureSize(128, 128);
H.mirror = true;
setRotation(H, 0F, 1.570796F, 0F);
I = new ModelRenderer(this, 41, 28);
I.addBox(0F, 0F, 0F, 6, 1, 6);
I.setRotationPoint(-7F, 22F, -7F);
I.setTextureSize(128, 128);
I.mirror = true;
setRotation(I, 0F, 0F, 0F);
J = new ModelRenderer(this, 41, 28);
J.addBox(0F, 0F, 0F, 6, 1, 6);
J.setRotationPoint(1F, 22F, -7F);
J.setTextureSize(128, 128);
J.mirror = true;
setRotation(J, 0F, 0F, 0F);
K = new ModelRenderer(this, 66, 16);
K.addBox(0F, 0F, 0F, 2, 1, 2);
K.setRotationPoint(-5F, 11F, -5F);
K.setTextureSize(128, 128);
K.mirror = true;
setRotation(K, 0F, 0F, 0F);
L = new ModelRenderer(this, 85, 15);
L.addBox(0F, 0F, 0F, 2, 2, 2);
L.setRotationPoint(3F, 10F, -5F);
L.setTextureSize(128, 128);
L.mirror = true;
setRotation(L, 0F, 0F, 0F);
M = new ModelRenderer(this, 66, 22);
M.addBox(-1F, 0F, -1F, 2, 2, 6);
M.setRotationPoint(-4F, 9F, -4F);
M.setTextureSize(128, 128);
M.mirror = true;
setRotation(M, 0F, 1.570796F, 0F);
N = new ModelRenderer(this, 66, 32);
N.addBox(-1F, -1F, -1F, 2, 6, 2);
N.setRotationPoint(0F, 12F, -4F);
N.setTextureSize(128, 128);
N.mirror = true;
setRotation(N, 0F, 0F, 0F);
OUTPUT = new ModelRenderer(this, 66, 42);
OUTPUT.addBox(-1F, -1F, -1F, 4, 2, 2);
OUTPUT.setRotationPoint(0F, 16F, -5F);
OUTPUT.setTextureSize(128, 128);
OUTPUT.mirror = true;
setRotation(OUTPUT, 0F, 1.570796F, 0F);
P = new ModelRenderer(this, 85, 21);
P.addBox(-1F, -1F, -1F, 2, 3, 2);
P.setRotationPoint(5F, 9F, -4F);
P.setTextureSize(128, 128);
P.mirror = true;
setRotation(P, 0F, 0F, 0.6457718F);
Q = new ModelRenderer(this, 0, 65);
Q.addBox(0F, 0F, -2F, 3, 11, 6);
Q.setRotationPoint(-8F, 12F, 0F);
Q.setTextureSize(128, 128);
Q.mirror = true;
setRotation(Q, 0F, 0F, 0F);
R = new ModelRenderer(this, 0, 65);
R.addBox(0F, 0F, -3F, 3, 11, 6);
R.setRotationPoint(8F, 12F, 1F);
R.setTextureSize(128, 128);
R.mirror = true;
setRotation(R, 0F, 3.141593F, 0F);
S = new ModelRenderer(this, 0, 84);
S.addBox(0F, 0F, 0F, 4, 1, 1);
S.setRotationPoint(2F, 16F, 3F);
S.setTextureSize(128, 128);
S.mirror = true;
setRotation(S, 0F, 0F, 0F);
T = new ModelRenderer(this, 0, 84);
T.addBox(0F, 0F, 0F, 4, 1, 1);
T.setRotationPoint(-6F, 16F, 3F);
T.setTextureSize(128, 128);
T.mirror = true;
setRotation(T, 0F, 0F, 0F);
U = new ModelRenderer(this, 0, 87);
U.addBox(0F, 0F, 0F, 4, 1, 1);
U.setRotationPoint(-6F, 18F, 3F);
U.setTextureSize(128, 128);
U.mirror = true;
setRotation(U, 0F, 0F, 0F);
V = new ModelRenderer(this, 0, 87);
V.addBox(0F, 0F, 0F, 4, 1, 1);
V.setRotationPoint(2F, 18F, 3F);
V.setTextureSize(128, 128);
V.mirror = true;
setRotation(V, 0F, 0F, 0F);
}
public void render(float size)
{
A.render(size);
B.render(size);
C.render(size);
D.render(size);
E.render(size);
F.render(size);
G.render(size);
H.render(size);
I.render(size);
J.render(size);
K.render(size);
L.render(size);
M.render(size);
N.render(size);
OUTPUT.render(size);
P.render(size);
Q.render(size);
R.render(size);
S.render(size);
T.render(size);
U.render(size);
V.render(size);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
A.renderWithRotation(f5);
B.renderWithRotation(f5);
C.renderWithRotation(f5);
D.renderWithRotation(f5);
E.renderWithRotation(f5);
F.renderWithRotation(f5);
G.renderWithRotation(f5);
H.renderWithRotation(f5);
I.renderWithRotation(f5);
J.renderWithRotation(f5);
K.renderWithRotation(f5);
L.renderWithRotation(f5);
M.renderWithRotation(f5);
N.renderWithRotation(f5);
OUTPUT.renderWithRotation(f5);
P.renderWithRotation(f5);
Q.renderWithRotation(f5);
R.renderWithRotation(f5);
S.renderWithRotation(f5);
T.renderWithRotation(f5);
U.renderWithRotation(f5);
V.renderWithRotation(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}

View file

@ -0,0 +1,171 @@
package mekanism.generators.client;
import net.minecraft.src.*;
public class ModelHeatGenerator extends ModelBase
{
ModelRenderer A;
ModelRenderer B;
ModelRenderer C;
ModelRenderer D;
ModelRenderer E;
ModelRenderer F;
ModelRenderer G;
ModelRenderer H;
ModelRenderer I;
ModelRenderer J;
ModelRenderer K;
ModelRenderer L;
ModelRenderer M;
ModelRenderer N;
ModelRenderer O;
public ModelHeatGenerator()
{
textureWidth = 128;
textureHeight = 128;
A = new ModelRenderer(this, 0, 0);
A.addBox(-8F, 0F, -8F, 16, 1, 16);
A.setRotationPoint(0F, 23F, 0F);
A.setTextureSize(128, 128);
A.mirror = true;
setRotation(A, 0F, 0F, 0F);
B = new ModelRenderer(this, 0, 85);
B.addBox(0F, 0F, 0F, 8, 6, 10);
B.setRotationPoint(-8F, 17F, -5F);
B.setTextureSize(128, 128);
B.mirror = true;
setRotation(B, 0F, 0F, 0F);
C = new ModelRenderer(this, 0, 67);
C.addBox(-1F, -2F, 0F, 2, 4, 12);
C.setRotationPoint(-5F, 20F, -6F);
C.setTextureSize(128, 128);
C.mirror = true;
setRotation(C, 0F, 0F, 1.570796F);
D = new ModelRenderer(this, 0, 67);
D.addBox(-1F, -2F, 0F, 2, 4, 12);
D.setRotationPoint(-5F, 20F, -6F);
D.setTextureSize(128, 128);
D.mirror = true;
setRotation(D, 0F, 0F, 0.5235988F);
E = new ModelRenderer(this, 0, 67);
E.addBox(-1F, -2F, 0F, 2, 4, 12);
E.setRotationPoint(-5F, 20F, -6F);
E.setTextureSize(128, 128);
E.mirror = true;
setRotation(E, 0F, 0F, -0.5235988F);
F = new ModelRenderer(this, 68, 0);
F.addBox(-2F, -4F, 0F, 4, 8, 10);
F.setRotationPoint(-4F, 13F, -5F);
F.setTextureSize(128, 128);
F.mirror = true;
setRotation(F, 0F, 0F, 0.5235988F);
G = new ModelRenderer(this, 68, 0);
G.addBox(-2F, -4F, 0F, 4, 8, 10);
G.setRotationPoint(-4F, 13F, -5F);
G.setTextureSize(128, 128);
G.mirror = true;
setRotation(G, 0F, 0F, -0.5235988F);
H = new ModelRenderer(this, 68, 0);
H.addBox(-2F, -4F, 0F, 4, 8, 10);
H.setRotationPoint(-4F, 13F, -5F);
H.setTextureSize(128, 128);
H.mirror = true;
setRotation(H, 0F, 0F, 1.570796F);
I = new ModelRenderer(this, 0, 18);
I.addBox(0F, 0F, 0F, 8, 13, 14);
I.setRotationPoint(0F, 10F, -6F);
I.setTextureSize(128, 128);
I.mirror = true;
setRotation(I, 0F, 0F, 0F);
J = new ModelRenderer(this, 0, 47);
J.addBox(0F, 0F, 0F, 6, 11, 1);
J.setRotationPoint(1F, 11F, -7F);
J.setTextureSize(128, 128);
J.mirror = true;
setRotation(J, 0F, 0F, 0F);
K = new ModelRenderer(this, 51, 21);
K.addBox(0F, 0F, 0F, 10, 4, 1);
K.setRotationPoint(-8F, 13F, -4F);
K.setTextureSize(128, 128);
K.mirror = true;
setRotation(K, 0F, 0F, 0F);
L = new ModelRenderer(this, 51, 21);
L.addBox(0F, 0F, 0F, 10, 4, 1);
L.setRotationPoint(-8F, 13F, 3F);
L.setTextureSize(128, 128);
L.mirror = true;
setRotation(L, 0F, 0F, 0F);
M = new ModelRenderer(this, 0, 103);
M.addBox(0F, 0F, 0F, 2, 4, 2);
M.setRotationPoint(-2F, 19F, -7F);
M.setTextureSize(128, 128);
M.mirror = true;
setRotation(M, 0F, 0F, 0F);
N = new ModelRenderer(this, 51, 0);
N.addBox(0F, 0F, 0F, 6, 1, 1);
N.setRotationPoint(-3F, 9F, 0F);
N.setTextureSize(128, 128);
N.mirror = true;
setRotation(N, 0F, 0F, 0F);
O = new ModelRenderer(this, 51, 0);
O.addBox(0F, 0F, 0F, 6, 1, 1);
O.setRotationPoint(-3F, 9F, 2F);
O.setTextureSize(128, 128);
O.mirror = true;
setRotation(O, 0F, 0F, 0F);
}
public void render(float size)
{
A.render(size);
B.render(size);
C.render(size);
D.render(size);
E.render(size);
F.render(size);
G.render(size);
H.render(size);
I.render(size);
J.render(size);
K.render(size);
L.render(size);
M.render(size);
N.render(size);
O.render(size);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
A.renderWithRotation(f5);
B.renderWithRotation(f5);
C.renderWithRotation(f5);
D.renderWithRotation(f5);
E.renderWithRotation(f5);
F.renderWithRotation(f5);
G.renderWithRotation(f5);
H.renderWithRotation(f5);
I.renderWithRotation(f5);
J.renderWithRotation(f5);
K.renderWithRotation(f5);
L.renderWithRotation(f5);
M.renderWithRotation(f5);
N.renderWithRotation(f5);
O.renderWithRotation(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}

View file

@ -0,0 +1,207 @@
package mekanism.generators.client;
import net.minecraft.src.*;
public class ModelHydrogenGenerator extends ModelBase
{
ModelRenderer A;
ModelRenderer B;
ModelRenderer C;
ModelRenderer D;
ModelRenderer E;
ModelRenderer F;
ModelRenderer G;
ModelRenderer H;
ModelRenderer I;
ModelRenderer J;
ModelRenderer K;
ModelRenderer L;
ModelRenderer M;
ModelRenderer N;
ModelRenderer O;
ModelRenderer P;
ModelRenderer Q;
ModelRenderer R;
ModelRenderer S;
public ModelHydrogenGenerator()
{
textureWidth = 128;
textureHeight = 128;
A = new ModelRenderer(this, 0, 0);
A.addBox(0F, 0F, 0F, 16, 1, 16);
A.setRotationPoint(-8F, 23F, -8F);
A.setTextureSize(128, 128);
A.mirror = true;
setRotation(A, 0F, 0F, 0F);
B = new ModelRenderer(this, 0, 45);
B.addBox(0F, 0F, 0F, 16, 12, 6);
B.setRotationPoint(-8F, 11F, -3F);
B.setTextureSize(128, 128);
B.mirror = true;
setRotation(B, 0F, 0F, 0F);
C = new ModelRenderer(this, 0, 64);
C.addBox(-3F, 0F, -8F, 6, 12, 12);
C.setRotationPoint(0F, 11F, 0F);
C.setTextureSize(128, 128);
C.mirror = true;
setRotation(C, 0F, 0F, 0F);
D = new ModelRenderer(this, 66, 0);
D.addBox(-3F, 0F, 0F, 6, 10, 4);
D.setRotationPoint(0F, 13F, 4F);
D.setTextureSize(128, 128);
D.mirror = true;
setRotation(D, 0F, 0F, 0F);
E = new ModelRenderer(this, 0, 20);
E.addBox(-5F, 0F, -3F, 10, 13, 6);
E.setRotationPoint(0F, 10F, 0F);
E.setTextureSize(128, 128);
E.mirror = true;
setRotation(E, 0F, 0.5235988F, 0F);
F = new ModelRenderer(this, 0, 20);
F.addBox(-5F, 0F, -3F, 10, 13, 6);
F.setRotationPoint(0F, 10F, 0F);
F.setTextureSize(128, 128);
F.mirror = true;
setRotation(F, 0F, -0.5235988F, 0F);
G = new ModelRenderer(this, 34, 20);
G.addBox(-3F, 0F, -5F, 6, 13, 10);
G.setRotationPoint(0F, 10F, 0F);
G.setTextureSize(128, 128);
G.mirror = true;
setRotation(G, 0F, 0F, 0F);
H = new ModelRenderer(this, 67, 20);
H.addBox(-2F, 0F, -1F, 4, 2, 2);
H.setRotationPoint(0F, 8F, 0F);
H.setTextureSize(128, 128);
H.mirror = true;
setRotation(H, 0F, -0.5235988F, 0F);
I = new ModelRenderer(this, 67, 20);
I.addBox(-2F, 0F, -1F, 4, 2, 2);
I.setRotationPoint(0F, 8F, 0F);
I.setTextureSize(128, 128);
I.mirror = true;
setRotation(I, 0F, 0.5235988F, 0F);
J = new ModelRenderer(this, 67, 26);
J.addBox(-1F, 0F, -2F, 2, 2, 4);
J.setRotationPoint(0F, 8F, 0F);
J.setTextureSize(128, 128);
J.mirror = true;
setRotation(J, 0F, 0F, 0F);
K = new ModelRenderer(this, 88, 0);
K.addBox(-3F, 0F, 0F, 6, 2, 5);
K.setRotationPoint(0F, 10F, 4F);
K.setTextureSize(128, 128);
K.mirror = true;
setRotation(K, -0.6457718F, 0F, 0F);
L = new ModelRenderer(this, 0, 97);
L.addBox(0F, 0F, 0F, 4, 10, 4);
L.setRotationPoint(2F, 13F, -5F);
L.setTextureSize(128, 128);
L.mirror = true;
setRotation(L, 0F, 0.7853982F, 0F);
M = new ModelRenderer(this, 0, 90);
M.addBox(0F, 0F, 0F, 3, 1, 2);
M.setRotationPoint(2F, 12F, -4F);
M.setTextureSize(128, 128);
M.mirror = true;
setRotation(M, 0F, 0.7853982F, 0F);
N = new ModelRenderer(this, 0, 97);
N.addBox(0F, 0F, 0F, 4, 10, 4);
N.setRotationPoint(-8F, 13F, -5F);
N.setTextureSize(128, 128);
N.mirror = true;
setRotation(N, 0F, 0.7853982F, 0F);
O = new ModelRenderer(this, 0, 90);
O.addBox(0F, 0F, 0F, 2, 1, 3);
O.setRotationPoint(-6F, 12F, -5F);
O.setTextureSize(128, 128);
O.mirror = true;
setRotation(O, 0F, 0.7853982F, 0F);
P = new ModelRenderer(this, 0, 118);
P.addBox(-5F, 0F, 0F, 10, 1, 1);
P.setRotationPoint(0F, 15F, -7F);
P.setTextureSize(128, 128);
P.mirror = true;
setRotation(P, 0F, 0F, 0F);
Q = new ModelRenderer(this, 0, 118);
Q.addBox(-5F, 0F, 0F, 10, 1, 1);
Q.setRotationPoint(0F, 19F, -7F);
Q.setTextureSize(128, 128);
Q.mirror = true;
setRotation(Q, 0F, 0F, 0F);
R = new ModelRenderer(this, 0, 112);
R.addBox(-7F, 0F, -3F, 14, 1, 3);
R.setRotationPoint(0F, 15F, -2F);
R.setTextureSize(128, 128);
R.mirror = true;
setRotation(R, 0F, 0F, 0F);
S = new ModelRenderer(this, 0, 112);
S.addBox(-7F, 0F, -3F, 14, 1, 3);
S.setRotationPoint(0F, 19F, -2F);
S.setTextureSize(128, 128);
S.mirror = true;
setRotation(S, 0F, 0F, 0F);
}
public void render(float size)
{
A.render(size);
B.render(size);
C.render(size);
D.render(size);
E.render(size);
F.render(size);
G.render(size);
H.render(size);
I.render(size);
J.render(size);
K.render(size);
L.render(size);
M.render(size);
N.render(size);
O.render(size);
P.render(size);
Q.render(size);
R.render(size);
S.render(size);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
A.renderWithRotation(f5);
B.renderWithRotation(f5);
C.renderWithRotation(f5);
D.renderWithRotation(f5);
E.renderWithRotation(f5);
F.renderWithRotation(f5);
G.renderWithRotation(f5);
H.renderWithRotation(f5);
I.renderWithRotation(f5);
J.renderWithRotation(f5);
K.renderWithRotation(f5);
L.renderWithRotation(f5);
M.renderWithRotation(f5);
N.renderWithRotation(f5);
O.renderWithRotation(f5);
P.renderWithRotation(f5);
Q.renderWithRotation(f5);
R.renderWithRotation(f5);
S.renderWithRotation(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}

View file

@ -0,0 +1,36 @@
package mekanism.generators.client;
import org.lwjgl.opengl.GL11;
import mekanism.generators.common.TileEntityElectrolyticSeparator;
import net.minecraft.src.*;
public class RenderElectrolyticSeparator extends TileEntitySpecialRenderer
{
private ModelElectrolyticSeparator model = new ModelElectrolyticSeparator();
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8)
{
renderAModelAt((TileEntityElectrolyticSeparator) var1, var2, var4, var6, 1F);
}
private void renderAModelAt(TileEntityElectrolyticSeparator tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
bindTextureByName("/resources/mekanism/render/ElectrolyticSeparator.png");
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
}
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
model.render(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -0,0 +1,35 @@
package mekanism.generators.client;
import org.lwjgl.opengl.GL11;
import mekanism.generators.common.TileEntityHeatGenerator;
import net.minecraft.src.*;
public class RenderHeatGenerator extends TileEntitySpecialRenderer
{
private ModelHeatGenerator model = new ModelHeatGenerator();
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8)
{
renderAModelAt((TileEntityHeatGenerator) var1, var2, var4, var6, 1F);
}
private void renderAModelAt(TileEntityHeatGenerator tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
bindTextureByName("/resources/mekanism/render/HeatGenerator.png");
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
}
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -0,0 +1,38 @@
package mekanism.generators.client;
import mekanism.generators.common.TileEntityHydrogenGenerator;
import net.minecraft.src.*;
import org.lwjgl.opengl.GL11;
public class RenderHydrogenGenerator extends TileEntitySpecialRenderer
{
private ModelHydrogenGenerator model = new ModelHydrogenGenerator();
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8)
{
renderAModelAt((TileEntityHydrogenGenerator) var1, var2, var4, var6, 1F);
}
private void renderAModelAt(TileEntityHydrogenGenerator tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
bindTextureByName("/resources/mekanism/render/HydrogenGenerator.png");
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
}
GL11.glRotatef(180F, 0.0F, 1.0F, 1.0F);
GL11.glRotatef(90F, -1.0F, 0.0F, 0.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
model.render(0.0625F);
GL11.glPopMatrix();
}
}