Added renderer for grinder wheel

This commit is contained in:
Calclavia 2014-01-19 13:06:26 +08:00
parent e8623ff70f
commit 12fe602ced
13 changed files with 5856 additions and 20 deletions

View file

@ -38,9 +38,9 @@ import resonantinduction.electrical.tesla.TileTesla;
import resonantinduction.electrical.transformer.ItemTransformer;
import resonantinduction.electrical.wire.EnumWireMaterial;
import resonantinduction.electrical.wire.ItemWire;
import resonantinduction.mechanical.grinder.BlockGrinderWheel;
import resonantinduction.mechanical.grinder.TileGrinderWheel;
import resonantinduction.mechanical.grinder.TilePurifier;
import resonantinduction.mechanical.process.BlockGrinderWheel;
import resonantinduction.mechanical.process.TileGrinderWheel;
import resonantinduction.mechanical.process.TilePurifier;
import calclavia.lib.content.ContentRegistry;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.recipe.UniversalRecipe;

View file

@ -6,7 +6,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.Settings;
import resonantinduction.core.prefab.block.BlockRIRotatable;
import resonantinduction.mechanical.grinder.TilePurifier;
import resonantinduction.mechanical.process.TilePurifier;
import universalelectricity.api.vector.VectorWorld;
/**

View file

@ -20,7 +20,7 @@ import resonantinduction.core.Utility;
import resonantinduction.electrical.wire.flat.PartFlatWire;
import resonantinduction.electrical.wire.flat.RenderFlatWire;
import resonantinduction.electrical.wire.framed.PartFramedWire;
import resonantinduction.electrical.wire.framed.RenderPartWire;
import resonantinduction.electrical.wire.framed.RenderFramedWire;
import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit;
import calclavia.lib.render.EnumColor;
@ -126,8 +126,8 @@ public class ItemWire extends JItemMultiPart
public void registerIcons(IconRegister register)
{
RenderFlatWire.flatWireTexture = register.registerIcon(Reference.PREFIX + "models/flatWire");
RenderPartWire.wireIcon = register.registerIcon(Reference.PREFIX + "models/wire");
RenderPartWire.insulationIcon = register.registerIcon(Reference.PREFIX + "models/insulation");
RenderFramedWire.wireIcon = register.registerIcon(Reference.PREFIX + "models/wire");
RenderFramedWire.insulationIcon = register.registerIcon(Reference.PREFIX + "models/insulation");
super.registerIcons(register);
}

View file

@ -187,7 +187,7 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN
{
if (pass == 0)
{
RenderPartWire.INSTANCE.renderStatic(this);
RenderFramedWire.INSTANCE.renderStatic(this);
}
}
@ -197,7 +197,7 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN
{
if (getMaterial() == EnumWireMaterial.SILVER)
{
RenderPartWire.INSTANCE.renderShine(this, pos.x, pos.y, pos.z, frame);
RenderFramedWire.INSTANCE.renderShine(this, pos.x, pos.y, pos.z, frame);
}
}
@ -235,13 +235,13 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN
@Override
public Icon getBreakingIcon(Object subPart, int side)
{
return RenderPartWire.breakIcon;
return RenderFramedWire.breakIcon;
}
@Override
public Icon getBrokenIcon(int side)
{
return RenderPartWire.breakIcon;
return RenderFramedWire.breakIcon;
}
@Override

View file

@ -33,9 +33,9 @@ import cpw.mods.fml.relauncher.SideOnly;
*
*/
@SideOnly(Side.CLIENT)
public class RenderPartWire
public class RenderFramedWire
{
private static final ResourceLocation WIRE_SHINE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "white.png");
public static final ResourceLocation WIRE_SHINE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "white.png");
public static final Map<String, CCModel> models;
public static final Map<String, CCModel> shinyModels;
public static Icon wireIcon;
@ -46,11 +46,11 @@ public class RenderPartWire
public static FloatBuffer specular = BufferUtils.createFloatBuffer(4);
public static FloatBuffer zero = BufferUtils.createFloatBuffer(4);
public static FloatBuffer defaultAmbient = BufferUtils.createFloatBuffer(4);
public static final RenderPartWire INSTANCE = new RenderPartWire();
public static final RenderFramedWire INSTANCE = new RenderFramedWire();
static
{
models = CCModel.parseObjModels(new ResourceLocation("resonantinduction", "models/wire.obj"), 7, new InvertX());
models = CCModel.parseObjModels(new ResourceLocation(Reference.DOMAIN, "models/wire.obj"), 7, new InvertX());
for (CCModel c : models.values())
{
c.apply(new Translation(.5, 0, .5));
@ -58,7 +58,7 @@ public class RenderPartWire
c.shrinkUVs(0.0005);
}
shinyModels = CCModel.parseObjModels(new ResourceLocation("resonantinduction", "models/wireShine.obj"), 7, new InvertX());
shinyModels = CCModel.parseObjModels(new ResourceLocation(Reference.DOMAIN, "models/wireShine.obj"), 7, new InvertX());
for (CCModel c : shinyModels.values())
{
c.apply(new Translation(.5, 0, .5));

View file

@ -1,5 +1,6 @@
package resonantinduction.mechanical.grinder;
package resonantinduction.mechanical.process;
import calclavia.lib.render.block.BlockRenderingHandler;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@ -9,6 +10,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.Settings;
import resonantinduction.core.prefab.block.BlockRIRotatable;
import resonantinduction.core.render.RIBlockRenderingHandler;
import universalelectricity.api.vector.VectorWorld;
/**
@ -25,6 +27,12 @@ public class BlockGrinderWheel extends BlockRIRotatable implements ITileEntityPr
this.setBlockBounds(0.05f, 0.05f, 0.05f, 0.95f, 0.95f, 0.95f);
}
@Override
public int getRenderType()
{
return RIBlockRenderingHandler.ID;
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{

View file

@ -0,0 +1,41 @@
package resonantinduction.mechanical.process;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.obj.WavefrontObject;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
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 RenderGrinderWheel extends TileEntitySpecialRenderer
{
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "grinder.png");
public static final WavefrontObject MODEL = (WavefrontObject) AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "grinder.obj");
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
{
glPushMatrix();
glTranslatef((float) x + 0.5F, (float) y + 0.5f, (float) z + 0.5F);
glTranslatef(0, 0, 0.5f);
glScalef(0.5f, 0.5f, 0.5f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
MODEL.renderOnly("Default");
glPopMatrix();
}
}

View file

@ -1,4 +1,4 @@
package resonantinduction.mechanical.grinder;
package resonantinduction.mechanical.process;
import java.util.HashMap;
@ -38,7 +38,7 @@ public class TileGrinderWheel extends TileElectrical
public void updateEntity()
{
super.updateEntity();
// TODO: Add electricity support.
// TODO: Add energy support.
doWork();
}

View file

@ -1,4 +1,4 @@
package resonantinduction.mechanical.grinder;
package resonantinduction.mechanical.process;
import java.util.HashMap;
import java.util.List;

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB