Fix typo, start work on fancy Energy Cube rendering :)

This commit is contained in:
Aidan Brady 2013-11-02 21:07:55 -04:00
parent d1a1e3375a
commit 64fe3a21ea
21 changed files with 353 additions and 78 deletions

View file

@ -43,6 +43,7 @@ import mekanism.client.render.tileentity.RenderConfigurableMachine;
import mekanism.client.render.tileentity.RenderDynamicTank;
import mekanism.client.render.tileentity.RenderElectricChest;
import mekanism.client.render.tileentity.RenderElectricPump;
import mekanism.client.render.tileentity.RenderEnergyCube;
import mekanism.client.render.tileentity.RenderLogisticalSorter;
import mekanism.client.render.tileentity.RenderLogisticalTransporter;
import mekanism.client.render.tileentity.RenderMechanicalPipe;
@ -225,6 +226,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter", new RenderConfigurableMachine());
ClientRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser", new RenderMetallurgicInfuser());
ClientRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube", new RenderEnergyCube());
ClientRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube", new RenderPressurizedTube());
ClientRegistry.registerTileEntity(TileEntityUniversalCable.class, "UniversalCable", new RenderUniversalCable());
ClientRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump", new RenderElectricPump());

View file

@ -55,6 +55,8 @@ public class ClientTickHandler implements ITickHandler
}).start();
}
MekanismClient.ticksPassed++;
if(!hasNotified && mc.theWorld != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null)
{
MekanismUtils.checkForUpdates(mc.thePlayer);

View file

@ -14,4 +14,6 @@ public class MekanismClient extends Mekanism
//General Configuration
public static boolean enableSounds = true;
public static boolean fancyUniversalCableRender = true;
public static long ticksPassed = 0;
}

View file

@ -0,0 +1,211 @@
package mekanism.client.model;
import mekanism.client.render.MekanismRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelEnergyCube extends ModelBase
{
ModelRenderer Corner1;
ModelRenderer Corner2;
ModelRenderer Corner3;
ModelRenderer Corner4;
ModelRenderer Corner5;
ModelRenderer Corner6;
ModelRenderer Corner7;
ModelRenderer Corner8;
ModelRenderer Frame4;
ModelRenderer Frame3;
ModelRenderer Frame2;
ModelRenderer Frame1;
ModelRenderer HoriPole1;
ModelRenderer HoriPole2;
ModelRenderer HoriPole3;
ModelRenderer HoriPole4;
ModelRenderer HoriPole5;
ModelRenderer HoriPole6;
ModelRenderer HoriPole7;
ModelRenderer HoriPole8;
public ModelEnergyCube()
{
textureWidth = 64;
textureHeight = 64;
Corner1 = new ModelRenderer(this, 0, 17);
Corner1.addBox(0F, 0F, 0F, 3, 3, 3);
Corner1.setRotationPoint(5F, 21F, -8F);
Corner1.setTextureSize(64, 64);
Corner1.mirror = true;
setRotation(Corner1, 0F, 0F, 0F);
Corner2 = new ModelRenderer(this, 0, 17);
Corner2.addBox(0F, 0F, 0F, 3, 3, 3);
Corner2.setRotationPoint(-8F, 21F, -8F);
Corner2.setTextureSize(64, 64);
Corner2.mirror = true;
setRotation(Corner2, 0F, 0F, 0F);
Corner3 = new ModelRenderer(this, 0, 17);
Corner3.addBox(0F, 0F, 0F, 3, 3, 3);
Corner3.setRotationPoint(5F, 21F, 5F);
Corner3.setTextureSize(64, 64);
Corner3.mirror = true;
setRotation(Corner3, 0F, 0F, 0F);
Corner4 = new ModelRenderer(this, 0, 17);
Corner4.addBox(0F, 0F, 0F, 3, 3, 3);
Corner4.setRotationPoint(-8F, 21F, 5F);
Corner4.setTextureSize(64, 64);
Corner4.mirror = true;
setRotation(Corner4, 0F, 0F, 0F);
Corner5 = new ModelRenderer(this, 0, 17);
Corner5.addBox(0F, 0F, 0F, 3, 3, 3);
Corner5.setRotationPoint(5F, 8F, -8F);
Corner5.setTextureSize(64, 64);
Corner5.mirror = true;
setRotation(Corner5, 0F, 0F, 0F);
Corner6 = new ModelRenderer(this, 0, 17);
Corner6.addBox(0F, 0F, 0F, 3, 3, 3);
Corner6.setRotationPoint(-8F, 8F, -8F);
Corner6.setTextureSize(64, 64);
Corner6.mirror = true;
setRotation(Corner6, 0F, 0F, 0F);
Corner7 = new ModelRenderer(this, 0, 17);
Corner7.addBox(0F, 0F, 0F, 3, 3, 3);
Corner7.setRotationPoint(-8F, 8F, 5F);
Corner7.setTextureSize(64, 64);
Corner7.mirror = true;
setRotation(Corner7, 0F, 0F, 0F);
Corner8 = new ModelRenderer(this, 0, 17);
Corner8.addBox(0F, 0F, 0F, 3, 3, 3);
Corner8.setRotationPoint(5F, 8F, 5F);
Corner8.setTextureSize(64, 64);
Corner8.mirror = true;
setRotation(Corner8, 0F, 0F, 0F);
Frame4 = new ModelRenderer(this, 0, 24);
Frame4.addBox(0F, 0F, 0F, 3, 10, 3);
Frame4.setRotationPoint(5F, 11F, -8F);
Frame4.setTextureSize(64, 64);
Frame4.mirror = true;
setRotation(Frame4, 0F, 0F, 0F);
Frame3 = new ModelRenderer(this, 0, 24);
Frame3.addBox(0F, 0F, 0F, 3, 10, 3);
Frame3.setRotationPoint(-8F, 11F, -8F);
Frame3.setTextureSize(64, 64);
Frame3.mirror = true;
setRotation(Frame3, 0F, 0F, 0F);
Frame2 = new ModelRenderer(this, 0, 24);
Frame2.addBox(0F, 0F, 0F, 3, 10, 3);
Frame2.setRotationPoint(-8F, 11F, 5F);
Frame2.setTextureSize(64, 64);
Frame2.mirror = true;
setRotation(Frame2, 0F, 0F, 0F);
Frame1 = new ModelRenderer(this, 0, 24);
Frame1.addBox(0F, 0F, 0F, 3, 10, 3);
Frame1.setRotationPoint(5F, 11F, 5F);
Frame1.setTextureSize(64, 64);
Frame1.mirror = true;
setRotation(Frame1, 0F, 0F, 0F);
HoriPole1 = new ModelRenderer(this, 27, 0);
HoriPole1.addBox(0F, 0F, 0F, 3, 3, 10);
HoriPole1.setRotationPoint(5F, 21F, -5F);
HoriPole1.setTextureSize(64, 64);
HoriPole1.mirror = true;
setRotation(HoriPole1, 0F, 0F, 0F);
HoriPole2 = new ModelRenderer(this, 0, 0);
HoriPole2.addBox(0F, 0F, 0F, 10, 3, 3);
HoriPole2.setRotationPoint(-5F, 21F, 5F);
HoriPole2.setTextureSize(64, 64);
HoriPole2.mirror = true;
setRotation(HoriPole2, 0F, 0F, 0F);
HoriPole3 = new ModelRenderer(this, 27, 0);
HoriPole3.addBox(0F, 0F, 0F, 3, 3, 10);
HoriPole3.setRotationPoint(-8F, 21F, -5F);
HoriPole3.setTextureSize(64, 64);
HoriPole3.mirror = true;
setRotation(HoriPole3, 0F, 0F, 0F);
HoriPole4 = new ModelRenderer(this, 0, 0);
HoriPole4.addBox(0F, 0F, 0F, 10, 3, 3);
HoriPole4.setRotationPoint(-5F, 21F, -8F);
HoriPole4.setTextureSize(64, 64);
HoriPole4.mirror = true;
setRotation(HoriPole4, 0F, 0F, 0F);
HoriPole5 = new ModelRenderer(this, 27, 0);
HoriPole5.addBox(0F, 0F, 0F, 3, 3, 10);
HoriPole5.setRotationPoint(5F, 8F, -5F);
HoriPole5.setTextureSize(64, 64);
HoriPole5.mirror = true;
setRotation(HoriPole5, 0F, 0F, 0F);
HoriPole6 = new ModelRenderer(this, 0, 0);
HoriPole6.addBox(0F, 0F, 0F, 10, 3, 3);
HoriPole6.setRotationPoint(-5F, 8F, 5F);
HoriPole6.setTextureSize(64, 64);
HoriPole6.mirror = true;
setRotation(HoriPole6, 0F, 0F, 0F);
HoriPole7 = new ModelRenderer(this, 27, 0);
HoriPole7.addBox(0F, 0F, 0F, 3, 3, 10);
HoriPole7.setRotationPoint(-8F, 8F, -5F);
HoriPole7.setTextureSize(64, 64);
HoriPole7.mirror = true;
setRotation(HoriPole7, 0F, 0F, 0F);
HoriPole8 = new ModelRenderer(this, 0, 0);
HoriPole8.addBox(0F, 0F, 0F, 10, 3, 3);
HoriPole8.setRotationPoint(-5F, 8F, -8F);
HoriPole8.setTextureSize(64, 64);
HoriPole8.mirror = true;
setRotation(HoriPole8, 0F, 0F, 0F);
}
public void render(float size)
{
MekanismRenderer.glowOn();
Corner1.render(size);
Corner2.render(size);
Corner3.render(size);
Corner4.render(size);
Corner5.render(size);
Corner6.render(size);
Corner7.render(size);
Corner8.render(size);
MekanismRenderer.glowOff();
Frame4.render(size);
Frame3.render(size);
Frame2.render(size);
Frame1.render(size);
HoriPole1.render(size);
HoriPole2.render(size);
HoriPole3.render(size);
HoriPole4.render(size);
HoriPole5.render(size);
HoriPole6.render(size);
HoriPole7.render(size);
HoriPole8.render(size);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public static class ModelEnergyCore extends ModelBase
{
private ModelRenderer cube;
public ModelEnergyCore()
{
textureWidth = 32;
textureHeight = 32;
cube = new ModelRenderer(this, 0, 0);
cube.addBox(-8, -8, -8, 16, 16, 16);
cube.setTextureSize(32, 32);
cube.mirror = true;
}
public void render(float size)
{
cube.render(0.0625F);
}
}
}

View file

@ -54,7 +54,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.95F, -0.10F);
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "MetallurgicInfuser.png"));
metallurgicInfuser.render(0.0625F);
}

View file

@ -1,6 +1,7 @@
package mekanism.client.render.item;
import mekanism.client.ClientProxy;
import mekanism.client.model.ModelEnergyCube;
import mekanism.client.model.ModelRobit;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.IElectricChest;
@ -16,17 +17,11 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
@ -37,6 +32,7 @@ public class ItemRenderingHandler implements IItemRenderer
{
public ModelRobit robit = new ModelRobit();
public ModelChest electricChest = new ModelChest();
public ModelEnergyCube energyCube = new ModelEnergyCube();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
@ -66,9 +62,13 @@ public class ItemRenderingHandler implements IItemRenderer
if(item.getItem() instanceof IEnergyCube)
{
EnergyCubeTier tier = ((IEnergyCube)item.getItem()).getEnergyCubeTier(item);
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderItem((RenderBlocks)data[0], tier.ordinal(), Mekanism.EnergyCube);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "EnergyCube" + tier.name + ".png"));
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
energyCube.render(0.0625F);
}
else if(item.getItem() instanceof ItemWalkieTalkie)
{

View file

@ -0,0 +1,74 @@
package mekanism.client.render.tileentity;
import mekanism.api.EnumColor;
import mekanism.client.MekanismClient;
import mekanism.client.model.ModelEnergyCube;
import mekanism.client.model.ModelEnergyCube.ModelEnergyCore;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.tileentity.TileEntityEnergyCube;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderEnergyCube extends TileEntitySpecialRenderer
{
private ModelEnergyCube model = new ModelEnergyCube();
private ModelEnergyCore core = new ModelEnergyCore();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
renderAModelAt((TileEntityEnergyCube)tileEntity, x, y, z, 1F);
}
private void renderAModelAt(TileEntityEnergyCube tileEntity, double x, double y, double z, float partialTick)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "EnergyCube" + tileEntity.tier.name + ".png"));
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F);
GL11.glPopMatrix();
//Energy Core Render
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "EnergyCore.png"));
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
MekanismRenderer.glowOn();
EnumColor c = tileEntity.tier.color;
GL11.glPushMatrix();
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glColor4f(c.getColor(0), c.getColor(1), c.getColor(2), tileEntity.getEnergyStored()/tileEntity.getMaxEnergyStored());
GL11.glTranslatef(0, (float)Math.sin(Math.toRadians((MekanismClient.ticksPassed + partialTick) * 3)) / 7, 0);
GL11.glRotatef((MekanismClient.ticksPassed + partialTick) * 4, 0, 1, 0);
GL11.glRotatef(36F + (MekanismClient.ticksPassed + partialTick) * 4, 0, 1, 1);
core.render(0.0625F);
GL11.glPopMatrix();
MekanismRenderer.glowOff();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}

View file

@ -75,6 +75,7 @@ public class CommonProxy
GameRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber");
GameRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter");
GameRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser");
GameRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube");
GameRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube");
GameRegistry.registerTileEntity(TileEntityUniversalCable.class, "UniversalCable");
GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump");

View file

@ -189,7 +189,7 @@ public class Mekanism
public static Item TeleportationCore;
public static Item Configurator;
public static Item NetworkReader;
public static Item MaganeseAlloy;
public static Item ManganeseAlloy;
public static Item WalkieTalkie;
//Blocks
@ -238,9 +238,6 @@ public class Mekanism
public static double purificationChamberUsage;
public static double energizedSmelterUsage;
/** Total ticks passed since thePlayer joined theWorld */
public static int ticksPassed = 0;
/**
* Adds all in-game crafting and smelting recipes.
*/
@ -340,7 +337,7 @@ public class Mekanism
"RER", Character.valueOf('R'), Item.redstone, Character.valueOf('E'), EnrichedAlloy
}));
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(EnrichedIron, 2), new Object[] {
MaganeseAlloy, Item.ingotIron
ManganeseAlloy, Item.ingotIron
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock, 1, 8), new Object[] {
"IFI", "CEC", "IFI", Character.valueOf('I'), Item.ingotIron, Character.valueOf('F'), Block.furnaceIdle, Character.valueOf('C'), "circuitBasic", Character.valueOf('E'), EnrichedAlloy
@ -494,7 +491,7 @@ public class Mekanism
InfuseRegistry.registerInfuseObject(new ItemStack(CompressedCarbon), new InfuseObject(InfuseRegistry.get("CARBON"), 100));
//Smelting
FurnaceRecipes.smelting().addSmelting(Block.dirt.blockID, new ItemStack(MaganeseAlloy, 2), 0);
FurnaceRecipes.smelting().addSmelting(Block.dirt.blockID, new ItemStack(ManganeseAlloy, 2), 0);
}
/**
@ -525,7 +522,7 @@ public class Mekanism
DirtyDust = new ItemDirtyDust(configuration.getItem("DirtyDust", 11220).getInt()-256);
Configurator = new ItemConfigurator(configuration.getItem("Configurator", 11221).getInt()).setUnlocalizedName("Configurator");
NetworkReader = new ItemNetworkReader(configuration.getItem("NetworkReader", 11222).getInt()).setUnlocalizedName("NetworkReader");
MaganeseAlloy = new ItemMekanism(configuration.getItem("MaganeseAlloy", 11223).getInt()).setUnlocalizedName("MaganeseAlloy");
ManganeseAlloy = new ItemMekanism(configuration.getItem("ManganeseAlloy", 11223).getInt()).setUnlocalizedName("ManganeseAlloy");
WalkieTalkie = new ItemWalkieTalkie(configuration.getItem("WalkieTalkie", 11224).getInt()).setUnlocalizedName("WalkieTalkie");
configuration.save();
@ -550,7 +547,7 @@ public class Mekanism
GameRegistry.registerItem(DirtyDust, "DirtyDust");
GameRegistry.registerItem(Configurator, "Configurator");
GameRegistry.registerItem(NetworkReader, "NetworkReader");
GameRegistry.registerItem(MaganeseAlloy, "MaganeseAlloy");
GameRegistry.registerItem(ManganeseAlloy, "MaganeseAlloy");
GameRegistry.registerItem(WalkieTalkie, "WalkieTalkie");
}
@ -1005,7 +1002,6 @@ public class Mekanism
EntityRegistry.registerModEntity(EntityRobit.class, "Robit", 1, this, 40, 2, true);
//Tile entities
GameRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube");
GameRegistry.registerTileEntity(TileEntityBoundingBlock.class, "BoundingBlock");
GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank");
GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter");

View file

@ -1,5 +1,6 @@
package mekanism.common;
import mekanism.api.EnumColor;
import net.minecraft.util.ResourceLocation;
/**
@ -16,15 +17,16 @@ public final class Tier
*/
public static enum EnergyCubeTier
{
BASIC("Basic", 2000000, 120, 800),
ADVANCED("Advanced", 8000000, 240, 3200),
ELITE("Elite", 32000000, 240, 12800),
ULTIMATE("Ultimate", 128000000, 480, 51200);
BASIC("Basic", EnumColor.BRIGHT_GREEN, 2000000, 120, 800),
ADVANCED("Advanced", EnumColor.DARK_RED, 8000000, 240, 3200),
ELITE("Elite", EnumColor.DARK_BLUE, 32000000, 240, 12800),
ULTIMATE("Ultimate", EnumColor.PURPLE, 128000000, 480, 51200);
public double MAX_ELECTRICITY;
public float VOLTAGE;
public double OUTPUT;
public String name;
public EnumColor color;
public static EnergyCubeTier getFromName(String tierName)
{
@ -40,9 +42,10 @@ public final class Tier
return BASIC;
}
private EnergyCubeTier(String s, double maxEnergy, float voltage, int out)
private EnergyCubeTier(String s, EnumColor c, double maxEnergy, float voltage, int out)
{
name = s;
color = c;
MAX_ELECTRICITY = maxEnergy;
VOLTAGE = voltage;
OUTPUT = out;

View file

@ -186,7 +186,11 @@ public class TileComponentEjector implements ITileComponent, IEjector
public void write(NBTTagCompound nbtTags)
{
nbtTags.setBoolean("ejecting", ejecting);
nbtTags.setInteger("ejectColor", TransporterUtils.colors.indexOf(ejectColor));
if(ejectColor != null)
{
nbtTags.setInteger("ejectColor", TransporterUtils.colors.indexOf(ejectColor));
}
for(int i = 0; i < sideData.availableSlots.length; i++)
{

View file

@ -7,6 +7,7 @@ import java.util.List;
import java.util.Random;
import mekanism.api.energy.IEnergizedItem;
import mekanism.client.ClientProxy;
import mekanism.common.IEnergyCube;
import mekanism.common.ISustainedInventory;
import mekanism.common.Mekanism;
@ -52,41 +53,11 @@ public class BlockEnergyCube extends BlockContainer
setHardness(2F);
setResistance(4F);
setCreativeTab(Mekanism.tabMekanism);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register)
{
icons[0][0] = register.registerIcon("mekanism:BasicEnergyCubeFront");
icons[0][1] = register.registerIcon("mekanism:BasicEnergyCubeSide");
icons[1][0] = register.registerIcon("mekanism:AdvancedEnergyCubeFront");
icons[1][1] = register.registerIcon("mekanism:AdvancedEnergyCubeSide");
icons[2][0] = register.registerIcon("mekanism:EliteEnergyCubeFront");
icons[2][1] = register.registerIcon("mekanism:EliteEnergyCubeSide");
icons[3][0] = register.registerIcon("mekanism:UltimateEnergyCubeFront");
icons[3][1] = register.registerIcon("mekanism:UltimateEnergyCubeSide");
}
@Override
public void setBlockBoundsForItemRender()
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
if(side == 3)
{
return icons[meta][0];
}
else {
return icons[meta][1];
}
}
public void registerIcons(IconRegister register) {}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
@ -116,22 +87,6 @@ public class BlockEnergyCube extends BlockContainer
tileEntity.setFacing((short)change);
}
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
int metadata = world.getBlockMetadata(x, y, z);
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getBlockTileEntity(x, y, z);
if(side == tileEntity.facing)
{
return icons[tileEntity.tier.ordinal()][0];
}
else {
return icons[tileEntity.tier.ordinal()][1];
}
}
@Override
public int quantityDropped(Random random)
@ -258,6 +213,24 @@ public class BlockEnergyCube extends BlockContainer
return new TileEntityEnergyCube();
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{

View file

@ -650,6 +650,11 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
@Override
public TileEntity createTileEntity(World world, int metadata)
{
if(MachineType.getFromMetadata(metadata) == null)
{
return null;
}
return MachineType.getFromMetadata(metadata).create();
}

View file

@ -279,7 +279,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
public double transferEnergyToAcceptor(double amount)
{
double rejects = 0;
double neededElectricity = MekanismUtils.getEnergy(getEnergyMultiplier(), getMaxEnergy())-getEnergy();
double neededElectricity = getMaxEnergy()-getEnergy();
if(amount <= neededElectricity)
{

View file

@ -295,9 +295,10 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
@Override
public void handlePacketData(ByteArrayDataInput dataStream)
{
tier = EnergyCubeTier.getFromName(dataStream.readUTF());
super.handlePacketData(dataStream);
tier = EnergyCubeTier.getFromName(dataStream.readUTF());
controlType = RedstoneControl.values()[dataStream.readInt()];
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
@ -306,9 +307,10 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
@Override
public ArrayList getNetworkedData(ArrayList data)
{
data.add(tier.name);
super.getNetworkedData(data);
data.add(tier.name);
data.add(controlType.ordinal());
return data;

View file

@ -167,10 +167,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
}
}
if(oxygenStored < MAX_GAS && hydrogenStored < MAX_GAS && waterTank.getFluid() != null && waterTank.getFluid().amount-2 >= 0 && electricityStored-100 > 0)
if(oxygenStored < MAX_GAS && hydrogenStored < MAX_GAS && waterTank.getFluid() != null && waterTank.getFluid().amount-2 >= 0 && getEnergy()-100 > 0)
{
waterTank.drain(2, true);
setEnergy(electricityStored - MekanismGenerators.electrolyticSeparatorUsage);
setEnergy(getEnergy() - MekanismGenerators.electrolyticSeparatorUsage);
setGas(EnumGas.OXYGEN, oxygenStored + 1);
setGas(EnumGas.HYDROGEN, hydrogenStored + 2);
}
@ -288,7 +288,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
public double transferEnergyToAcceptor(double amount)
{
double rejects = 0;
double neededElectricity = MAX_ELECTRICITY-electricityStored;
double neededElectricity = getMaxEnergy()-getEnergy();
if(amount <= neededElectricity)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB