Enchanter Renderer, now to make it do something >.>

This commit is contained in:
Vasco Lavos committed 2014-03-15 18:37:27 +00:00
1 parent 564ec03335
commit 88409f26d8
6 files changed
+108 -2

No files matched your search

@@ -39,11 +39,13 @@ import vazkii.botania.client.render.block.RenderSpecialFlower;
import vazkii.botania.client.render.block.RenderSpreader;
import vazkii.botania.client.render.item.RenderLens;
import vazkii.botania.client.render.tile.RenderTileAltar;
import vazkii.botania.client.render.tile.RenderTileEnchanter;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.client.render.tile.RenderTilePylon;
import vazkii.botania.client.render.tile.RenderTileRuneAltar;
import vazkii.botania.client.render.tile.RenderTileSpreader;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.block.tile.TilePool;
import vazkii.botania.common.block.tile.TilePylon;
import vazkii.botania.common.block.tile.TileRuneAltar;
@@ -95,6 +97,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TilePool.class, new RenderTilePool());
ClientRegistry.bindTileEntitySpecialRenderer(TileRuneAltar.class, new RenderTileRuneAltar());
ClientRegistry.bindTileEntitySpecialRenderer(TilePylon.class, new RenderTilePylon());
ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, new RenderTileEnchanter());
}
@Override
@@ -0,0 +1,58 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Mar 15, 2014, 5:04:42 PM (GMT)]
*/
package vazkii.botania.client.render.tile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import org.lwjgl.opengl.GL11;
import vazkii.botania.common.block.BlockEnchanter;
public class RenderTileEnchanter extends TileEntitySpecialRenderer {
RenderItem renderItem = new RenderItem();
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
GL11.glPushMatrix();
GL11.glTranslated(d0, d1, d2);
GL11.glRotated(90F, 1F, 0F, 0F);
GL11.glTranslatef(-2F, -2F, -0.001F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(0.6F + (float) ((Math.cos((double) tileentity.worldObj.getTotalWorldTime() / 6D) + 1D) / 5D), 0.1F, 0.9F, (float) ((Math.sin((double) tileentity.worldObj.getTotalWorldTime() / 8D) + 1D) / 5D + 0.4D));
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
renderIcon(0, 0, BlockEnchanter.overlay, 5, 5, 240);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glPopMatrix();
}
public void renderIcon(int par1, int par2, Icon par3Icon, int par4, int par5, int brightness) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setBrightness(brightness);
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)0, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV());
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)0, (double)par3Icon.getMaxU(), (double)par3Icon.getMaxV());
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)0, (double)par3Icon.getMaxU(), (double)par3Icon.getMinV());
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)0, (double)par3Icon.getMinU(), (double)par3Icon.getMinV());
tessellator.draw();
}
}
@@ -11,12 +11,20 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.lib.LibBlockIDs;
import vazkii.botania.common.lib.LibBlockNames;
import net.minecraft.block.material.Material;
public class BlockEnchanter extends BlockMod {
public class BlockEnchanter extends BlockModContainer {
public static Icon overlay;
public BlockEnchanter() {
super(LibBlockIDs.idEnchanter, Material.rock);
setHardness(3.0F);
@@ -24,5 +32,16 @@ public class BlockEnchanter extends BlockMod {
setStepSound(soundStoneFootstep);
setUnlocalizedName(LibBlockNames.ENCHANTER);
}
@Override
public void registerIcons(IconRegister par1IconRegister) {
super.registerIcons(par1IconRegister);
overlay = IconHelper.forBlock(par1IconRegister, this, "Overlay");
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileEnchanter();
}
}
@@ -28,6 +28,7 @@ import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas;
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileDistributor;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.block.tile.TileManaBeacon;
import vazkii.botania.common.block.tile.TileManaDetector;
import vazkii.botania.common.block.tile.TileManaVoid;
@@ -115,6 +116,7 @@ public final class ModBlocks {
GameRegistry.registerTileEntity(TileManaBeacon.class, LibBlockNames.MANA_BEACON);
GameRegistry.registerTileEntity(TileManaVoid.class, LibBlockNames.MANA_VOID);
GameRegistry.registerTileEntity(TileManaDetector.class, LibBlockNames.MANA_DETECTOR);
GameRegistry.registerTileEntity(TileEnchanter.class, LibBlockNames.ENCHANTER);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
@@ -0,0 +1,24 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Mar 15, 2014, 4:57:52 PM (GMT)]
*/
package vazkii.botania.common.block.tile;
import net.minecraft.util.AxisAlignedBB;
public class TileEnchanter extends TileMod {
@Override
public AxisAlignedBB getRenderBoundingBox() {
return super.getRenderBoundingBox();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB