Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *** TelicraftCommonProxy.java ***
- package telinc.telicraft.common.core;
- public class TelicraftCommonProxy {
- public void registerRenderThings() {}
- }
- *** TelicraftClientProxy.java ***
- package telinc.telicraft.client;
- import net.minecraftforge.client.MinecraftForgeClient;
- import telinc.telicraft.client.entities.RenderMeteorBomb;
- import telinc.telicraft.client.entities.RenderPetrify;
- import telinc.telicraft.common.TelicraftMain;
- import telinc.telicraft.common.core.TelicraftCommonProxy;
- import telinc.telicraft.common.entities.EntityMeteorBombPrimed;
- import telinc.telicraft.common.entities.EntityPetrify;
- import cpw.mods.fml.client.registry.RenderingRegistry;
- public class TelicraftClientProxy extends TelicraftCommonProxy {
- @Override
- public void registerRenderThings() {
- MinecraftForgeClient.preloadTexture("/telinc/telicraft/textures/blocks.png");
- MinecraftForgeClient.preloadTexture("/telinc/telicraft/textures/items.png");
- RenderingRegistry.registerEntityRenderingHandler(EntityMeteorBombPrimed.class, new RenderMeteorBomb());
- }
- }
- *** RenderMeteorBomb.java ***
- package telinc.telicraft.client.entities;
- import net.minecraft.src.Block;
- import net.minecraft.src.Entity;
- import net.minecraft.src.EntityTNTPrimed;
- import net.minecraft.src.Render;
- import net.minecraft.src.RenderBlocks;
- import org.lwjgl.opengl.GL11;
- import telinc.telicraft.common.TelicraftMain;
- import telinc.telicraft.common.entities.EntityMeteorBombPrimed;
- import cpw.mods.fml.common.Side;
- import cpw.mods.fml.common.asm.SideOnly;
- @SideOnly(Side.CLIENT)
- public class RenderMeteorBomb extends Render
- {
- private RenderBlocks blockRenderer = new RenderBlocks();
- public RenderMeteorBomb()
- {
- this.shadowSize = 0.5F;
- }
- public void renderPrimedMeteorBomb(EntityMeteorBombPrimed par1Entity, double par2, double par4, double par6, float par8, float par9)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)par2, (float)par4, (float)par6);
- float var10;
- if ((float)par1Entity.fuse - par9 + 1.0F < 10.0F)
- {
- var10 = 1.0F - ((float)par1Entity.fuse - par9 + 1.0F) / 10.0F;
- if (var10 < 0.0F)
- {
- var10 = 0.0F;
- }
- if (var10 > 1.0F)
- {
- var10 = 1.0F;
- }
- var10 *= var10;
- var10 *= var10;
- float var11 = 1.0F + var10 * 0.3F;
- GL11.glScalef(var11, var11, var11);
- }
- var10 = (1.0F - ((float)par1Entity.fuse - par9 + 1.0F) / 100.0F) * 0.8F;
- this.loadTexture("/telinc/telicraft/textures/blocks.png");
- this.blockRenderer.renderBlockAsItem(TelicraftMain.meteorBomb, 0, par1Entity.getBrightness(par9));
- if (par1Entity.fuse / 5 % 2 == 0)
- {
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, var10);
- this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- }
- GL11.glPopMatrix();
- }
- /**
- * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
- * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
- * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
- * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
- */
- public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
- {
- this.renderPrimedMeteorBomb((EntityMeteorBombPrimed)par1Entity, par2, par4, par6, par8, par9);
- }
- }
- *** EntityMeteorBombPrimed.java ***
- package telinc.telicraft.common.entities;
- import cpw.mods.fml.common.Side;
- import cpw.mods.fml.common.asm.SideOnly;
- import net.minecraft.src.Entity;
- import net.minecraft.src.NBTTagCompound;
- import net.minecraft.src.World;
- public class EntityMeteorBombPrimed extends Entity {
- public int fuse;
- public EntityMeteorBombPrimed(World par1World) {
- super(par1World);
- this.fuse = 0;
- this.preventEntitySpawning = true;
- this.setSize(0.98F, 0.98F);
- this.yOffset = this.height / 2.0F;
- }
- public EntityMeteorBombPrimed(World par1World, double par2, double par4,
- double par6) {
- this(par1World);
- this.setPosition(par2, par4, par6);
- float var8 = (float) (Math.random() * Math.PI * 2.0D);
- this.motionX = (double) (-((float) Math.sin((double) var8)) * 0.02F);
- this.motionY = 0.20000000298023224D;
- this.motionZ = (double) (-((float) Math.cos((double) var8)) * 0.02F);
- this.fuse = 200;
- this.prevPosX = par2;
- this.prevPosY = par4;
- this.prevPosZ = par6;
- }
- @Override
- protected void entityInit() {}
- @Override
- protected boolean canTriggerWalking() {
- return false;
- }
- @Override
- public boolean canBeCollidedWith() {
- return !isDead;
- }
- @Override
- public void onUpdate() {
- this.prevPosX = this.posX;
- this.prevPosY = this.posY;
- this.prevPosZ = this.posZ;
- this.motionY -= 0.03999999910593033D;
- this.moveEntity(this.motionX, this.motionY, this.motionZ);
- this.motionX *= 0.9800000190734863D;
- this.motionY *= 0.9800000190734863D;
- this.motionZ *= 0.9800000190734863D;
- if (this.onGround) {
- this.motionX *= 0.699999988079071D;
- this.motionZ *= 0.699999988079071D;
- this.motionY *= -0.5D;
- }
- if (this.fuse-- <= 0) {
- this.setDead();
- if (!this.worldObj.isRemote) {
- this.explode();
- }
- } else {
- this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("flame", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("lava", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
- }
- }
- @Override
- protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
- fuse = par1NBTTagCompound.getByte("Fuse");
- }
- @Override
- protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
- par1NBTTagCompound.setByte("Fuse", (byte)fuse);
- }
- @Override
- @SideOnly(Side.CLIENT)
- public float getShadowSize(){
- return 0.0F;
- }
- private void explode() {
- float var1 = 45.69F;
- this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, var1, true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement