Readded entities

This commit is contained in:
Adubbz 2013-12-30 00:15:54 +11:00
parent ea5c5a63b2
commit 2280ffbb8e
26 changed files with 2235 additions and 21 deletions

View File

@ -3,6 +3,8 @@ package biomesoplenty;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChicken;
import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderSnowball;
@ -18,7 +20,22 @@ import biomesoplenty.client.render.blocks.GraveRenderer;
import biomesoplenty.client.render.blocks.PlantsRenderer;
import biomesoplenty.client.render.blocks.RenderUtils;
import biomesoplenty.client.render.blocks.SmallBlockRenderer;
import biomesoplenty.client.render.entities.RenderDart;
import biomesoplenty.client.render.entities.RenderBird;
import biomesoplenty.client.render.entities.RenderGlob;
import biomesoplenty.client.render.entities.RenderJungleSpider;
import biomesoplenty.client.render.entities.RenderPhantom;
import biomesoplenty.client.render.entities.RenderPixie;
import biomesoplenty.client.render.entities.RenderRosester;
import biomesoplenty.client.render.entities.RenderWasp;
import biomesoplenty.client.render.entities.projectiles.RenderDart;
import biomesoplenty.common.configuration.BOPConfigurationIDs;
import biomesoplenty.common.entities.EntityBird;
import biomesoplenty.common.entities.EntityGlob;
import biomesoplenty.common.entities.EntityJungleSpider;
import biomesoplenty.common.entities.EntityPhantom;
import biomesoplenty.common.entities.EntityPixie;
import biomesoplenty.common.entities.EntityRosester;
import biomesoplenty.common.entities.EntityWasp;
import biomesoplenty.common.entities.projectiles.EntityDart;
import biomesoplenty.common.entities.projectiles.EntityMudball;
import cpw.mods.fml.client.registry.RenderingRegistry;
@ -40,6 +57,41 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart());
RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(BOPItemHelper.get("mudball"), 0));
if (BOPConfigurationIDs.globID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityGlob.class, new RenderGlob(new ModelSlime(16), new ModelSlime(0), 0.25F));
}
if (BOPConfigurationIDs.jungleSpiderID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityJungleSpider.class, new RenderJungleSpider());
}
if (BOPConfigurationIDs.rosesterID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityRosester.class, new RenderRosester(new ModelChicken(), 0.3F));
}
if (BOPConfigurationIDs.phantomID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityPhantom.class, new RenderPhantom());
}
if (BOPConfigurationIDs.waspID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityWasp.class, new RenderWasp());
}
if (BOPConfigurationIDs.birdID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityBird.class, new RenderBird());
}
if (BOPConfigurationIDs.pixieID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.class, new RenderPixie());
}
RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer());
RenderingRegistry.registerBlockHandler(new SmallBlockRenderer());

View File

@ -0,0 +1,142 @@
package biomesoplenty.client.models.entities;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelBird extends ModelBase
{
//fields
ModelRenderer Body;
ModelRenderer Stomach;
ModelRenderer Head;
ModelRenderer Beak;
ModelRenderer TuftBottom;
ModelRenderer TuftTop;
ModelRenderer Tail;
ModelRenderer WingRight;
ModelRenderer WingLeft;
ModelRenderer LegLeft;
ModelRenderer LegRight;
public ModelBird()
{
textureWidth = 64;
textureHeight = 32;
Body = new ModelRenderer(this, 0, 0);
Body.addBox(0F, 0F, 0F, 6, 3, 10);
Body.setRotationPoint(-3F, 20F, -5F);
Body.setTextureSize(64, 32);
Body.mirror = true;
setRotation(Body, 0F, 0F, 0F);
Stomach = new ModelRenderer(this, 0, 13);
Stomach.addBox(0F, 0F, 0F, 4, 1, 8);
Stomach.setRotationPoint(-2F, 23F, -4F);
Stomach.setTextureSize(64, 32);
Stomach.mirror = true;
setRotation(Stomach, 0F, 0F, 0F);
Head = new ModelRenderer(this, 0, 22);
Head.addBox(0F, 0F, 0F, 4, 3, 4);
Head.setRotationPoint(-2F, 19F, -9F);
Head.setTextureSize(64, 32);
Head.mirror = true;
setRotation(Head, 0F, 0F, 0F);
Beak = new ModelRenderer(this, 0, 29);
Beak.addBox(0F, 0F, 0F, 2, 1, 1);
Beak.setRotationPoint(-1F, 21F, -10F);
Beak.setTextureSize(64, 32);
Beak.mirror = true;
setRotation(Beak, 0F, 0F, 0F);
TuftBottom = new ModelRenderer(this, 28, 23);
TuftBottom.addBox(0F, 0F, 0F, 2, 1, 3);
TuftBottom.setRotationPoint(-1F, 18F, -7F);
TuftBottom.setTextureSize(64, 32);
TuftBottom.mirror = true;
setRotation(TuftBottom, 0F, 0F, 0F);
TuftTop = new ModelRenderer(this, 20, 27);
TuftTop.addBox(0F, 0F, 0F, 4, 0, 5);
TuftTop.setRotationPoint(-2F, 18F, -5F);
TuftTop.setTextureSize(64, 32);
TuftTop.mirror = true;
setRotation(TuftTop, 0F, 0F, 0F);
Tail = new ModelRenderer(this, 42, 0);
Tail.addBox(0F, 0F, 0F, 4, 0, 7);
Tail.setRotationPoint(-2F, 21F, 5F);
Tail.setTextureSize(64, 32);
Tail.mirror = true;
setRotation(Tail, 0F, 0F, 0F);
WingLeft = new ModelRenderer(this, 36, 13);
WingLeft.addBox(0F, 0F, 0F, 8, 0, 6);
WingLeft.setRotationPoint(3F, 20F, -4F);
WingLeft.setTextureSize(64, 32);
WingRight = new ModelRenderer(this, 36, 7);
WingRight.addBox(-8F, 0F, 0F, 8, 0, 6);
WingRight.setRotationPoint(-3F, 20F, -4F);
WingRight.setTextureSize(64, 32);
LegLeft = new ModelRenderer(this, 33, 0);
LegLeft.addBox(0F, 0F, 0F, 1, 1, 3);
LegLeft.setRotationPoint(2F, 23F, 0F);
LegLeft.setTextureSize(64, 32);
LegLeft.mirror = true;
setRotation(LegLeft, 0F, 0F, 0F);
LegRight = new ModelRenderer(this, 33, 0);
LegRight.addBox(0F, 0F, 0F, 1, 1, 3);
LegRight.setRotationPoint(-3F, 23F, 0F);
LegRight.setTextureSize(64, 32);
LegRight.mirror = true;
setRotation(LegRight, 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);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Body.render(f5);
Stomach.render(f5);
Head.render(f5);
Beak.render(f5);
TuftBottom.render(f5);
TuftTop.render(f5);
Tail.render(f5);
WingRight.render(f5);
WingLeft.render(f5);
LegLeft.render(f5);
LegRight.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);
int x = MathHelper.floor_double(entity.posX);
int y = MathHelper.floor_double(entity.posY);
int z = MathHelper.floor_double(entity.posZ);
//TODO: isAirBlock()
if (!(entity.posY <= entity.prevPosY && entity.worldObj.func_147437_c(x, y - 1, z)))
{
WingRight.rotateAngleZ = MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.25F;
WingLeft.rotateAngleZ = -WingRight.rotateAngleZ;
}
else
{
WingRight.rotateAngleZ = 0;
WingLeft.rotateAngleZ = 0;
}
}
}

View File

@ -0,0 +1,66 @@
package biomesoplenty.client.models.entities;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelPixie extends ModelBase
{
//fields
ModelRenderer Body;
ModelRenderer LeftWing;
ModelRenderer RightWing;
public ModelPixie()
{
textureWidth = 64;
textureHeight = 32;
Body = new ModelRenderer(this, 0, 0);
Body.addBox(0F, 0F, 0F, 4, 4, 4);
Body.setRotationPoint(-2F, 16F, -2F);
Body.setTextureSize(64, 32);
Body.mirror = true;
setRotation(Body, 0F, 0F, 0F);
LeftWing = new ModelRenderer(this, 32, 0);
LeftWing.addBox(0F, 0F, -1F, 0, 4, 7);
LeftWing.setRotationPoint(2F, 15F, 2F);
LeftWing.setTextureSize(64, 32);
LeftWing.mirror = true;
setRotation(LeftWing, 0F, 0F, 0F);
RightWing = new ModelRenderer(this, 50, 0);
RightWing.addBox(0F, 0F, -1F, 0, 4, 7);
RightWing.setRotationPoint(-2F, 15F, 2F);
RightWing.setTextureSize(64, 32);
RightWing.mirror = true;
setRotation(RightWing, 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);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Body.render(f5);
LeftWing.render(f5);
RightWing.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);
RightWing.rotateAngleY = -(MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.5F);
LeftWing.rotateAngleY = MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.5F;
}
}

View File

@ -0,0 +1,178 @@
package biomesoplenty.client.models.entities;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelWasp extends ModelBase
{
//fields
/*Head*/
ModelRenderer Head;
ModelRenderer Right_Antenna;
ModelRenderer Left_Antenna;
ModelRenderer Nose;
/*Wings*/
ModelRenderer Left_Wing;
ModelRenderer Right_Wing;
/*Body*/
ModelRenderer Thorax;
ModelRenderer Left_Leg_Back;
ModelRenderer Left_Leg_Middle;
ModelRenderer Left_Leg_Front;
ModelRenderer Right_Leg_Back;
ModelRenderer Right_Leg_Middle;
ModelRenderer Right_Leg_Front;
/*Stinger*/
ModelRenderer Abdomen;
ModelRenderer Stinger;
public ModelWasp()
{
textureWidth = 64;
textureHeight = 32;
/*Head*/
Head = new ModelRenderer(this, 46, 0);
Head.addBox(0F, 0F, 0F, 5, 5, 4);
Head.setRotationPoint(0F, -2F, 8F);
Head.setTextureSize(64, 32);
Right_Antenna = new ModelRenderer(this, 54, 27);
Right_Antenna.addBox(0F, 2F, -8F, 1, 1, 4);
Right_Antenna.setRotationPoint(3F, -3F, 10F);
Right_Antenna.setTextureSize(64, 32);
Right_Antenna.mirror = true;
Head.addChild(Right_Antenna);
Left_Antenna = new ModelRenderer(this, 54, 27);
Left_Antenna.addBox(0F, 2F, -8F, 1, 1, 4);
Left_Antenna.setRotationPoint(1F, -3F, 10F);
Left_Antenna.setTextureSize(64, 32);
Left_Antenna.mirror = true;
Head.addChild(Left_Antenna);
Nose = new ModelRenderer(this, 54, 9);
Nose.addBox(0F, 2F, -8F, 3, 4, 2);
Nose.setRotationPoint(1F, 0F, 11F);
Nose.setTextureSize(64, 32);
Nose.mirror = true;
Head.addChild(Nose);
/*Wings*/
Left_Wing = new ModelRenderer(this, 24, 26);
Left_Wing.addBox(-7F, 0F, 0F, 8, 1, 5);
Left_Wing.setRotationPoint(0F, -1F, 2F);
Left_Wing.setTextureSize(64, 32);
Right_Wing = new ModelRenderer(this, 24, 20);
Right_Wing.addBox(0F, 0F, 0F, 8, 1, 5);
Right_Wing.setRotationPoint(4F, -1F, 2F);
Right_Wing.setTextureSize(64, 32);
/*Body*/
Thorax = new ModelRenderer(this, 0, 0);
Thorax.addBox(0F, 0F, 0F, 5, 5, 8);
Thorax.setRotationPoint(0F, 0F, 0F);
Thorax.setTextureSize(64, 32);
Left_Leg_Back = new ModelRenderer(this, 13, 23);
Left_Leg_Back.addBox(0F, 0F, 0F, 1, 4, 1);
Left_Leg_Back.setRotationPoint(-1F, 4F, 1F);
Left_Leg_Back.setTextureSize(64, 32);
Thorax.addChild(Left_Leg_Back);
Left_Leg_Middle = new ModelRenderer(this, 13, 23);
Left_Leg_Middle.addBox(0F, 0F, 0F, 1, 3, 1);
Left_Leg_Middle.setRotationPoint(-1F, 4F, 4F);
Left_Leg_Middle.setTextureSize(64, 32);
Thorax.addChild(Left_Leg_Middle);
Left_Leg_Front = new ModelRenderer(this, 13, 23);
Left_Leg_Front.addBox(0F, 0F, 0F, 1, 4, 1);
Left_Leg_Front.setRotationPoint(-1F, 4F, 6F);
Left_Leg_Front.setTextureSize(64, 32);
Thorax.addChild(Left_Leg_Front);
Right_Leg_Back = new ModelRenderer(this, 13, 23);
Right_Leg_Back.addBox(0F, 0F, 0F, 1, 4, 1);
Right_Leg_Back.setRotationPoint(5F, 4F, 1F);
Right_Leg_Back.setTextureSize(64, 32);
Thorax.addChild(Right_Leg_Back);
Right_Leg_Middle = new ModelRenderer(this, 13, 23);
Right_Leg_Middle.addBox(0F, 0F, 0F, 1, 3, 1);
Right_Leg_Middle.setRotationPoint(5F, 4F, 4F);
Right_Leg_Middle.setTextureSize(64, 32);
Thorax.addChild(Right_Leg_Middle);
Right_Leg_Front = new ModelRenderer(this, 13, 23);
Right_Leg_Front.addBox(0F, 0F, 0F, 1, 4, 1);
Right_Leg_Front.setRotationPoint(5F, 4F, 6F);
Right_Leg_Front.setTextureSize(64, 32);
Thorax.addChild(Right_Leg_Front);
/*Stinger*/
Abdomen = new ModelRenderer(this, 0, 13);
Abdomen.addBox(0F, 0F, 0F, 3, 3, 2);
Abdomen.setRotationPoint(1F, 2F, -2F);
Abdomen.setTextureSize(64, 32);
Stinger = new ModelRenderer(this, 0, 18);
Stinger.addBox(-1F, -3F, 2F, 1, 1, 3);
Stinger.setRotationPoint(2F, 4F, -5F);
Stinger.setTextureSize(64, 32);
Abdomen.addChild(Stinger);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
/*Head*/
Head.render(f5);
/*Wings*/
Left_Wing.render(f5);
Right_Wing.render(f5);
/*Body*/
Thorax.render(f5);
/*float nosespeed = 0.5F * (float)(entity.entityId % 10);
Nose.rotateAngleX = MathHelper.sin((float)entity.ticksExisted * nosespeed) * 2.5F * (float)Math.PI / 180.0F;
Nose.rotateAngleY = 0.0F;
Nose.rotateAngleZ = MathHelper.cos((float)entity.ticksExisted * nosespeed) * 1.5F * (float)Math.PI / 180.0F;*/
/*Stinger*/
Abdomen.render(f5);
}
@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);
float headspeed = 0.1F * (float)(entity.ticksExisted % 10);
Head.rotateAngleX = MathHelper.sin(f2 * headspeed) * 2.5F * (float)Math.PI / 180.0F;
Head.rotateAngleZ = MathHelper.cos(f2 * headspeed) * 1.5F * (float)Math.PI / 180.0F;
float thoraxspeed = 0.075F * (float)(entity.ticksExisted % 10);
Thorax.rotateAngleX = MathHelper.sin(f2 * thoraxspeed) * 2.5F * (float)Math.PI / 180.0F;
Thorax.rotateAngleZ = MathHelper.cos(f2 * thoraxspeed) * 1.5F * (float)Math.PI / 180.0F;
Right_Wing.rotateAngleY = MathHelper.cos(f2 * 1.7F) * (float)Math.PI * 0.25F;
Left_Wing.rotateAngleY = -Right_Wing.rotateAngleY;
Right_Wing.rotateAngleZ = Right_Wing.rotateAngleY;
Left_Wing.rotateAngleZ = -Right_Wing.rotateAngleY;
float abdomenspeed = 0.6F * (float)(entity.ticksExisted % 10);
Abdomen.rotateAngleX = MathHelper.sin(f2 * abdomenspeed) * 2.5F * (float)Math.PI / 180.0F;
Abdomen.rotateAngleZ = MathHelper.cos(f2 * abdomenspeed) * 1.5F * (float)Math.PI / 180.0F;
}
}

