Started on the bird mob
This commit is contained in:
parent
a95fab3e4f
commit
18c8d9ea6d
|
@ -16,6 +16,7 @@ import biomesoplenty.blocks.renderers.PuddleRender;
|
||||||
import biomesoplenty.blocks.renderers.RenderUtils;
|
import biomesoplenty.blocks.renderers.RenderUtils;
|
||||||
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
|
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
|
||||||
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
||||||
|
import biomesoplenty.entities.EntityBird;
|
||||||
import biomesoplenty.entities.EntityGlob;
|
import biomesoplenty.entities.EntityGlob;
|
||||||
import biomesoplenty.entities.EntityJungleSpider;
|
import biomesoplenty.entities.EntityJungleSpider;
|
||||||
import biomesoplenty.entities.EntityPhantom;
|
import biomesoplenty.entities.EntityPhantom;
|
||||||
|
@ -23,6 +24,7 @@ import biomesoplenty.entities.EntityRosester;
|
||||||
import biomesoplenty.entities.EntityWasp;
|
import biomesoplenty.entities.EntityWasp;
|
||||||
import biomesoplenty.entities.projectiles.EntityDart;
|
import biomesoplenty.entities.projectiles.EntityDart;
|
||||||
import biomesoplenty.entities.projectiles.EntityMudball;
|
import biomesoplenty.entities.projectiles.EntityMudball;
|
||||||
|
import biomesoplenty.entities.render.RenderBird;
|
||||||
import biomesoplenty.entities.render.RenderDart;
|
import biomesoplenty.entities.render.RenderDart;
|
||||||
import biomesoplenty.entities.render.RenderGlob;
|
import biomesoplenty.entities.render.RenderGlob;
|
||||||
import biomesoplenty.entities.render.RenderJungleSpider;
|
import biomesoplenty.entities.render.RenderJungleSpider;
|
||||||
|
@ -76,6 +78,11 @@ public class ClientProxy extends CommonProxy {
|
||||||
{
|
{
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityWasp.class, new RenderWasp());
|
RenderingRegistry.registerEntityRenderingHandler(EntityWasp.class, new RenderWasp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BOPConfigurationIDs.birdID > 0)
|
||||||
|
{
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityBird.class, new RenderBird());
|
||||||
|
}
|
||||||
|
|
||||||
RenderingRegistry.registerBlockHandler(new FoliageRenderer());
|
RenderingRegistry.registerBlockHandler(new FoliageRenderer());
|
||||||
RenderingRegistry.registerBlockHandler(new PlantsRenderer());
|
RenderingRegistry.registerBlockHandler(new PlantsRenderer());
|
||||||
|
|
|
@ -7,6 +7,8 @@ public class Entities {
|
||||||
public static Class JungleSpider = getClass("biomesoplenty.entities.EntityJungleSpider");
|
public static Class JungleSpider = getClass("biomesoplenty.entities.EntityJungleSpider");
|
||||||
public static Class Rosester = getClass("biomesoplenty.entities.EntityRosester");
|
public static Class Rosester = getClass("biomesoplenty.entities.EntityRosester");
|
||||||
public static Class Glob = getClass("biomesoplenty.entities.EntityGlob");
|
public static Class Glob = getClass("biomesoplenty.entities.EntityGlob");
|
||||||
|
public static Class Wasp = getClass("biomesoplenty.entities.EntityWasp");
|
||||||
|
public static Class Bird = getClass("biomesoplenty.entities.EntityBird");
|
||||||
|
|
||||||
public static Class getClass(String inputstring)
|
public static Class getClass(String inputstring)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.entity.EnumCreatureType;
|
||||||
import biomesoplenty.BiomesOPlenty;
|
import biomesoplenty.BiomesOPlenty;
|
||||||
import biomesoplenty.api.Biomes;
|
import biomesoplenty.api.Biomes;
|
||||||
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
||||||
|
import biomesoplenty.entities.EntityBird;
|
||||||
import biomesoplenty.entities.EntityGlob;
|
import biomesoplenty.entities.EntityGlob;
|
||||||
import biomesoplenty.entities.EntityJungleSpider;
|
import biomesoplenty.entities.EntityJungleSpider;
|
||||||
import biomesoplenty.entities.EntityPhantom;
|
import biomesoplenty.entities.EntityPhantom;
|
||||||
|
@ -98,5 +99,17 @@ public class BOPEntities {
|
||||||
|
|
||||||
registerEntityEgg(EntityWasp.class, 16434729, 2500135);
|
registerEntityEgg(EntityWasp.class, 16434729, 2500135);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BOPConfigurationIDs.birdID > 0)
|
||||||
|
{
|
||||||
|
EntityRegistry.registerModEntity(EntityBird.class, "Bird", BOPConfigurationIDs.birdID, BiomesOPlenty.instance, 80, 3, true);
|
||||||
|
|
||||||
|
registerEntityEgg(EntityBird.class, 16434729, 2500135);
|
||||||
|
|
||||||
|
if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent())
|
||||||
|
{
|
||||||
|
EntityRegistry.addSpawn(EntityBird.class, 8, 1, 1, EnumCreatureType.ambient, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,6 +298,7 @@ public class BOPConfigurationIDs
|
||||||
public static int globID;
|
public static int globID;
|
||||||
public static int phantomID;
|
public static int phantomID;
|
||||||
public static int waspID;
|
public static int waspID;
|
||||||
|
public static int birdID;
|
||||||
|
|
||||||
public static void init(File configFile)
|
public static void init(File configFile)
|
||||||
{
|
{
|
||||||
|
@ -478,6 +479,7 @@ public class BOPConfigurationIDs
|
||||||
globID = config.get("Mob IDs", "Glob ID", 106, null).getInt();
|
globID = config.get("Mob IDs", "Glob ID", 106, null).getInt();
|
||||||
phantomID = config.get("Mob IDs", "Phantom ID", 107, null).getInt();
|
phantomID = config.get("Mob IDs", "Phantom ID", 107, null).getInt();
|
||||||
waspID = config.get("Mob IDs", "Wasp ID", 108, null).getInt();
|
waspID = config.get("Mob IDs", "Wasp ID", 108, null).getInt();
|
||||||
|
birdID = config.get("Mob IDs", "Bird ID", 109, null).getInt();
|
||||||
|
|
||||||
//Projectile IDs
|
//Projectile IDs
|
||||||
entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();;
|
entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();;
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
package biomesoplenty.entities;
|
||||||
|
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class EntityBird extends EntityFlyingMob
|
||||||
|
{
|
||||||
|
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() * 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
|
@ -93,6 +93,7 @@ public class ModelBird extends ModelBase
|
||||||
setRotation(LegRight, 0F, 0F, 0F);
|
setRotation(LegRight, 0F, 0F, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
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);
|
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||||
|
@ -117,6 +118,7 @@ public class ModelBird extends ModelBase
|
||||||
model.rotateAngleZ = z;
|
model.rotateAngleZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
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);
|
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package biomesoplenty.entities.render;
|
||||||
|
|
||||||
|
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.entities.models.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");
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue