Basic bee modelling done, now onto the AI

This commit is contained in:
Adubbz 2013-10-27 17:20:58 +11:00
parent 37d7ec898e
commit 5df963c5b2
6 changed files with 210 additions and 114 deletions

View file

@ -20,6 +20,7 @@ import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider; import biomesoplenty.entities.EntityJungleSpider;
import biomesoplenty.entities.EntityPhantom; import biomesoplenty.entities.EntityPhantom;
import biomesoplenty.entities.EntityRosester; import biomesoplenty.entities.EntityRosester;
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.RenderDart; import biomesoplenty.entities.render.RenderDart;
@ -27,6 +28,7 @@ import biomesoplenty.entities.render.RenderGlob;
import biomesoplenty.entities.render.RenderJungleSpider; import biomesoplenty.entities.render.RenderJungleSpider;
import biomesoplenty.entities.render.RenderPhantom; import biomesoplenty.entities.render.RenderPhantom;
import biomesoplenty.entities.render.RenderRosester; import biomesoplenty.entities.render.RenderRosester;
import biomesoplenty.entities.render.RenderWasp;
import biomesoplenty.particles.EntityDandelionFX; import biomesoplenty.particles.EntityDandelionFX;
import biomesoplenty.particles.EntitySteamFX; import biomesoplenty.particles.EntitySteamFX;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
@ -70,6 +72,11 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityPhantom.class, new RenderPhantom()); RenderingRegistry.registerEntityRenderingHandler(EntityPhantom.class, new RenderPhantom());
} }
if (BOPConfigurationIDs.waspID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityWasp.class, new RenderWasp());
}
RenderingRegistry.registerBlockHandler(new FoliageRenderer()); RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer()); RenderingRegistry.registerBlockHandler(new PlantsRenderer());
RenderingRegistry.registerBlockHandler(new SmallBlockRenderer()); RenderingRegistry.registerBlockHandler(new SmallBlockRenderer());

View file

@ -11,11 +11,11 @@ import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider; import biomesoplenty.entities.EntityJungleSpider;
import biomesoplenty.entities.EntityPhantom; import biomesoplenty.entities.EntityPhantom;
import biomesoplenty.entities.EntityRosester; import biomesoplenty.entities.EntityRosester;
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.projectiles.EntityPoisonDart; import biomesoplenty.entities.projectiles.EntityPoisonDart;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class BOPEntities { public class BOPEntities {
@ -91,5 +91,12 @@ public class BOPEntities {
EntityRegistry.addSpawn(EntityPhantom.class, 8, 1, 1, EnumCreatureType.monster, Biomes.netherBone.get(), Biomes.netherDesert.get()); 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, 4472140, 2499368);
}
} }
} }

View file

@ -293,6 +293,7 @@ public class BOPConfigurationIDs
public static int rosesterID; public static int rosesterID;
public static int globID; public static int globID;
public static int phantomID; public static int phantomID;
public static int waspID;
public static void init(File configFile) public static void init(File configFile)
{ {
@ -468,6 +469,7 @@ public class BOPConfigurationIDs
rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt(); rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt();
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();
//Projectile IDs //Projectile IDs
entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();; entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();;

View file

@ -0,0 +1,30 @@
package biomesoplenty.entities;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.EntityAmbientCreature;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class EntityWasp extends EntityLiving
{
public EntityWasp(World world)
{
super(world);
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
}
public boolean isAIEnabled()
{
return true;
}
@Override
public boolean allowLeashing()
{
return false;
}
}

View file

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

View file

@ -0,0 +1,24 @@
package biomesoplenty.entities.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import biomesoplenty.entities.models.ModelWasp;
public class RenderWasp extends RenderLiving
{
public RenderWasp()
{
super(new ModelWasp(), 0.25F);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/wasp.png");
}
}