Added transformer, non-functional

This commit is contained in:
Calclavia 2013-12-23 21:12:23 +08:00
parent 2120899b20
commit 2eba46403e
14 changed files with 788 additions and 215 deletions

@ -1 +1 @@
Subproject commit 79e07ab7df7c6bae262b0e7dc47cc927a63ae6cf
Subproject commit 69b901b771b4719e5342e2ca723d3cb4f3d8ac09

View file

@ -6,6 +6,7 @@ itemGroup.resonantinduction=Resonant Induction
tile.resonantinduction\:tesla.name=Tesla Coil
tile.resonantinduction\:contractor.name=Electromagnetic Levitator
tile.resonantinduction\:battery.name=Battery
tile.resonantinduction\:transformer.name=Transformer
## Items
item.resonantinduction\:quantumEntangler.name=Quantum Entangler
@ -20,3 +21,6 @@ item.resonantinduction\:wire.iron.name=Iron Wire
item.resonantinduction\:wire.aluminum.name=Aluminum Wire
item.resonantinduction\:wire.silver.name=Silver Wire
item.resonantinduction\:wire.superconductor.name=Superconductor Wire
tooltip.transformer.stepUp=Step Up
tooltip.transformer.stepDown=Step Down

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -11,8 +11,8 @@ import resonantinduction.gui.GuiMultimeter;
import resonantinduction.levitator.RenderLevitator;
import resonantinduction.levitator.TileEntityEMContractor;
import resonantinduction.multimeter.PartMultimeter;
import resonantinduction.multimeter.RenderItemMultimeter;
import resonantinduction.render.BlockRenderingHandler;
import resonantinduction.render.RenderItemMultimeter;
import resonantinduction.render.RenderTesla;
import resonantinduction.tesla.TileEntityTesla;
import universalelectricity.api.vector.Vector3;

View file

@ -13,7 +13,7 @@ public class MultipartRI implements IPartFactory
public MultipartRI()
{
MultiPartRegistry.registerParts(this, new String[] { "resonant_induction_flat_wire", "resonant_induction_multimeter" });
MultiPartRegistry.registerParts(this, new String[] { "resonant_induction_flat_wire", "resonant_induction_multimeter", "resonant_induction_transformer" });
MultipartGenerator.registerTrait("universalelectricity.api.energy.IConductor", "resonantinduction.wire.part.TraitConductor");
MultipartGenerator.registerTrait("ic2.api.energy.tile.IEnergySink", "resonantinduction.wire.part.TraitEnergySink");
}
@ -29,6 +29,10 @@ public class MultipartRI implements IPartFactory
{
return new PartMultimeter();
}
else if (name.equals("resonant_induction_transformer"))
{
return new PartMultimeter();
}
return null;
}

View file

@ -20,6 +20,7 @@ import org.modstats.ModstatInfo;
import org.modstats.Modstats;
import resonantinduction.battery.BlockBattery;
import resonantinduction.battery.ItemBlockBattery;
import resonantinduction.battery.TileEntityBattery;
import resonantinduction.furnace.BlockAdvancedFurnace;
import resonantinduction.furnace.TileAdvancedFurnace;
@ -138,6 +139,7 @@ public class ResonantInduction
*/
private static Item itemPartWire;
public static Item itemMultimeter;
public static Item itemTransformer;
public static Item itemIOPanel;
// Blocks
@ -197,7 +199,7 @@ public class ResonantInduction
GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName());
GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName());
GameRegistry.registerBlock(blockBattery, blockBattery.getUnlocalizedName());
GameRegistry.registerBlock(blockBattery, ItemBlockBattery.class, blockBattery.getUnlocalizedName());
// Tiles
GameRegistry.registerTileEntity(TileEntityTesla.class, blockTesla.getUnlocalizedName());

View file