View File

@ -0,0 +1,24 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import biomesoplenty.client.models.entities.ModelBird;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderBird extends RenderLiving
{
public RenderBird()
{
super(new ModelBird(), 0.25F);
this.shadowSize = 0.0F;
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/bird.png");
}
}

View File

@ -0,0 +1,78 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import biomesoplenty.common.entities.EntityGlob;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderGlob extends RenderLiving
{
private ModelBase scaleAmount;
public RenderGlob(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
scaleAmount = par2ModelBase;
}
protected int shouldGlobRenderPass(EntityGlob par1EntityGlob, int par2, float par3)
{
if (par1EntityGlob.isInvisible())
return 0;
else if (par2 == 0)
{
this.setRenderPassModel(scaleAmount);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
else
{
if (par2 == 1)
{
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
return -1;
}
}
/**
* sets the scale for the Glob based on getGlobSize in EntityGlob
*/
protected void scaleGlob(EntityGlob par1EntityGlob, float par2)
{
float f1 = par1EntityGlob.getGlobSize();
float f2 = (par1EntityGlob.prevSquishFactor + (par1EntityGlob.squishFactor - par1EntityGlob.prevSquishFactor) * par2) / (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
}
@Override
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.scaleGlob((EntityGlob)par1EntityLivingBase, par2);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/glob.png");
}
@Override
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
{
return this.shouldGlobRenderPass((EntityGlob)par1EntityLivingBase, par2, par3);
}
}

View File

@ -0,0 +1,38 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.renderer.entity.RenderSpider;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import biomesoplenty.common.entities.EntityJungleSpider;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderJungleSpider extends RenderSpider
{
public RenderJungleSpider()
{
this.shadowSize *= 0.0F;
}
protected void scaleSpider(EntityJungleSpider entityjunglespider, float par2)
{
GL11.glScalef(0.4F, 0.4F, 0.3F);
}
@Override
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.scaleSpider((EntityJungleSpider)par1EntityLivingBase, par2);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/junglespider.png");
}
}

View File

@ -0,0 +1,26 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderPhantom extends RenderLiving
{
public RenderPhantom()
{
super(new ModelZombie(), 0.5F);
this.shadowSize *= 0.0F;
}
@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return null;
}
}

View File

@ -0,0 +1,70 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import biomesoplenty.client.models.entities.ModelPixie;
import biomesoplenty.common.entities.EntityPixie;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPixie extends RenderLiving
{
public RenderPixie()
{
super(new ModelPixie(), 0.25F);
this.setRenderPassModel(new ModelPixie());
this.shadowSize = 0.0F;
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/pixie.png");
}
protected int setPixieBrightness(EntityPixie par1EntityPixie, int par2, float par3)
{
if (par2 != 0)
{
return -1;
}
else
{
this.bindTexture(new ResourceLocation("biomesoplenty:textures/mobs/pixie.png"));
float f1 = 1.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
if (par1EntityPixie.isInvisible())
{
GL11.glDepthMask(false);
}
else
{
GL11.glDepthMask(true);
}
char c0 = 61680;
int j = c0 % 65536;
int k = c0 / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
return 1;
}
}
@Override
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
{
return this.setPixieBrightness((EntityPixie)par1EntityLivingBase, par2, par3);
}
}

View File

@ -0,0 +1,24 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderChicken;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import biomesoplenty.common.entities.EntityRosester;
public class RenderRosester extends RenderChicken
{
public RenderRosester(ModelBase par1ModelBase, float par2)
{
super(par1ModelBase, par2);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/rosester.png");
}
}

View File

@ -0,0 +1,35 @@
package biomesoplenty.client.render.entities;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import biomesoplenty.client.models.entities.ModelWasp;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderWasp extends RenderLiving
{
public RenderWasp()
{
super(new ModelWasp(), 0.25F);
this.shadowSize = 0.0F;
}
@Override
protected void preRenderCallback(EntityLivingBase entity, float partialTickTime)
{
GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.75F, 0.0F);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/wasp.png");
}
}

View File

@ -1,4 +1,4 @@
package biomesoplenty.client.render.entities;
package biomesoplenty.client.render.entities.projectiles;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;

View File

@ -4,10 +4,14 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
public class BlockCloud extends Block
{
@ -52,15 +56,15 @@ public class BlockCloud extends Block
{
entity.fallDistance = 0.0F;
/*TODO: FEATURE if (par5Entity instanceof EntityPlayer)
if (entity instanceof EntityPlayer)
{
InventoryPlayer inventory = ((EntityPlayer)par5Entity).inventory;
InventoryPlayer inventory = ((EntityPlayer)entity).inventory;
if (inventory.armorInventory[0] != null && inventory.armorInventory[0].itemID == Items.wadingBoots.get().itemID)
if (inventory.armorInventory[0] != null && inventory.armorInventory[0].getItem() == BOPItemHelper.get("wadingBoots"))
{
return;
}
}*/
}
entity.motionX *= 0.8D;
entity.motionZ *= 0.8D;

View File

@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.common.entities.EntityWasp;
public class BlockHive extends Block
{
@ -40,9 +41,9 @@ public class BlockHive extends Block
{
if (world.getBlockMetadata(x, y, z) == 2)
{
/*TODO: FEATURE EntityWasp wasp = new EntityWasp(world);
EntityWasp wasp = new EntityWasp(world);
wasp.setLocationAndAngles((double)x + 0.6, (double)y, (double)z + 0.3, 0.0F, 0.0F);
world.spawnEntityInWorld(wasp);*/
world.spawnEntityInWorld(wasp);
}
}

View File

@ -1,13 +1,25 @@
package biomesoplenty.common.core;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityList.EntityEggInfo;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.common.configuration.BOPConfigurationIDs;
import biomesoplenty.common.entities.EntityBird;
import biomesoplenty.common.entities.EntityGlob;
import biomesoplenty.common.entities.EntityJungleSpider;
import biomesoplenty.common.entities.EntityPhantom;
import biomesoplenty.common.entities.EntityPixie;
import biomesoplenty.common.entities.EntityRosester;
import biomesoplenty.common.entities.EntityWasp;
import biomesoplenty.common.entities.projectiles.EntityDart;
import biomesoplenty.common.entities.projectiles.EntityMudball;
import cpw.mods.fml.common.registry.EntityRegistry;
public class BOPEntities
{
public static int eggIdCounter = 300;
public static void init()
{
registerEntities();
@ -17,5 +29,103 @@ public class BOPEntities
{
EntityRegistry.registerModEntity(EntityDart.class, "dart", BOPConfigurationIDs.entityDartID, BiomesOPlenty.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityMudball.class, "mudball", BOPConfigurationIDs.entityMudballID, BiomesOPlenty.instance, 80, 3, true);
if (BOPConfigurationIDs.jungleSpiderID > 0)
{
EntityRegistry.registerModEntity(EntityJungleSpider.class, "JungleSpider", BOPConfigurationIDs.jungleSpiderID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityJungleSpider.class, 5147192, 11013646);
/*TODO: FEATURE if (Biomes.bambooForest.isPresent() && Biomes.jungleNew.isPresent() && Biomes.tropicalRainforest.isPresent() && Biomes.oasis.isPresent() && Biomes.tropics.isPresent())
{
EntityRegistry.addSpawn(EntityJungleSpider.class, 8, 1, 3, EnumCreatureType.monster, Biomes.bambooForest.get(), Biomes.jungleNew.get(), Biomes.tropicalRainforest.get(), Biomes.oasis.get(), Biomes.tropics.get());
}*/
}
if (BOPConfigurationIDs.rosesterID > 0)
{
EntityRegistry.registerModEntity(EntityRosester.class, "Rosester", BOPConfigurationIDs.rosesterID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityRosester.class, 14831439, 16756224);
/*TODO: FEATURE if (Biomes.garden.isPresent())
{
EntityRegistry.addSpawn(EntityRosester.class, 10, 2, 4, EnumCreatureType.creature, Biomes.garden.get());
}*/
}
if (BOPConfigurationIDs.globID > 0)
{
EntityRegistry.registerModEntity(EntityGlob.class, "Glob", BOPConfigurationIDs.globID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityGlob.class, 6836276, 8414787);
/*TODO: FEATURE if (Biomes.bog.isPresent() && Biomes.deadSwamp.isPresent() && Biomes.fen.isPresent() && Biomes.moor.isPresent() && Biomes.quagmire.isPresent() && Biomes.sludgepit.isPresent() && Biomes.swamplandNew.isPresent())
{
EntityRegistry.addSpawn(EntityGlob.class, 1, 1, 1, EnumCreatureType.creature, Biomes.bog.get(), Biomes.deadSwamp.get(), Biomes.fen.get(), Biomes.moor.get(), Biomes.quagmire.get(), Biomes.sludgepit.get(), Biomes.swamplandNew.get());
}*/
}
if (BOPConfigurationIDs.phantomID > 0)
{
EntityRegistry.registerModEntity(EntityPhantom.class, "Phantom", BOPConfigurationIDs.phantomID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityPhantom.class, 4472140, 2499368);
/*TODO: FEATURE if (Biomes.netherBone.isPresent() && Biomes.netherDesert.isPresent())
{
EntityRegistry.addSpawn(EntityPhantom.class, 8, 1, 1, EnumCreatureType.monster, Biomes.netherBone.get(), Biomes.netherDesert.get());
}*/
}
if (BOPConfigurationIDs.waspID > 0)
{
EntityRegistry.registerModEntity(EntityWasp.class, "Wasp", BOPConfigurationIDs.waspID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityWasp.class, 16434729, 2500135);
}
if (BOPConfigurationIDs.birdID > 0)
{
EntityRegistry.registerModEntity(EntityBird.class, "Bird", BOPConfigurationIDs.birdID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityBird.class, 5277691, 16772788);
/*TODO: FEATURE if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent() && Biomes.promisedLandShrub.isPresent())
{
EntityRegistry.addSpawn(EntityBird.class, 10, 3, 5, EnumCreatureType.ambient, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
}*/
}
if (BOPConfigurationIDs.pixieID > 0)
{
EntityRegistry.registerModEntity(EntityPixie.class, "Pixie", BOPConfigurationIDs.pixieID, BiomesOPlenty.instance, 80, 3, true);
registerEntityEgg(EntityPixie.class, 16742365, 16645116);
/*TODO: FEATURE if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent() && Biomes.promisedLandShrub.isPresent())
{
EntityRegistry.addSpawn(EntityPixie.class, 4, 1, 3, EnumCreatureType.monster, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
}*/
}
}
public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor)
{
int id = getUniqueEntityEggId();
EntityList.IDtoClassMapping.put(id, entity);
EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
}
public static int getUniqueEntityEggId()
{
do
{
eggIdCounter++;
} while (EntityList.getStringFromID(eggIdCounter) != null);
return eggIdCounter;
}
}

View File

@ -0,0 +1,108 @@
package biomesoplenty.common.entities;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityBird extends EntityFlyingCreature
{
public int courseChangeCooldown;
public double waypointX;
public double waypointY;
public double waypointZ;
public EntityBird(World world)
{
super(world);
this.setSize(1.0F, 1.0F);
}
@Override
protected void updateEntityActionState()
{
double d0 = this.waypointX - this.posX;
double d1 = this.waypointY - this.posY;
double d2 = this.waypointZ - this.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 < 1.0D || d3 > 3600.0D)
{
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 8.0F - 4.0F) * 6.0F);
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 6.0F);
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 8.0F - 4.0F) * 6.0F);
}
if (this.courseChangeCooldown-- <= 0)
{
this.courseChangeCooldown += this.rand.nextInt(2) + 2;
d3 = (double)MathHelper.sqrt_double(d3);
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
{
this.motionX += d0 / d3 * 0.1D;
this.motionY += d1 / d3 * 0.1D;
this.motionZ += d2 / d3 * 0.1D;
}
else
{
this.waypointX = this.posX;
this.waypointY = this.posY;
this.waypointZ = this.posZ;
}
}
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI;
}
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
{
double d4 = (this.waypointX - this.posX) / par7;
double d5 = (this.waypointY - this.posY) / par7;
double d6 = (this.waypointZ - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
{
return false;
}
}
return true;
}
@Override
protected void dropFewItems(boolean par1, int par2)
{
int var3 = rand.nextInt(3) + rand.nextInt(1 + par2);
for (int var4 = 0; var4 < var3; ++var4)
{
this.entityDropItem(new ItemStack(Items.feather, 1, 1), 0.0F);
}
}
@Override
protected String getLivingSound()
{
return "biomesoplenty:mob.bird.say";
}
@Override
protected String getHurtSound()
{
return "biomesoplenty:mob.bird.hurt";
}
@Override
protected String getDeathSound()
{
return "biomesoplenty:mob.bird.hurt";
}
}

View File

@ -0,0 +1,93 @@
package biomesoplenty.common.entities;
import net.minecraft.block.Block;
import net.minecraft.entity.passive.EntityAmbientCreature;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityFlyingCreature extends EntityAmbientCreature
{
public EntityFlyingCreature(World par1World)
{
super(par1World);
}
@Override
protected void fall(float par1) {}
@Override
protected void updateFallState(double par1, boolean par3) {}
@Override
public void moveEntityWithHeading(float par1, float par2)
{
if (this.isInWater())
{
this.moveFlying(par1, par2, 0.02F);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.800000011920929D;
this.motionY *= 0.800000011920929D;
this.motionZ *= 0.800000011920929D;
}
else if (this.handleLavaMovement())
{
this.moveFlying(par1, par2, 0.02F);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.5D;
this.motionY *= 0.5D;
this.motionZ *= 0.5D;
}
else
{
float f2 = 0.91F;
if (this.onGround)
{
f2 = 0.54600006F;
//TODO: getBlock()
Block block = this.worldObj.func_147439_a(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
//TODO: slipperiness
f2 = block.field_149765_K * 0.91F;
}
float f3 = 0.16277136F / (f2 * f2 * f2);
this.moveFlying(par1, par2, this.onGround ? 0.1F * f3 : 0.02F);
f2 = 0.91F;
if (this.onGround)
{
f2 = 0.54600006F;
//TODO: getBlock()
Block block = this.worldObj.func_147439_a(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
//TODO: slipperiness
f2 = block.field_149765_K * 0.91F;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= (double)f2;
this.motionY *= (double)f2;
this.motionZ *= (double)f2;
}
this.prevLimbSwingAmount = this.limbSwingAmount;
double d0 = this.posX - this.prevPosX;
double d1 = this.posZ - this.prevPosZ;
float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F)
{
f4 = 1.0F;
}
this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
this.limbSwing += this.limbSwingAmount;
}
@Override
public boolean isOnLadder()
{
return false;
}
}

View File

@ -0,0 +1,93 @@
package biomesoplenty.common.entities;
import net.minecraft.block.Block;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityFlyingMob extends EntityMob
{
public EntityFlyingMob(World par1World)
{
super(par1World);
}
@Override
protected void fall(float par1) {}
@Override
protected void updateFallState(double par1, boolean par3) {}
@Override
public void moveEntityWithHeading(float par1, float par2)
{
if (this.isInWater())
{
this.moveFlying(par1, par2, 0.02F);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.800000011920929D;
this.motionY *= 0.800000011920929D;
this.motionZ *= 0.800000011920929D;
}
else if (this.handleLavaMovement())
{
this.moveFlying(par1, par2, 0.02F);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.5D;
this.motionY *= 0.5D;
this.motionZ *= 0.5D;
}
else
{
float f2 = 0.91F;
if (this.onGround)
{
f2 = 0.54600006F;
//TODO: getBlock()
Block block = this.worldObj.func_147439_a(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
//TODO: slipperiness
f2 = block.field_149765_K * 0.91F;
}
float f3 = 0.16277136F / (f2 * f2 * f2);
this.moveFlying(par1, par2, this.onGround ? 0.1F * f3 : 0.02F);
f2 = 0.91F;
if (this.onGround)
{
f2 = 0.54600006F;
//TODO: getBlock()
Block block = this.worldObj.func_147439_a(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
//TODO: slipperiness
f2 = block.field_149765_K * 0.91F;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= (double)f2;
this.motionY *= (double)f2;
this.motionZ *= (double)f2;
}
this.prevLimbSwingAmount = this.limbSwingAmount;
double d0 = this.posX - this.prevPosX;
double d1 = this.posZ - this.prevPosZ;
float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F)
{
f4 = 1.0F;
}
this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
this.limbSwing += this.limbSwingAmount;
}
@Override
public boolean isOnLadder()
{
return false;
}
}

View File

@ -0,0 +1,352 @@
package biomesoplenty.common.entities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
public class EntityGlob extends EntityLiving implements IMob
{
/** Chances for Globs to spawn in swamps for every moon phase. */
private static final float[] spawnChances = new float[] {1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F};
public float squishAmount;
public float squishFactor;
public float prevSquishFactor;
/** the time between each jump of the Glob */
private int globJumpDelay = 0;
public EntityGlob(World par1World)
{
super(par1World);
int i = 1 << rand.nextInt(3);
yOffset = 0.0F;
globJumpDelay = rand.nextInt(20) + 10;
this.setGlobSize(i);
}
@Override
protected void entityInit()
{
super.entityInit();
dataWatcher.addObject(16, new Byte((byte)1));
}
protected void setGlobSize(int par1)
{
this.dataWatcher.updateObject(16, new Byte((byte)par1));
this.setSize(0.6F * (float)par1, 0.6F * (float)par1);
this.setPosition(this.posX, this.posY, this.posZ);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute((double)(par1 * par1));
this.setHealth(this.getMaxHealth());
this.experienceValue = par1;
}
public int getGlobSize()
{
return dataWatcher.getWatchableObjectByte(16);
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("Size", this.getGlobSize() - 1);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
this.setGlobSize(par1NBTTagCompound.getInteger("Size") + 1);
}
protected String getJumpSound()
{
return "mob.slime." + (this.getGlobSize() > 1 ? "big" : "small");
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
if (!worldObj.isRemote && worldObj.difficultySetting == EnumDifficulty.PEACEFUL && this.getGlobSize() > 0)
{
isDead = true;
}
squishFactor += (squishAmount - squishFactor) * 0.5F;
prevSquishFactor = squishFactor;
boolean flag = onGround;
super.onUpdate();
int i;
if (onGround && !flag)
{
i = this.getGlobSize();
for (int j = 0; j < i * 8; ++j)
{
float f = rand.nextFloat() * (float)Math.PI * 2.0F;
float f1 = rand.nextFloat() * 0.5F + 0.5F;
float f2 = MathHelper.sin(f) * i * 0.5F * f1;
float f3 = MathHelper.cos(f) * i * 0.5F * f1;
BiomesOPlenty.proxy.spawnParticle("mud", posX + f2, boundingBox.minY, posZ + f3);
}
if (this.makesSoundOnLand())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
squishAmount = -0.5F;
}
else if (!onGround && flag)
{
squishAmount = 1.0F;
}
this.func_70808_l();
if (worldObj.isRemote)
{
i = this.getGlobSize();
this.setSize(0.6F * i, 0.6F * i);
}
}
@Override
protected void updateEntityActionState()
{
this.despawnEntity();
EntityPlayer entityplayer = worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
{
this.faceEntity(entityplayer, 10.0F, 20.0F);
}
if (onGround && globJumpDelay-- <= 0)
{
globJumpDelay = this.getJumpDelay();
if (entityplayer != null)
{
globJumpDelay /= 3;
}
isJumping = true;
if (this.makesSoundOnJump())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
moveStrafing = 1.0F - rand.nextFloat() * 2.0F;
moveForward = 1 * this.getGlobSize();
}
else
{
isJumping = false;
if (onGround)
{
moveStrafing = moveForward = 0.0F;
}
}
}
protected void func_70808_l()
{
squishAmount *= 0.6F;
}
/**
* Gets the amount of time the Glob needs to wait between jumps.
*/
protected int getJumpDelay()
{
return rand.nextInt(20) + 10;
}
protected EntityGlob createInstance()
{
return new EntityGlob(worldObj);
}
/**
* Will get destroyed next tick.
*/
@Override
public void setDead()
{
int i = this.getGlobSize();
//func_110143_aJ() == getHealth
if (!worldObj.isRemote && i > 1 && this.getHealth() <= 0)
{
int j = 2 + rand.nextInt(3);
for (int k = 0; k < j; ++k)
{
float f = (k % 2 - 0.5F) * i / 4.0F;
float f1 = (k / 2 - 0.5F) * i / 4.0F;
EntityGlob entityGlob = this.createInstance();
entityGlob.setGlobSize(i / 2);
entityGlob.setLocationAndAngles(posX + f, posY + 0.5D, posZ + f1, rand.nextFloat() * 360.0F, 0.0F);
worldObj.spawnEntityInWorld(entityGlob);
}
}
super.setDead();
}
/**
* Called by a player entity when they collide with an entity
*/
@Override
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
{
if (this.canDamagePlayer())
{
int i = this.getGlobSize();
if (this.canEntityBeSeen(par1EntityPlayer) && this.getDistanceSqToEntity(par1EntityPlayer) < 0.6D * i * 0.6D * i && par1EntityPlayer.attackEntityFrom(DamageSource.causeMobDamage(this), this.getAttackStrength()))
{
this.playSound("mob.attack", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
}
}
}
/**
* Indicates weather the Glob is able to damage the player (based upon the Glob's size)
*/
protected boolean canDamagePlayer()
{
return this.getGlobSize() > 1;
}
/**
* Gets the amount of damage dealt to the player when "attacked" by the Glob.
*/
protected int getAttackStrength()
{
return this.getGlobSize();
}
/**
* Returns the sound this mob makes when it is hurt.
*/
@Override
protected String getHurtSound()
{
return "mob.slime." + (this.getGlobSize() > 1 ? "big" : "small");
}
/**
* Returns the sound this mob makes on death.
*/
@Override
protected String getDeathSound()
{
return "mob.slime." + (this.getGlobSize() > 1 ? "big" : "small");
}
@Override
protected void dropFewItems(boolean par1, int par2)
{
int var3 = rand.nextInt(3) + rand.nextInt(1 + par2);
if (rand.nextInt(1000) == 0)
{
this.entityDropItem(new ItemStack(BOPItemHelper.get("bopDiscMud")), 0.0F);
}
for (int var4 = 0; var4 < var3; ++var4)
{
this.entityDropItem(new ItemStack(BOPItemHelper.get("mudball"), 1, 1), 0.0F);
}
//TODO: dropItem()
this.func_145779_a(Items.slime_ball, 1);
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
@Override
public boolean getCanSpawnHere()
{
Chunk chunk = worldObj.getChunkFromBlockCoords(MathHelper.floor_double(posX), MathHelper.floor_double(posZ));
if (worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj))
return false;
else
{
if (this.getGlobSize() == 1 || worldObj.difficultySetting != EnumDifficulty.PEACEFUL)
{
BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(MathHelper.floor_double(posX), MathHelper.floor_double(posZ));
if (biomegenbase == BiomeGenBase.swampland && posY > 50.0D && posY < 70.0D && rand.nextFloat() < 0.5F && rand.nextFloat() < this.worldObj.getMoonPhase() && worldObj.getBlockLightValue(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) <= rand.nextInt(8))
return super.getCanSpawnHere();
if (rand.nextInt(10) == 0 && chunk.getRandomWithSeed(987234911L).nextInt(10) == 0 && posY < 40.0D)
return super.getCanSpawnHere();
}
return false;
}
}
/**
* Returns the volume for the sounds this mob makes.
*/
@Override
protected float getSoundVolume()
{
return 0.4F * this.getGlobSize();
}
/**
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
* use in wolves.
*/
@Override
public int getVerticalFaceSpeed()
{
return 0;
}
/**
* Returns true if the Glob makes a sound when it jumps (based upon the Glob's size)
*/
protected boolean makesSoundOnJump()
{
return this.getGlobSize() > 0;
}
/**
* Returns true if the Glob makes a sound when it lands after a jump (based upon the Glob's size)
*/
protected boolean makesSoundOnLand()
{
return this.getGlobSize() > 2;
}
}

View File

@ -0,0 +1,61 @@
package biomesoplenty.common.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
public class EntityJungleSpider extends EntitySpider
{
public EntityJungleSpider(World par1World)
{
super(par1World);
this.setSize(0.4F, 0.3F);
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
//Max health
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(6.0D);
//Movement speed
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.95D);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
if (super.attackEntityAsMob(par1Entity))
{
if (par1Entity instanceof EntityLivingBase)
{
byte b0 = 0;
if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL)
{
b0 = 7;
}
else if (this.worldObj.difficultySetting == EnumDifficulty.HARD)
{
b0 = 15;
}
if (b0 > 0)
{
((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.blindness.id, b0 * 20, 0));
}
}
return true;
}
else
{
return false;
}
}
}

View File

@ -0,0 +1,125 @@
package biomesoplenty.common.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.api.BOPPotionHelper;
public class EntityPhantom extends EntityMob
{
public EntityPhantom(World world)
{
super(world);
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(20.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.45D);
}
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
if (!this.onGround && this.motionY < 0.0D)
{
this.motionY *= 0.6D;
}
this.fallDistance = 0.0F;
}
@Override
protected void fall(float par1) {}
@Override
public void onEntityUpdate()
{
super.onEntityUpdate();
for (int i = 0; i < 9; i++)
{
this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextDouble()) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble()) * (double)this.width, 0, 0, 0);
}
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
if (super.attackEntityAsMob(par1Entity))
{
if (par1Entity instanceof EntityLivingBase)
{
if (worldObj.difficultySetting != EnumDifficulty.PEACEFUL && worldObj.difficultySetting != EnumDifficulty.EASY)
{
((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(BOPPotionHelper.get("possession").id, 30, 0));
}
}
return true;
}
else
{
return false;
}
}
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
for (int i = 0; i < 9; i++)
{
this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextDouble()) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble()) * (double)this.width, 66, 0, 0);
}
return super.attackEntityFrom(par1DamageSource, par2);
}
@Override
protected void dropFewItems(boolean par1, int par2)
{
super.dropFewItems(par1, par2);
if (par1 && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + par2) > 0))
{
this.entityDropItem(new ItemStack(BOPItemHelper.get("misc"), 1, 10), 1);
}
}
@Override
public boolean getCanSpawnHere()
{
return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox);
}
@Override
protected String getLivingSound()
{
return "biomesoplenty:mob.phantom.say";
}
@Override
protected String getHurtSound()
{
return "biomesoplenty:mob.phantom.hurt";
}
@Override
protected String getDeathSound()
{
return "biomesoplenty:mob.phantom.death";
}
}

View File

@ -0,0 +1,165 @@
package biomesoplenty.common.entities;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
public class EntityPixie extends EntityFlyingCreature
{
public int courseChangeCooldown;
public double waypointX;
public double waypointY;
public double waypointZ;
public EntityPixie(World world)
{
super(world);
this.setSize(1.0F, 1.0F);
}
@Override
protected void updateEntityActionState()
{
double d0 = this.waypointX - this.posX;
double d1 = this.waypointY - this.posY;
double d2 = this.waypointZ - this.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 < 1.0D || d3 > 3600.0D)
{
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 4.0F - 2.0F) * 2.0F);
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 4.0F - 2.0F) * 2.0F);
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 4.0F - 2.0F) * 2.0F);
}
if (this.courseChangeCooldown-- <= 0)
{
this.courseChangeCooldown += this.rand.nextInt(2) + 2;
d3 = (double)MathHelper.sqrt_double(d3);
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
{
this.motionX += d0 / d3 * 0.1D;
this.motionY += d1 / d3 * 0.1D;
this.motionZ += d2 / d3 * 0.1D;
}
else
{
this.waypointX = this.posX;
this.waypointY = this.posY;
this.waypointZ = this.posZ;
}
}
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI;
}
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
{
double d4 = (this.waypointX - this.posX) / par7;
double d5 = (this.waypointY - this.posY) / par7;
double d6 = (this.waypointZ - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
{
return false;
}
}
return true;
}
@Override
protected void dropFewItems(boolean par1, int par2)
{
int var3 = rand.nextInt(3) + rand.nextInt(1 + par2);
for (int var4 = 0; var4 < var3; ++var4)
{
this.entityDropItem(new ItemStack(BOPItemHelper.get("misc"), 1, 11), 0.0F);
}
}
@Override
public void onEntityUpdate()
{
super.onEntityUpdate();
if (this.worldObj.isRemote)
{
for (int i = 0; i < 7; i++)
{
if (this.rand.nextInt(2) == 0)
{
BiomesOPlenty.proxy.spawnParticle("pixietrail", this.posX + (this.rand.nextDouble()) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble()) * (double)this.width);
}
}
}
}
/**
* Checks to make sure the light is not too bright where the mob is spawning
*/
protected boolean isValidLightLevel()
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.boundingBox.minY);
int k = MathHelper.floor_double(this.posZ);
if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > this.rand.nextInt(32))
{
return false;
}
else
{
int l = this.worldObj.getBlockLightValue(i, j, k);
if (this.worldObj.isThundering())
{
int i1 = this.worldObj.skylightSubtracted;
this.worldObj.skylightSubtracted = 10;
l = this.worldObj.getBlockLightValue(i, j, k);
this.worldObj.skylightSubtracted = i1;
}
return l <= this.rand.nextInt(8);
}
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
@Override
public boolean getCanSpawnHere()
{
return this.isValidLightLevel() && super.getCanSpawnHere();
}
@Override
protected String getLivingSound()
{
return "biomesoplenty:mob.pixie.say";
}
@Override
protected String getHurtSound()
{
return "biomesoplenty:mob.pixie.hurt";
}
@Override
protected String getDeathSound()
{
return "biomesoplenty:mob.pixie.hurt";
}
}

View File

@ -0,0 +1,190 @@
package biomesoplenty.common.entities;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityRosester extends EntityChicken
{
public boolean field_70885_d = false;
public float field_70886_e = 0.0F;
public float destPos = 0.0F;
public float field_70884_g;
public float field_70888_h;
public float field_70889_i = 1.0F;
public int timeUntilNextEgg;
public EntityRosester(World par1World)
{
super(par1World);
this.setSize(0.3F, 0.7F);
timeUntilNextEgg = rand.nextInt(6000) + 6000;
float var2 = 0.25F;
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(1, new EntityAIPanic(this, 0.38F));
tasks.addTask(2, new EntityAIMate(this, var2));
tasks.addTask(3, new EntityAITempt(this, 0.25F, Items.wheat_seeds, false));
tasks.addTask(4, new EntityAIFollowParent(this, 0.28F));
tasks.addTask(5, new EntityAIWander(this, var2));
tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
tasks.addTask(7, new EntityAILookIdle(this));
}
@Override
public boolean isAIEnabled()
{
return true;
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(4.0D);
}
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
field_70888_h = field_70886_e;
field_70884_g = destPos;
destPos = (float)(destPos + (onGround ? -1 : 4) * 0.3D);
if (destPos < 0.0F)
{
destPos = 0.0F;
}
if (destPos > 1.0F)
{
destPos = 1.0F;
}
if (!onGround && field_70889_i < 1.0F)
{
field_70889_i = 1.0F;
}
field_70889_i = (float)(field_70889_i * 0.9D);
if (!onGround && motionY < 0.0D)
{
motionY *= 0.6D;
}
field_70886_e += field_70889_i * 2.0F;
if (!this.isChild() && !worldObj.isRemote && --timeUntilNextEgg <= 0)
{
this.playSound("mob.chicken.plop", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
this.entityDropItem(new ItemStack(Items.dye, 1, 1), 0.0F);
timeUntilNextEgg = rand.nextInt(6000) + 6000;
}
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posZ);
for (i = 0; i < 4; ++i)
{
j = MathHelper.floor_double(this.posX + (double)((float)(i % 2 * 2 - 1) * 0.25F));
int k = MathHelper.floor_double(this.posY);
int l = MathHelper.floor_double(this.posZ + (double)((float)(i / 2 % 2 * 2 - 1) * 0.25F));
//TODO: isAirBlock() getFloatTemperature() canPlaceBlockAt()
if (!this.worldObj.isRemote && this.worldObj.func_147437_c(j, k, l) && this.worldObj.getBiomeGenForCoords(j, l).func_150564_a(j, k, l) > 0.3F && Blocks.red_flower.func_149742_c(this.worldObj, j, k, l) && this.worldObj.rand.nextInt(300) == 0)
{
//TODO: setBlock()
this.worldObj.func_147465_d(j, k, l, Blocks.red_flower, 0, 2);
}
}
}
@Override
protected void fall(float par1) {}
@Override
protected String getLivingSound()
{
return "mob.chicken.say";
}
@Override
protected String getHurtSound()
{
return "mob.chicken.hurt";
}
@Override
protected String getDeathSound()
{
return "mob.chicken.hurt";
}
@Override
//TODO: playStepSound()
protected void func_145780_a(int par1, int par2, int par3, Block block)
{
this.playSound("mob.chicken.step", 0.15F, 1.0F);
}
@Override
//TODO: getDropItem()
protected Item func_146068_u()
{
return Items.feather;
}
@Override
protected void dropFewItems(boolean par1, int par2)
{
int var3 = rand.nextInt(3) + rand.nextInt(1 + par2);
for (int var4 = 0; var4 < var3; ++var4)
{
this.entityDropItem(new ItemStack(Items.dye, 1, 1), 0.0F);
}
if (this.isBurning())
{
//TODO: dropItem()
this.func_145779_a(Items.cooked_chicken, 1);
}
else
{
//TODO: dropItem()
this.func_145779_a(Items.chicken, 1);
}
}
@Override
public boolean isBreedingItem(ItemStack par1ItemStack)
{
return par1ItemStack != null && par1ItemStack.getItem() instanceof ItemSeeds;
}
@Override
public EntityChicken createChild(EntityAgeable entityAgeable)
{
return new EntityRosester(worldObj);
}
}

View File

@ -0,0 +1,155 @@
package biomesoplenty.common.entities;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
public class EntityWasp extends EntityFlyingMob
{
public int courseChangeCooldown;
public double waypointX;
public double waypointY;
public double waypointZ;
private Entity targetedEntity;
/** Cooldown time between target loss and new target aquirement. */
private int aggroCooldown;
public EntityWasp(World world)
{
super(world);
this.setSize(1.0F, 1.0F);
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(2.5D);
}
@Override
protected void updateEntityActionState()
{
if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
{
this.setDead();
}
this.despawnEntity();
double d0 = this.waypointX - this.posX;
double d1 = this.waypointY - this.posY;
double d2 = this.waypointZ - this.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 < 1.0D || d3 > 3600.0D)
{
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 4.0F);
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 4.0F);
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 4.0F);
}
if (this.courseChangeCooldown-- <= 0)
{
this.courseChangeCooldown += this.rand.nextInt(2) + 2;
d3 = (double)MathHelper.sqrt_double(d3);
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
{
this.motionX += d0 / d3 * 0.1D;
this.motionY += d1 / d3 * 0.1D;
this.motionZ += d2 / d3 * 0.1D;
}
else
{
this.waypointX = this.posX;
this.waypointY = this.posY;
this.waypointZ = this.posZ;
}
}
if (this.targetedEntity != null && this.targetedEntity.isDead)
{
this.targetedEntity = null;
}
if (this.targetedEntity == null || this.aggroCooldown-- <= 0)
{
this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D);
if (this.targetedEntity != null)
{
this.aggroCooldown = 20;
}
}
double d4 = 64.0D;
if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4)
{
double d5 = this.targetedEntity.posX - this.posX;
double d6 = this.targetedEntity.boundingBox.minY + (double)(this.targetedEntity.height) - (this.posY);
double d7 = this.targetedEntity.posZ - this.posZ;
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(d5, d7)) * 180.0F / (float)Math.PI;
if (this.canEntityBeSeen(this.targetedEntity))
{
this.waypointX = targetedEntity.posX;
this.waypointY = targetedEntity.posY;
this.waypointZ = targetedEntity.posZ;
float f1 = this.targetedEntity.getDistanceToEntity(this);
this.attackEntity(this.targetedEntity, f1);
}
}
else
{
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI;
}
}
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
{
double d4 = (this.waypointX - this.posX) / par7;
double d5 = (this.waypointY - this.posY) / par7;
double d6 = (this.waypointZ - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
{
return false;
}
}
return true;
}
@Override
protected String getLivingSound()
{
return "biomesoplenty:mob.wasp.say";
}
@Override
protected String getHurtSound()
{
return "biomesoplenty:mob.wasp.hurt";
}
@Override
protected String getDeathSound()
{
return "biomesoplenty:mob.wasp.hurt";
}
}

View File

@ -1,13 +1,19 @@
package biomesoplenty.common.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.common.entities.EntityPixie;
public class ItemJarEmpty extends Item
{
@ -71,7 +77,7 @@ public class ItemJarEmpty extends Item
}
}
/*TODO: FEATURE @Override
@Override
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntityPixie)
@ -84,7 +90,7 @@ public class ItemJarEmpty extends Item
if (par2EntityPlayer.inventory.getFirstEmptyStack() >= 0)
{
EntityItem entityitem = new EntityItem(par2EntityPlayer.worldObj, par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, new ItemStack(Items.jarFilled.get(), 1, 2));
EntityItem entityitem = new EntityItem(par2EntityPlayer.worldObj, par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, new ItemStack(BOPItemHelper.get("jarFilled"), 1, 2));
if (!par2EntityPlayer.worldObj.isRemote)
{
par2EntityPlayer.worldObj.spawnEntityInWorld(entityitem);
@ -97,7 +103,8 @@ public class ItemJarEmpty extends Item
}
else
{
par2EntityPlayer.dropPlayerItem(new ItemStack(Items.jarFilled.get(), 1, 2));
//TODO: player.dropPlayerItem(ItemStack itemStack)?
par2EntityPlayer.dropPlayerItemWithRandomChoice(new ItemStack(BOPItemHelper.get("jarFilled"), 1, 2), false);
}
return true;
@ -106,5 +113,5 @@ public class ItemJarEmpty extends Item
{
return false;
}
}*/
}
}

View File

@ -2,12 +2,25 @@ package biomesoplenty.common.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.Facing;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.common.configuration.BOPConfigurationIDs;
import biomesoplenty.common.entities.EntityPixie;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -68,20 +81,22 @@ public class ItemJarFilled extends Item
}
}
/* TODO: FEATURE @Override
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side, float xoffset, float yoffset, float zoffset)
{
if (itemStack.getItemDamage() == 2)
{
if (entityPlayer.dimension == 0 || entityPlayer.dimension == BOPConfigurationIDs.promisedLandDimID)
{
int i1 = world.getBlockId(x, y, z);
//TODO: getBlock()
Block block = world.func_147439_a(x, y, z);
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
double d0 = 0.0D;
if (side == 1 && Block.blocksList[i1] != null && Block.blocksList[i1].getRenderType() == 11)
//TODO: getRenderType()
if (side == 1 && block != null && block.func_149645_b() == 11)
{
d0 = 0.5D;
}
@ -92,7 +107,7 @@ public class ItemJarFilled extends Item
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
entity.rotationYawHead = entity.rotationYaw;
entity.renderYawOffset = entity.rotationYaw;
entity.onSpawnWithEgg((EntityLivingData)null);
entity.onSpawnWithEgg((IEntityLivingData)null);
world.spawnEntityInWorld(entity);
entity.playLivingSound();
@ -108,12 +123,13 @@ public class ItemJarFilled extends Item
if (itemStack.stackSize <= 0)
{
itemStack = new ItemStack(Items.jarEmpty.get(), 1, 0);
itemStack = new ItemStack(BOPItemHelper.get("jarEmpty"), 1, 0);
}
if (!entityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.jarEmpty.get(), 1, 0)))
if (!entityPlayer.inventory.addItemStackToInventory(new ItemStack(BOPItemHelper.get("jarEmpty"), 1, 0)))
{
entityPlayer.dropPlayerItem(new ItemStack(Items.jarEmpty.get(), 1, 0));
//TODO: player.dropPlayerItem(ItemStack itemStack)?
entityPlayer.dropPlayerItemWithRandomChoice(new ItemStack(BOPItemHelper.get("jarEmpty"), 1, 0), false);
}
}
@ -122,11 +138,12 @@ public class ItemJarFilled extends Item
{
if (!world.isRemote)
{
entityPlayer.addChatMessage("\u00a75Pixies cannot survive in this environment!");
//TODO: addChatMessage
entityPlayer.func_146105_b(new ChatComponentText("\u00a75Pixies cannot survive in this environment!"));
}
}
}
return true;
}*/
}
}