Made the dart blower use actual darts

This commit is contained in:
Adubbz 2013-05-11 22:51:16 +10:00
parent d7bfeb8cda
commit 092c6c180c
8 changed files with 155 additions and 72 deletions

View File

@ -5,12 +5,12 @@ import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import biomesoplenty.api.Items; import biomesoplenty.api.Items;
import biomesoplenty.blocks.renderers.FoliageRenderer; import biomesoplenty.blocks.renderers.FoliageRenderer;
import biomesoplenty.blocks.renderers.PlantsRenderer; import biomesoplenty.blocks.renderers.PlantsRenderer;
import biomesoplenty.items.projectiles.EntityDart; import biomesoplenty.items.projectiles.EntityDart;
import biomesoplenty.items.projectiles.EntityMudball; import biomesoplenty.items.projectiles.EntityMudball;
import biomesoplenty.items.projectiles.RenderDart;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxy extends CommonProxy { public class ClientProxy extends CommonProxy {
@ -20,13 +20,8 @@ public class ClientProxy extends CommonProxy {
@Override @Override
public void registerRenderers() public void registerRenderers()
{ {
MinecraftForgeClient.preloadTexture(ARMOR_MUD1_PNG);
MinecraftForgeClient.preloadTexture(ARMOR_MUD2_PNG);
MinecraftForgeClient.preloadTexture(ARMOR_AMETHYST1_PNG);
MinecraftForgeClient.preloadTexture(ARMOR_AMETHYST2_PNG);
RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(Items.mudball.get(), 0)); RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(Items.mudball.get(), 0));
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderSnowball(Items.dart.get(), 0)); RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart());
RenderingRegistry.registerBlockHandler(new FoliageRenderer()); RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer()); RenderingRegistry.registerBlockHandler(new PlantsRenderer());
@ -39,6 +34,15 @@ public class ClientProxy extends CommonProxy {
entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.mudball.get(), mc.renderEngine); entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.mudball.get(), mc.renderEngine);
mc.effectRenderer.addEffect(entityfx); mc.effectRenderer.addEffect(entityfx);
}
@Override
public void spawnDart(World world, double x, double y, double z, double xVel, double yVel, double zVel)
{
EntityFX entityfx = null;
entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.dart.get(), mc.renderEngine);
mc.effectRenderer.addEffect(entityfx);
} }
@Override @Override

View File

@ -21,5 +21,10 @@ public class CommonProxy {
public void spawnMud(World world, double x, double y, double z, double xVel, double yVel, double zVel) public void spawnMud(World world, double x, double y, double z, double xVel, double yVel, double zVel)
{ {
}
public void spawnDart(World world, double x, double y, double z, double xVel, double yVel, double zVel)
{
} }
} }

View File

@ -311,6 +311,9 @@ public class BOPConfiguration {
public static int jungleNewID; public static int jungleNewID;
public static int jungleHillsNewID; public static int jungleHillsNewID;
public static int entityMudballID;
public static int entityDartID;
public static int jungleSpiderID; public static int jungleSpiderID;
public static int rosesterID; public static int rosesterID;
@ -689,6 +692,10 @@ public class BOPConfiguration {
//Mob IDs //Mob IDs
jungleSpiderID = config.get("Mob IDs", "Jungle Spider ID", 101, null).getInt(); jungleSpiderID = config.get("Mob IDs", "Jungle Spider ID", 101, null).getInt();
rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt(); rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt();
//Projectile IDs
entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();;
entityDartID = config.get("Entity IDs", "Dart ID", 104, null).getInt();;
System.out.println("Generating Biome ID's"); System.out.println("Generating Biome ID's");

View File

@ -39,8 +39,8 @@ public class BOPEntities {
public static void init() public static void init()
{ {
EntityRegistry.registerModEntity(EntityMudball.class, "MudBall", EntityRegistry.findGlobalUniqueEntityId(), BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityMudball.class, "MudBall", BOPConfiguration.entityMudballID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityDart.class, "Dart", EntityRegistry.findGlobalUniqueEntityId(), BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityDart.class, "Dart", BOPConfiguration.entityDartID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityJungleSpider.class, "JungleSpider", BOPConfiguration.jungleSpiderID, BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityJungleSpider.class, "JungleSpider", BOPConfiguration.jungleSpiderID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityRosester.class, "Rosester", BOPConfiguration.rosesterID, BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityRosester.class, "Rosester", BOPConfiguration.rosesterID, BiomesOPlenty.instance, 80, 3, true);

View File

@ -34,8 +34,8 @@ public class ItemDartBlower extends Item
if (flag || par3EntityPlayer.inventory.hasItem(Items.dart.get().itemID)) if (flag || par3EntityPlayer.inventory.hasItem(Items.dart.get().itemID))
{ {
EntityArrow entitydart = new EntityArrow(par2World, par3EntityPlayer, 2.0F); //EntityArrow entitydart = new EntityArrow(par2World, par3EntityPlayer, 2.0F);
//EntityDart entitydart = new EntityDart(par2World, par3EntityPlayer, 2.0F); EntityDart entitydart = new EntityDart(par2World, par3EntityPlayer, 2.0F);
itemStack.damageItem(1, par3EntityPlayer); itemStack.damageItem(1, par3EntityPlayer);
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 2.0F / (1.0F * 0.4F + 1.2F) + 1.0F * 0.5F); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 2.0F / (1.0F * 0.4F + 1.2F) + 1.0F * 0.5F);
@ -45,14 +45,9 @@ public class ItemDartBlower extends Item
if (!par2World.isRemote) if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(entitydart); par2World.spawnEntityInWorld(entitydart);
}
} }
// if (!par2World.isRemote)
// par2World.spawnEntityInWorld(new EntityDart(par2World, par3EntityPlayer));
return itemStack; return itemStack;
} }
} }

View File

@ -75,31 +75,31 @@ public class EntityDart extends EntityArrow
} }
} }
// if (this.inGround) if (this.inGround)
// { {
// int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
// int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
//
// if (j == this.inTile && k == this.inData) if (j == this.inTile && k == this.inData)
// { {
// ++this.ticksInGround; ++this.ticksInGround;
//
// if (this.ticksInGround == 1) if (this.ticksInGround == 1)
// { {
// this.setDead(); this.setDead();
// } }
// } }
// else else
// { {
// this.inGround = false; this.inGround = false;
// this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
// this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
// this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
// this.ticksInGround = 0; this.ticksInGround = 0;
// this.ticksInAir = 0; this.ticksInAir = 0;
// } }
// } }
// else else
{ {
++this.ticksInAir; ++this.ticksInAir;
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
@ -216,11 +216,11 @@ public class EntityDart extends EntityArrow
} }
else else
{ {
// this.xTile = movingobjectposition.blockX; this.xTile = movingobjectposition.blockX;
// this.yTile = movingobjectposition.blockY; this.yTile = movingobjectposition.blockY;
// this.zTile = movingobjectposition.blockZ; this.zTile = movingobjectposition.blockZ;
// this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
// this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX)); this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));
this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY)); this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));
this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ)); this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));
@ -228,13 +228,19 @@ public class EntityDart extends EntityArrow
this.posX -= this.motionX / (double)f2 * 0.05000000074505806D; this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;
this.posY -= this.motionY / (double)f2 * 0.05000000074505806D; this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;
this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D; this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;
for (int p = 0; i < 16; ++i)
{
BiomesOPlenty.proxy.spawnDart(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
this.setDead(); this.setDead();
// if (this.inTile != 0) if (this.inTile != 0)
// { {
// Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this);
// } }
} }
} }
@ -285,28 +291,7 @@ public class EntityDart extends EntityArrow
this.motionZ *= (double)f4; this.motionZ *= (double)f4;
this.motionY -= (double)f1; this.motionY -= (double)f1;
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
//this.doBlockCollisions(); this.doBlockCollisions();
} }
} }
// @Override
// protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
// {
//
// if (par1MovingObjectPosition.entityHit != null)
// {
// par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 2);
// //((EntityLiving)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 300));
// }
//
// for (int i = 0; i < 16; ++i)
// {
// //BiomesOPlenty.proxy.spawnMud(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
// }
//
// if (!this.worldObj.isRemote)
// {
// this.setDead();
// }
// }
} }

View File

@ -0,0 +1,87 @@
package biomesoplenty.items.projectiles;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@SideOnly(Side.CLIENT)
public class RenderDart extends Render
{
public void renderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
{
this.loadTexture("/mods/BiomesOPlenty/textures/projectiles/dart.png");
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
byte b0 = 0;
float f2 = 0.0F;
float f3 = 0.5F;
float f4 = (float)(0 + b0 * 10) / 32.0F;
float f5 = (float)(5 + b0 * 10) / 32.0F;
float f6 = 0.0F;
float f7 = 0.15625F;
float f8 = (float)(5 + b0 * 10) / 32.0F;
float f9 = (float)(10 + b0 * 10) / 32.0F;
float f10 = 0.05625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f11 = (float)par1EntityArrow.arrowShake - par9;
if (f11 > 0.0F)
{
float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
}
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(f10, f10, f10);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
tessellator.draw();
for (int i = 0; i < 4; ++i)
{
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
tessellator.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
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.renderArrow((EntityArrow)par1Entity, par2, par4, par6, par8, par9);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B