Finished adding Pixies

This commit is contained in:
Matt Caughey 2013-11-16 07:50:29 -05:00
parent a289ac8249
commit 3598585ade
13 changed files with 207 additions and 44 deletions

View File

@ -19,6 +19,7 @@ import biomesoplenty.entities.EntityBird;
import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider;
import biomesoplenty.entities.EntityPhantom;
import biomesoplenty.entities.EntityPixie;
import biomesoplenty.entities.EntityRosester;
import biomesoplenty.entities.EntityWasp;
import biomesoplenty.entities.projectiles.EntityDart;
@ -28,6 +29,7 @@ import biomesoplenty.entities.render.RenderDart;
import biomesoplenty.entities.render.RenderGlob;
import biomesoplenty.entities.render.RenderJungleSpider;
import biomesoplenty.entities.render.RenderPhantom;
import biomesoplenty.entities.render.RenderPixie;
import biomesoplenty.entities.render.RenderRosester;
import biomesoplenty.entities.render.RenderWasp;
import biomesoplenty.particles.EntityDandelionFX;
@ -81,6 +83,11 @@ public class ClientProxy extends CommonProxy {
{
RenderingRegistry.registerEntityRenderingHandler(EntityBird.class, new RenderBird());
}
if (BOPConfigurationIDs.pixieID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.class, new RenderPixie());
}
RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer());

View File

@ -9,6 +9,7 @@ public class Entities {
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 Pixie = getClass("biomesoplenty.entities.EntityPixie");
public static Class getClass(String inputstring)
{

View File

@ -11,6 +11,7 @@ import biomesoplenty.entities.EntityBird;
import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider;
import biomesoplenty.entities.EntityPhantom;
import biomesoplenty.entities.EntityPixie;
import biomesoplenty.entities.EntityRosester;
import biomesoplenty.entities.EntityWasp;
import biomesoplenty.entities.projectiles.EntityDart;
@ -111,5 +112,17 @@ public class BOPEntities {
EntityRegistry.addSpawn(EntityBird.class, 10, 3, 5, EnumCreatureType.creature, 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, 16560347, 16645116);
if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent() && Biomes.promisedLandShrub.isPresent())
{
EntityRegistry.addSpawn(EntityPixie.class, 5, 1, 3, EnumCreatureType.monster, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
}
}
}
}

View File

@ -305,6 +305,7 @@ public class BOPConfigurationIDs
public static int phantomID;
public static int waspID;
public static int birdID;
public static int pixieID;
public static void init(File configFile)
{
@ -504,6 +505,7 @@ public class BOPConfigurationIDs
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();
pixieID = config.get("Mob IDs", "Pixie ID", 110, null).getInt();
//Projectile IDs
entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();;

View File

@ -0,0 +1,109 @@
package biomesoplenty.entities;
import biomesoplenty.api.Items;
import net.minecraft.block.material.Material;
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 EntityPixie extends EntityFlyingMob
{
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(Items.miscItems.get(), 1, 11), 0.0F);
}
}
@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

@ -12,53 +12,54 @@ public class ModelPixie extends ModelBase
ModelRenderer LeftWing;
ModelRenderer RightWing;
public ModelPixie()
{
textureWidth = 64;
textureHeight = 32;
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);
}
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.mirror = true;
LeftWing = new ModelRenderer(this, 32, 0);
LeftWing.addBox(0F, 0F, 0F, 0, 4, 7);
LeftWing.setRotationPoint(2F, 15F, -1F);
LeftWing.setTextureSize(64, 32);
LeftWing.mirror = true;
setRotation(LeftWing, 0.5061455F, 0.5061455F, 0.3316126F);
LeftWing.mirror = false;
RightWing = new ModelRenderer(this, 50, 0);
RightWing.addBox(0F, 0F, 0F, 0, 4, 7);
RightWing.setRotationPoint(-2F, 15F, -1F);
RightWing.setTextureSize(64, 32);
RightWing.mirror = true;
setRotation(RightWing, 0.5061455F, -0.5061455F, -0.3316126F);
}
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;
}
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);
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,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.ModelPixie;
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.shadowSize = 0.0F;
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return new ResourceLocation("biomesoplenty:textures/mobs/pixie.png");
}
}

View File

@ -13,7 +13,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class SoundHandler
{
static String[] recordSoundFiles = { "biomesoplenty:bopdisc.ogg", "biomesoplenty:bopdiscmud.ogg" };
static String[] soundFiles = { "biomesoplenty:mob/phantom/say.ogg", "biomesoplenty:mob/phantom/hurt.ogg", "biomesoplenty:mob/phantom/death.ogg", "biomesoplenty:mob/wasp/say.ogg", "biomesoplenty:mob/wasp/hurt.ogg", "biomesoplenty:mob/bird/say.ogg", "biomesoplenty:mob/bird/hurt.ogg" };
static String[] soundFiles = { "biomesoplenty:mob/phantom/say.ogg", "biomesoplenty:mob/phantom/hurt.ogg", "biomesoplenty:mob/phantom/death.ogg", "biomesoplenty:mob/wasp/say.ogg", "biomesoplenty:mob/wasp/hurt.ogg", "biomesoplenty:mob/bird/say.ogg", "biomesoplenty:mob/bird/hurt.ogg", "biomesoplenty:mob/pixie/say.ogg", "biomesoplenty:mob/pixie/hurt.ogg" };
@SideOnly(Side.CLIENT)
@ForgeSubscribe

View File

@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemBOP extends Item
{
private static String[] items = {"mudbrick", "ash", "emptyhoneycomb", "fleshchunk", "crystalshard", "bluedye", "browndye", "greendye", "whitedye", "blackdye", "ghastlysoul"};
private static String[] items = {"mudbrick", "ash", "emptyhoneycomb", "fleshchunk", "crystalshard", "bluedye", "browndye", "greendye", "whitedye", "blackdye", "ghastlysoul", "pixiedust"};
@SideOnly(Side.CLIENT)
private Icon[] textures;

View File

@ -320,6 +320,7 @@ item.bop.miscItems.greendye.name=Green Dye
item.bop.miscItems.whitedye.name=White Dye
item.bop.miscItems.blackdye.name=Black Dye
item.bop.miscItems.ghastlysoul.name=Ghastly Soul
item.bop.miscItems.pixiedust.name=Pixie Dust
item.bop.jarEmpty.name=Empty Jar
item.bop.jarFilled.jarhoney.name=Honey Jar
@ -406,6 +407,7 @@ entity.BiomesOPlenty.Phantom.name=Phantom
entity.BiomesOPlenty.Rosester.name=Rosester
entity.BiomesOPlenty.Wasp.name=Wasp
entity.BiomesOPlenty.Bird.name=Bird
entity.BiomesOPlenty.Pixie.name=Pixie
achievement.bop.achFlower=Flower Child
achievement.bop.achFlower.desc=Become one with nature!

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B