From 18c8d9ea6d0926d2bc234d9ed38de7111dd3b69e Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Thu, 7 Nov 2013 22:16:32 -0500 Subject: [PATCH] Started on the bird mob --- common/biomesoplenty/ClientProxy.java | 7 ++ common/biomesoplenty/api/Entities.java | 2 + .../configuration/BOPEntities.java | 13 +++ .../configfile/BOPConfigurationIDs.java | 2 + common/biomesoplenty/entities/EntityBird.java | 94 ++++++++++++++++++ .../entities/models/ModelBird.java | 2 + .../entities/render/RenderBird.java | 28 ++++++ .../biomesoplenty/textures/mobs/bird.png | Bin 2304 -> 1993 bytes 8 files changed, 148 insertions(+) create mode 100644 common/biomesoplenty/entities/EntityBird.java create mode 100644 common/biomesoplenty/entities/render/RenderBird.java diff --git a/common/biomesoplenty/ClientProxy.java b/common/biomesoplenty/ClientProxy.java index 7f80e7c87..fdd5a5bdf 100644 --- a/common/biomesoplenty/ClientProxy.java +++ b/common/biomesoplenty/ClientProxy.java @@ -16,6 +16,7 @@ import biomesoplenty.blocks.renderers.PuddleRender; import biomesoplenty.blocks.renderers.RenderUtils; import biomesoplenty.blocks.renderers.SmallBlockRenderer; import biomesoplenty.configuration.configfile.BOPConfigurationIDs; +import biomesoplenty.entities.EntityBird; import biomesoplenty.entities.EntityGlob; import biomesoplenty.entities.EntityJungleSpider; import biomesoplenty.entities.EntityPhantom; @@ -23,6 +24,7 @@ import biomesoplenty.entities.EntityRosester; import biomesoplenty.entities.EntityWasp; import biomesoplenty.entities.projectiles.EntityDart; import biomesoplenty.entities.projectiles.EntityMudball; +import biomesoplenty.entities.render.RenderBird; import biomesoplenty.entities.render.RenderDart; import biomesoplenty.entities.render.RenderGlob; import biomesoplenty.entities.render.RenderJungleSpider; @@ -76,6 +78,11 @@ public class ClientProxy extends CommonProxy { { RenderingRegistry.registerEntityRenderingHandler(EntityWasp.class, new RenderWasp()); } + + if (BOPConfigurationIDs.birdID > 0) + { + RenderingRegistry.registerEntityRenderingHandler(EntityBird.class, new RenderBird()); + } RenderingRegistry.registerBlockHandler(new FoliageRenderer()); RenderingRegistry.registerBlockHandler(new PlantsRenderer()); diff --git a/common/biomesoplenty/api/Entities.java b/common/biomesoplenty/api/Entities.java index dd4eb4910..3ae8ed632 100644 --- a/common/biomesoplenty/api/Entities.java +++ b/common/biomesoplenty/api/Entities.java @@ -7,6 +7,8 @@ public class Entities { public static Class JungleSpider = getClass("biomesoplenty.entities.EntityJungleSpider"); public static Class Rosester = getClass("biomesoplenty.entities.EntityRosester"); 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) { diff --git a/common/biomesoplenty/configuration/BOPEntities.java b/common/biomesoplenty/configuration/BOPEntities.java index e791090f7..05f2fa8f7 100644 --- a/common/biomesoplenty/configuration/BOPEntities.java +++ b/common/biomesoplenty/configuration/BOPEntities.java @@ -7,6 +7,7 @@ import net.minecraft.entity.EnumCreatureType; import biomesoplenty.BiomesOPlenty; import biomesoplenty.api.Biomes; import biomesoplenty.configuration.configfile.BOPConfigurationIDs; +import biomesoplenty.entities.EntityBird; import biomesoplenty.entities.EntityGlob; import biomesoplenty.entities.EntityJungleSpider; import biomesoplenty.entities.EntityPhantom; @@ -98,5 +99,17 @@ public class BOPEntities { 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()); + } + } } } diff --git a/common/biomesoplenty/configuration/configfile/BOPConfigurationIDs.java b/common/biomesoplenty/configuration/configfile/BOPConfigurationIDs.java index 6c34c2e7a..4b2a3e9ca 100644 --- a/common/biomesoplenty/configuration/configfile/BOPConfigurationIDs.java +++ b/common/biomesoplenty/configuration/configfile/BOPConfigurationIDs.java @@ -298,6 +298,7 @@ public class BOPConfigurationIDs public static int globID; public static int phantomID; public static int waspID; + public static int birdID; public static void init(File configFile) { @@ -478,6 +479,7 @@ public class BOPConfigurationIDs globID = config.get("Mob IDs", "Glob ID", 106, null).getInt(); phantomID = config.get("Mob IDs", "Phantom ID", 107, null).getInt(); waspID = config.get("Mob IDs", "Wasp ID", 108, null).getInt(); + birdID = config.get("Mob IDs", "Bird ID", 109, null).getInt(); //Projectile IDs entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();; diff --git a/common/biomesoplenty/entities/EntityBird.java b/common/biomesoplenty/entities/EntityBird.java new file mode 100644 index 000000000..0ce0a03ac --- /dev/null +++ b/common/biomesoplenty/entities/EntityBird.java @@ -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"; + } +} diff --git a/common/biomesoplenty/entities/models/ModelBird.java b/common/biomesoplenty/entities/models/ModelBird.java index dbc3fffea..b48b0ba6a 100644 --- a/common/biomesoplenty/entities/models/ModelBird.java +++ b/common/biomesoplenty/entities/models/ModelBird.java @@ -93,6 +93,7 @@ public class ModelBird extends ModelBase 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); @@ -117,6 +118,7 @@ public class ModelBird extends ModelBase 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); diff --git a/common/biomesoplenty/entities/render/RenderBird.java b/common/biomesoplenty/entities/render/RenderBird.java new file mode 100644 index 000000000..a2040157c --- /dev/null +++ b/common/biomesoplenty/entities/render/RenderBird.java @@ -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"); + } +} diff --git a/resources/assets/biomesoplenty/textures/mobs/bird.png b/resources/assets/biomesoplenty/textures/mobs/bird.png index 3cd2bbe4bd6f8443d39bdde89f88ebc126f8f149..1f5b802457cf55060559482c783b72d7026c6b69 100644 GIT binary patch delta 1918 zcmV-^2Z8v263GvcJPN=701m(bYSxJfkwz$g2SrIlK~!i%)mdqCQ&kw|A1NZ0($Y4` zy=j{5HcJbojE*y?BLgi^DBTxG7Yewti0dbvaR6CHoN@Pq<2OeUTiUE`ma^l5mLyH` z_?+u4VqnZxT6|{C+~B|i+-rlV!*1Es|qtf!->1|E1o`$?7nte8f+s8SbIXK zAG`*)Cj+^I_ahnDdauGY3P`P&VAwT(iN^gv<8Z3zhwAJS3SeW>dVQ_;(4pvTR<5tP61J?x!+=vyY?rXd=JiYLKhuz^mo?g^r{CkQvAFT1Zz zD-CkHALhXnl;Je&Lm4>eZDn772IX5Ou>MuRJ{%_}%)>S?564J)Ne$4UJWuOH5+ zCslS|n^qc>(KL*^reNG2KwZ}~HoQVB_sziE7l)x^nqxur!Hol#QQIC`bOYGAuBj)C z+Agn3zV`kEES?nX`%|#;M9L-CmMI<%hP7e0Up?w%DlD~3sC(Y#n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