@ -18,6 +18,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
@ -43,8 +45,7 @@ public class RenderBattery extends TileEntitySpecialRenderer
private Random random = new Random();
protected RenderManager renderManager;
// public static final IModelCustom batteryModel =
// AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY + "battery.tcn");
public static final IModelCustom batteryModel = AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY + "battery.tcn");
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -54,214 +55,10 @@ public class RenderBattery extends TileEntitySpecialRenderer
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
/*if (((TileEntityBattery) t).structure.isMultiblock)
{
this.bindTexture(TEXTURE_MULTI);
}
else
{
this.bindTexture(TEXTURE);
}*/
MODEL.render(0.0625f);
/*
* GL11.glScalef(0.0625f, 0.0625f, 0.0625f); batteryModel.renderAll();
*/
GL11.glPopMatrix();
if (Minecraft.getMinecraft().gameSettings.fancyGraphics)
{
if (this.fakeBattery == null)
{
//this.fakeBattery = new EntityItem(t.worldObj, 0, 0, 0, new ItemStack(ResonantInduction.itemCapacitor));
this.fakeBattery.age = 10;
}
if (this.renderManager == null)
{
this.renderManager = RenderManager.instance;
}
int renderAmount = 0;//Math.min(((TileEntityBattery) t).clientCells, 16);
if (renderAmount == 0)
{
return;
}
for (int i = 2; i < 6; i++)
{
ForgeDirection direction = ForgeDirection.getOrientation(i);
for (int slot = 0; slot < 4; slot++)
{
Vector3 sideVec = new Vector3(t).modifyPositionFromSide(correctSide(direction));
Block block = Block.blocksList[sideVec.getBlockID(t.worldObj)];
if (block != null && block.isOpaqueCube())
{
continue;
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.7f, (float) z + 0.5f);
float translateX = 0;
float translateY = 0;
switch (slot)
{
case 0:
translateX = 0.25f;
break;
case 1:
translateX = 0.25f;
translateY = -0.5f;
break;
case 2:
translateX = -0.25f;
translateY = -0.5f;
break;
case 3:
translateX = -0.25f;
break;
}
switch (direction)
{
case NORTH:
GL11.glTranslatef(-0.5f, 0, 0);
GL11.glTranslatef(0, translateY, translateX);
GL11.glRotatef(90, 0, 1, 0);
break;
case SOUTH:
GL11.glTranslatef(0, 0, -0.5f);
GL11.glTranslatef(translateX, translateY, 0);
break;
case WEST:
GL11.glTranslatef(0.5f, 0, 0);
GL11.glTranslatef(0, translateY, translateX);
GL11.glRotatef(90, 0, 1, 0);
break;
case EAST:
GL11.glTranslatef(0, 0, 0.5f);
GL11.glTranslatef(translateX, translateY, 0);
break;
}
GL11.glScalef(0.5f, 0.5f, 0.5f);
this.renderItemSimple(this.fakeBattery);
GL11.glPopMatrix();
if (--renderAmount <= 0)
{
return;
}
}
}
}
}
private ForgeDirection correctSide(ForgeDirection side)
{
switch (side)
{
case NORTH:
return ForgeDirection.WEST;
case SOUTH:
return ForgeDirection.NORTH;
case EAST:
return ForgeDirection.SOUTH;
case WEST:
return ForgeDirection.EAST;
default:
return null;
}
}
public void renderItemSimple(EntityItem entityItem)
{
if (entityItem != null)
{
Tessellator tessellator = Tessellator.instance;
ItemStack itemStack = entityItem.getEntityItem();
for (int k = 0; k < itemStack.getItem().getRenderPasses(itemStack.getItemDamage()); ++k)
{
Icon icon = itemStack.getItem().getIcon(itemStack, k);
if (icon == null)
{
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ResourceLocation resourcelocation = texturemanager.getResourceLocation(entityItem.getEntityItem().getItemSpriteNumber());
icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
}
float f4 = icon.getMinU();
float f5 = icon.getMaxU();
float f6 = icon.getMinV();
float f7 = icon.getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
float f11;
GL11.glPushMatrix();
float f12 = 0.0625F;
f11 = 0.021875F;
ItemStack itemstack = entityItem.getEntityItem();
int j = itemstack.stackSize;
byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * b0 / 2.0F));
for (int kj = 0; kj < b0; ++kj)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered
// a
// vanilla bug...
if (kj > 0)
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, f12 + f11);
}
else
{
GL11.glTranslatef(0f, 0f, f12 + f11);
}
if (itemstack.getItemSpriteNumber() == 0)
{
this.bindTexture(TextureMap.locationBlocksTexture);
}
else
{
this.bindTexture(TextureMap.locationItemsTexture);
}
GL11.glColor4f(1, 1, 1, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getIconWidth(), icon.getIconHeight(), f12);
}
GL11.glPopMatrix();
}
}
}
public byte getMiniItemCount(ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 15)
ret = 3;
if (stack.stackSize > 31)
ret = 4;
return ret;
}
}

View file

@ -20,7 +20,6 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import resonantinduction.base.PartAdvanced;
import resonantinduction.render.RenderMultimeter;
import universalelectricity.api.CompatibilityType;
import universalelectricity.api.energy.IConductor;
import universalelectricity.api.energy.IEnergyContainer;

View file

@ -1,17 +1,19 @@
package resonantinduction.render;
package resonantinduction.multimeter;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import resonantinduction.multimeter.ItemMultimeter;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* @author Calclavia
*
*/
@SideOnly(Side.CLIENT)
public class RenderItemMultimeter implements IItemRenderer
{
@Override

View file

@ -1,4 +1,4 @@
package resonantinduction.render;
package resonantinduction.multimeter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@ -9,7 +9,6 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import resonantinduction.model.ModelMultimeter;
import resonantinduction.multimeter.PartMultimeter;
import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit;
import cpw.mods.fml.client.FMLClientHandler;

View file

@ -0,0 +1,46 @@
package resonantinduction.transformer;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction;
import resonantinduction.TabRI;
import resonantinduction.wire.EnumWireMaterial;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.multipart.JItemMultiPart;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart;
public class ItemTransformer extends JItemMultiPart
{
private Icon[] icons = new Icon[EnumWireMaterial.values().length];
public ItemTransformer(int id)
{
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "multimeter", id).getInt(id));
this.setUnlocalizedName(ResonantInduction.PREFIX + "multimeter");
this.setCreativeTab(TabRI.INSTANCE);
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
@Override
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
{
PartTransformer part = (PartTransformer) MultiPartRegistry.createPart("resonant_induction_transformer", false);
if (part != null)
{
part.preparePlacement(side, itemStack.getItemDamage());
}
return part;
}
}

View file

@ -0,0 +1,561 @@
package resonantinduction.transformer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import static net.minecraftforge.common.ForgeDirection.*;
@SideOnly(Side.CLIENT)
public class ModelTransformer extends ModelBase
{
ModelRenderer Down_North;
ModelRenderer Down_West;
ModelRenderer Down_South;
ModelRenderer Down_East;
ModelRenderer Up_East;
ModelRenderer Up_West;
ModelRenderer Up_South;
ModelRenderer Up_North;
ModelRenderer South_Up;
ModelRenderer South_Down;
ModelRenderer South_West;
ModelRenderer South_East;
ModelRenderer North_Up;
ModelRenderer North_East;
ModelRenderer North_West;
ModelRenderer North_Down;
ModelRenderer East_South;
ModelRenderer East_North;
ModelRenderer East_Up;
ModelRenderer East_Down;
ModelRenderer West_Down;
ModelRenderer West_Up;
ModelRenderer West_South;
ModelRenderer West_North;
ModelRenderer io_Up;
ModelRenderer io_East;
ModelRenderer io_West;
ModelRenderer io_South;
ModelRenderer io_North;
ModelRenderer io_Down;
public ModelTransformer()
{
super();
textureWidth = 128;
textureHeight = 64;
Down_North = new ModelRenderer(this, 108, 8);
Down_North.addBox(0F, 0F, 0F, 8, 2, 2);
Down_North.setRotationPoint(-7F, 21F, -1F);
Down_North.setTextureSize(this.textureWidth, this.textureHeight);
Down_North.mirror = true;
setRotation(Down_North, 0F, 0F, 0F);
Down_West = new ModelRenderer(this, 108, 22);
Down_West.addBox(0F, 0F, 0F, 2, 2, 8);
Down_West.setRotationPoint(-1F, 21F, -7F);
Down_West.setTextureSize(this.textureWidth, this.textureHeight);
Down_West.mirror = true;
setRotation(Down_West, 0F, 0F, 0F);
Down_South = new ModelRenderer(this, 108, 4);
Down_South.addBox(0F, 0F, 0F, 8, 2, 2);
Down_South.setRotationPoint(-1F, 21F, -1F);
Down_South.setTextureSize(this.textureWidth, this.textureHeight);
Down_South.mirror = true;
setRotation(Down_South, 0F, 0F, 0F);
Down_East = new ModelRenderer(this, 108, 12);
Down_East.addBox(0F, 0F, 0F, 2, 2, 8);
Down_East.setRotationPoint(-1F, 21F, -1F);
Down_East.setTextureSize(this.textureWidth, this.textureHeight);
Down_East.mirror = true;
setRotation(Down_East, 0F, 0F, 0F);
Up_East = new ModelRenderer(this, 88, 22);
Up_East.addBox(0F, 0F, 0F, 2, 2, 8);
Up_East.setRotationPoint(-1F, 9F, -1F);
Up_East.setTextureSize(this.textureWidth, this.textureHeight);
Up_East.mirror = true;
setRotation(Up_East, 0F, 0F, 0F);
Up_West = new ModelRenderer(this, 88, 12);
Up_West.addBox(0F, 0F, 0F, 2, 2, 8);
Up_West.setRotationPoint(-1F, 9F, -7F);
Up_West.setTextureSize(this.textureWidth, this.textureHeight);
Up_West.mirror = true;
setRotation(Up_West, 0F, 0F, 0F);
Up_South = new ModelRenderer(this, 108, 0);
Up_South.addBox(0F, 0F, 0F, 8, 2, 2);
Up_South.setRotationPoint(-1F, 9F, -1F);
Up_South.setTextureSize(this.textureWidth, this.textureHeight);
Up_South.mirror = true;
setRotation(Up_South, 0F, 0F, 0F);
Up_North = new ModelRenderer(this, 88, 0);
Up_North.addBox(0F, 0F, 0F, 8, 2, 2);
Up_North.setRotationPoint(-7F, 9F, -1F);
Up_North.setTextureSize(this.textureWidth, this.textureHeight);
Up_North.mirror = true;
setRotation(Up_North, 0F, 0F, 0F);
South_Up = new ModelRenderer(this, 0, 22);
South_Up.addBox(0F, 0F, 0F, 2, 8, 2);
South_Up.setRotationPoint(5F, 9F, -1F);
South_Up.setTextureSize(this.textureWidth, this.textureHeight);
South_Up.mirror = true;
setRotation(South_Up, 0F, 0F, 0F);
South_Down = new ModelRenderer(this, 8, 22);
South_Down.addBox(0F, 0F, 0F, 2, 8, 2);
South_Down.setRotationPoint(5F, 15F, -1F);
South_Down.setTextureSize(this.textureWidth, this.textureHeight);
South_Down.mirror = true;
setRotation(South_Down, 0F, 0F, 0F);
South_West = new ModelRenderer(this, 68, 22);
South_West.addBox(0F, 0F, 0F, 2, 2, 8);
South_West.setRotationPoint(5F, 15F, -7F);
South_West.setTextureSize(this.textureWidth, this.textureHeight);
South_West.mirror = true;
setRotation(South_West, 0F, 0F, 0F);
South_East = new ModelRenderer(this, 68, 12);
South_East.addBox(0F, 0F, 0F, 2, 2, 8);
South_East.setRotationPoint(5F, 15F, -1F);
South_East.setTextureSize(this.textureWidth, this.textureHeight);
South_East.mirror = true;
setRotation(South_East, 0F, 0F, 0F);
North_Up = new ModelRenderer(this, 16, 22);
North_Up.addBox(0F, 0F, 0F, 2, 8, 2);
North_Up.setRotationPoint(-7F, 9F, -1F);
North_Up.setTextureSize(this.textureWidth, this.textureHeight);
North_Up.mirror = true;
setRotation(North_Up, 0F, 0F, 0F);
North_East = new ModelRenderer(this, 48, 22);
North_East.addBox(0F, 0F, 0F, 2, 2, 8);
North_East.setRotationPoint(-7F, 15F, -1F);
North_East.setTextureSize(this.textureWidth, this.textureHeight);
North_East.mirror = true;
setRotation(North_East, 0F, 0F, 0F);
North_West = new ModelRenderer(this, 48, 12);
North_West.addBox(0F, 0F, 0F, 2, 2, 8);
North_West.setRotationPoint(-7F, 15F, -7F);
North_West.setTextureSize(this.textureWidth, this.textureHeight);
North_West.mirror = true;
setRotation(North_West, 0F, 0F, 0F);
North_Down = new ModelRenderer(this, 0, 12);
North_Down.addBox(0F, 0F, 0F, 2, 8, 2);
North_Down.setRotationPoint(-7F, 15F, -1F);
North_Down.setTextureSize(this.textureWidth, this.textureHeight);
North_Down.mirror = true;
setRotation(North_Down, 0F, 0F, 0F);
East_South = new ModelRenderer(this, 88, 4);
East_South.addBox(0F, 0F, 0F, 8, 2, 2);
East_South.setRotationPoint(-1F, 15F, 5F);
East_South.setTextureSize(this.textureWidth, this.textureHeight);
East_South.mirror = true;
setRotation(East_South, 0F, 0F, 0F);
East_North = new ModelRenderer(this, 88, 8);
East_North.addBox(0F, 0F, 0F, 8, 2, 2);
East_North.setRotationPoint(-7F, 15F, 5F);
East_North.setTextureSize(this.textureWidth, this.textureHeight);
East_North.mirror = true;
setRotation(East_North, 0F, 0F, 0F);
East_Up = new ModelRenderer(this, 8, 12);
East_Up.addBox(0F, 0F, 0F, 2, 8, 2);
East_Up.setRotationPoint(-1F, 9F, 5F);
East_Up.setTextureSize(this.textureWidth, this.textureHeight);
East_Up.mirror = true;
setRotation(East_Up, 0F, 0F, 0F);
East_Down = new ModelRenderer(this, 16, 12);
East_Down.addBox(0F, 0F, 0F, 2, 8, 2);
East_Down.setRotationPoint(-1F, 15F, 5F);
East_Down.setTextureSize(this.textureWidth, this.textureHeight);
East_Down.mirror = true;
setRotation(East_Down, 0F, 0F, 0F);
West_Down = new ModelRenderer(this, 24, 22);
West_Down.addBox(0F, 0F, 0F, 2, 8, 2);
West_Down.setRotationPoint(-1F, 15F, -7F);
West_Down.setTextureSize(this.textureWidth, this.textureHeight);
West_Down.mirror = true;
setRotation(West_Down, 0F, 0F, 0F);
West_Up = new ModelRenderer(this, 24, 12);
West_Up.addBox(0F, 0F, 0F, 2, 8, 2);
West_Up.setRotationPoint(-1F, 9F, -7F);
West_Up.setTextureSize(this.textureWidth, this.textureHeight);
West_Up.mirror = true;
setRotation(West_Up, 0F, 0F, 0F);
West_South = new ModelRenderer(this, 68, 0);
West_South.addBox(0F, 0F, 0F, 8, 2, 2);
West_South.setRotationPoint(-1F, 15F, -7F);
West_South.setTextureSize(this.textureWidth, this.textureHeight);
West_South.mirror = true;
setRotation(West_South, 0F, 0F, 0F);
West_North = new ModelRenderer(this, 68, 4);
West_North.addBox(0F, 0F, 0F, 8, 2, 2);
West_North.setRotationPoint(-7F, 15F, -7F);
West_North.setTextureSize(this.textureWidth, this.textureHeight);
West_North.mirror = true;
setRotation(West_North, 0F, 0F, 0F);
io_Up = new ModelRenderer(this, 0, 0);
io_Up.addBox(0F, 0F, 0F, 4, 3, 4);
io_Up.setRotationPoint(-2F, 8F, -2F);
io_Up.setTextureSize(this.textureWidth, this.textureHeight);
io_Up.mirror = true;
setRotation(io_Up, 0F, 0F, 0F);
io_East = new ModelRenderer(this, 0, 7);
io_East.addBox(0F, 0F, 0F, 4, 4, 3);
io_East.setRotationPoint(-2F, 14F, 5F);
io_East.setTextureSize(this.textureWidth, this.textureHeight);
io_East.mirror = true;
setRotation(io_East, 0F, 0F, 0F);
io_West = new ModelRenderer(this, 14, 8);
io_West.addBox(0F, 0F, 0F, 4, 4, 3);
io_West.setRotationPoint(-2F, 14F, -8F);
io_West.setTextureSize(this.textureWidth, this.textureHeight);
io_West.mirror = true;
setRotation(io_West, 0F, 0F, 0F);
io_South = new ModelRenderer(this, 16, 0);
io_South.addBox(0F, 0F, 0F, 3, 4, 4);
io_South.setRotationPoint(5F, 14F, -2F);
io_South.setTextureSize(this.textureWidth, this.textureHeight);
io_South.mirror = true;
setRotation(io_South, 0F, 0F, 0F);
io_North = new ModelRenderer(this, 30, 0);
io_North.addBox(0F, 0F, 0F, 3, 4, 4);
io_North.setRotationPoint(-8F, 14F, -2F);
io_North.setTextureSize(this.textureWidth, this.textureHeight);
io_North.mirror = true;
setRotation(io_North, 0F, 0F, 0F);
io_Down = new ModelRenderer(this, 28, 8);
io_Down.addBox(0F, 0F, 0F, 4, 3, 4);
io_Down.setRotationPoint(-2F, 21F, -2F);
io_Down.setTextureSize(this.textureWidth, this.textureHeight);
io_Down.mirror = true;
setRotation(io_Down, 0F, 0F, 0F);
}
@Override
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);
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
public void renderIO(ForgeDirection dir, float f5)
{
switch (dir)
{
case UP:
this.io_Up.render(f5);
break;
case DOWN:
this.io_Down.render(f5);
break;
case NORTH:
this.io_North.render(f5);
break;
case SOUTH:
this.io_South.render(f5);
break;
case EAST:
this.io_East.render(f5);
break;
case WEST:
this.io_West.render(f5);
break;
default:
break;
}
}
public void renderCores(ForgeDirection in, ForgeDirection out, float f5)
{
if (in == UP || out == UP)
{
if (in == DOWN || out == DOWN)
{
this.Down_East.render(f5);
this.Down_North.render(f5);
this.Down_South.render(f5);
this.Down_West.render(f5);
this.East_Down.render(f5);
this.North_Down.render(f5);
this.South_Down.render(f5);
this.West_Down.render(f5);
this.East_Up.render(f5);
this.North_Up.render(f5);
this.South_Up.render(f5);
this.West_Up.render(f5);
this.Up_East.render(f5);
this.Up_North.render(f5);
this.Up_South.render(f5);
this.Up_West.render(f5);
}
else if (in == NORTH || out == NORTH)
{
this.North_East.render(f5);
this.North_West.render(f5);
this.East_North.render(f5);
this.West_North.render(f5);
this.East_Up.render(f5);
this.West_Up.render(f5);
this.Up_East.render(f5);
this.Up_West.render(f5);
}
else if (in == SOUTH || out == SOUTH)
{
this.South_East.render(f5);
this.South_West.render(f5);
this.East_South.render(f5);
this.West_South.render(f5);
this.East_Up.render(f5);
this.West_Up.render(f5);
this.Up_East.render(f5);
this.Up_West.render(f5);
}
else if (in == EAST || out == EAST)
{
this.East_North.render(f5);
this.East_South.render(f5);
this.North_East.render(f5);
this.South_East.render(f5);
this.North_Up.render(f5);
this.South_Up.render(f5);
this.Up_North.render(f5);
this.Up_South.render(f5);
}
else if (in == WEST || out == WEST)
{
this.West_North.render(f5);
this.West_South.render(f5);
this.North_West.render(f5);
this.South_West.render(f5);
this.North_Up.render(f5);
this.South_Up.render(f5);
this.Up_North.render(f5);
this.Up_South.render(f5);
}
}
else if (in == DOWN || out == DOWN)
{
if (in == NORTH || out == NORTH)
{
this.North_East.render(f5);
this.North_West.render(f5);
this.East_North.render(f5);
this.West_North.render(f5);
this.East_Down.render(f5);
this.West_Down.render(f5);
this.Down_East.render(f5);
this.Down_West.render(f5);
}
else if (in == SOUTH || out == SOUTH)
{
this.South_East.render(f5);
this.South_West.render(f5);
this.East_South.render(f5);
this.West_South.render(f5);
this.East_Down.render(f5);
this.West_Down.render(f5);
this.Down_East.render(f5);
this.Down_West.render(f5);
}
else if (in == EAST || out == EAST)
{
this.East_North.render(f5);
this.East_South.render(f5);
this.North_East.render(f5);
this.South_East.render(f5);
this.North_Down.render(f5);
this.South_Down.render(f5);
this.Down_North.render(f5);
this.Down_South.render(f5);
}
else if (in == WEST || out == WEST)
{
this.West_North.render(f5);
this.West_South.render(f5);
this.North_West.render(f5);
this.South_West.render(f5);
this.North_Down.render(f5);
this.South_Down.render(f5);
this.Down_North.render(f5);
this.Down_South.render(f5);
}
}
else if (in == NORTH || out == NORTH)
{
if (in == SOUTH || out == SOUTH)
{
this.North_Down.render(f5);
this.North_East.render(f5);
this.North_Up.render(f5);
this.North_West.render(f5);
this.Down_North.render(f5);
this.East_North.render(f5);
this.Up_North.render(f5);
this.West_North.render(f5);
this.Down_South.render(f5);
this.East_South.render(f5);
this.Up_South.render(f5);
this.West_South.render(f5);
this.South_Down.render(f5);
this.South_East.render(f5);
this.South_Up.render(f5);
this.South_West.render(f5);
}
else if (in == EAST || out == EAST)
{
this.North_Down.render(f5);
this.North_Up.render(f5);
this.Down_North.render(f5);
this.Up_North.render(f5);
this.Down_East.render(f5);
this.Up_East.render(f5);
this.East_Down.render(f5);
this.East_Up.render(f5);
}
else if (in == WEST || out == WEST)
{
this.North_Down.render(f5);
this.North_Up.render(f5);
this.Down_North.render(f5);
this.Up_North.render(f5);
this.Down_West.render(f5);
this.Up_West.render(f5);
this.West_Down.render(f5);
this.West_Up.render(f5);
}
}
else if (in == SOUTH || out == SOUTH)
{
if (in == EAST || out == EAST)
{
this.South_Down.render(f5);
this.South_Up.render(f5);
this.Down_South.render(f5);
this.Up_South.render(f5);
this.Down_East.render(f5);
this.Up_East.render(f5);
this.East_Down.render(f5);
this.East_Up.render(f5);
}
else if (in == WEST || out == WEST)
{
this.South_Down.render(f5);
this.South_Up.render(f5);
this.Down_South.render(f5);
this.Up_South.render(f5);
this.Down_West.render(f5);
this.Up_West.render(f5);
this.West_Down.render(f5);
this.West_Up.render(f5);
}
}
else if (in == EAST || out == EAST)
{
if (in == WEST || out == WEST)
{
this.East_Down.render(f5);
this.East_North.render(f5);
this.East_South.render(f5);
this.East_Up.render(f5);
this.Down_East.render(f5);
this.North_East.render(f5);
this.South_East.render(f5);
this.Up_East.render(f5);
this.Down_West.render(f5);
this.North_West.render(f5);
this.South_West.render(f5);
this.Up_West.render(f5);
this.West_Down.render(f5);
this.West_North.render(f5);
this.West_South.render(f5);
this.West_Up.render(f5);
}
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
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);
}
public void renderAll(float f5)
{
this.Down_North.render(f5);
this.Down_West.render(f5);
this.Down_South.render(f5);
this.Down_East.render(f5);
this.Up_East.render(f5);
this.Up_West.render(f5);
this.Up_South.render(f5);
this.Up_North.render(f5);
this.South_Up.render(f5);
this.South_Down.render(f5);
this.South_West.render(f5);
this.South_East.render(f5);
this.North_Up.render(f5);
this.North_East.render(f5);
this.North_West.render(f5);
this.North_Down.render(f5);
this.East_South.render(f5);
this.East_North.render(f5);
this.East_Up.render(f5);
this.East_Down.render(f5);
this.West_Down.render(f5);
this.West_Up.render(f5);
this.West_South.render(f5);
this.West_North.render(f5);
}
}

View file

@ -0,0 +1,100 @@
package resonantinduction.transformer;
import org.lwjgl.opengl.GL11;
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.TextureUtils;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Rotation;
import codechicken.lib.vec.Transformation;
import codechicken.lib.vec.Vector3;
import codechicken.microblock.FaceMicroClass;
import codechicken.multipart.JCuboidPart;
import codechicken.multipart.JNormalOcclusion;
import codechicken.multipart.TFacePart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TFacePart
{
public static Cuboid6[][] oBoxes = new Cuboid6[6][2];
static
{
oBoxes[0][0] = new Cuboid6(1 / 8D, 0, 0, 7 / 8D, 1 / 8D, 1);
oBoxes[0][1] = new Cuboid6(0, 0, 1 / 8D, 1, 1 / 8D, 7 / 8D);
for (int s = 1; s < 6; s++)
{
Transformation t = Rotation.sideRotations[s].at(Vector3.center);
oBoxes[s][0] = oBoxes[0][0].copy().apply(t);
oBoxes[s][1] = oBoxes[0][1].copy().apply(t);
}
}
private int side;
private boolean stepUp;
public int multiplier;
public void preparePlacement(int side, int itemDamage)
{
this.side = (byte) (side ^ 1);
}
public boolean stepUp()
{
return this.stepUp;
}
@Override
public int getSlotMask()
{
return 1 << this.side;
}
@Override
public Cuboid6 getBounds()
{
return FaceMicroClass.aBounds()[0x10 | this.side];
}
@Override
public int redstoneConductionMap()
{
return 0;
}
@Override
public boolean solid(int arg0)
{
return true;
}
@Override
public Iterable<Cuboid6> getOcclusionBoxes()
{
return null;
}
@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(Vector3 pos, float frame, int pass)
{
if (pass == 0)
{
GL11.glDisable(GL11.GL_LIGHTING);
TextureUtils.bindAtlas(0);
CCRenderState.useModelColours(true);
CCRenderState.startDrawing(7);
RenderTransformer.render(this, pos.x, pos.y, pos.z);
CCRenderState.draw();
CCRenderState.setColour(-1);
GL11.glEnable(GL11.GL_LIGHTING);
}
}
@Override
public String getType()
{
return "resonant_induction_transformer";
}
}

View file

@ -0,0 +1,59 @@
package resonantinduction.transformer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.render.CalclaviaRenderHelper;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderTransformer
{
private static final ModelTransformer MODEL = new ModelTransformer();
public static final ResourceLocation TEXTURE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "transformer.png");
public static void render(PartTransformer part, double x, double y, double z)
{
String status = StatCollector.translateToLocal(part.stepUp() ? "tooltip.transformer.stepUp" : "tooltip.transformer.stepDown");
String name = StatCollector.translateToLocal(ResonantInduction.itemTransformer.getUnlocalizedName() + "." + (int) Math.pow(2, part.multiplier + 1) + "x.name");
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
MovingObjectPosition movingPosition = player.rayTrace(5, 1f);
if (movingPosition != null)
{
if (new Vector3(x, y, z).equals(new Vector3(movingPosition)))
{
CalclaviaRenderHelper.renderFloatingText(status, (float) ((float) x + .5), (float) y - 1, (float) ((float) z + .5));
CalclaviaRenderHelper.renderFloatingText(name, (float) ((float) x + .5), (float) y - .70F, (float) ((float) z + .5));
}
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
MODEL.render(null, 0, 0, 0, 0, 0, 0.0625F);
//this.model.renderCores(te.getInput(), te.getOutput(), 0.0625F);
// this.bindTexture(TextureLocations.MODEL_TRANSFORMER_INPUT);
//this.model.renderIO(te.getInput(), 0.0625F);
// this.bindTexture(TextureLocations.MODEL_TRANSFORMER_OUTPUT);
//this.model.renderIO(te.getOutput(), 0.0625F);
GL11.glPopMatrix();
}
}