• 0

    posted a message on EntityFlying with AI
    It's not an entity. You know entity flying which is what the ghast extends. I'm trying to make that but this one let's you have the AI turned on because if a flying entity that extends entity flying has his AI turned on it won't fly properly and will stand still.
    Posted in: Modification Development
  • 0

    posted a message on EntityFlying with AI
    hi i'm trying to make my own entity AI class but instead of the normal entityflying you can have the entity AI turned on.

    when ever I do the flying mob just stands still and doesn't fly but will use the AI.

    I've been trying to add a entityflying class with entitymob code in it aswell like this:


    import net.minecraft.enchantment.EnchantmentHelper;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityCreature;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.monster.IMob;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.EnumDifficulty;
    import net.minecraft.world.EnumSkyBlock;
    import net.minecraft.world.World;

    public abstract class EntityFlyingWithAI extends EntityCreature
    {
    private static final String __OBFID = "CL_00001692";

    public EntityFlyingWithAI(World p_i1738_1_)
    {
    super(p_i1738_1_);

    }

    /**
    * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
    * use this to react to sunlight and start to burn.
    */

    /**
    * Called to update the entity's position/logic.
    */

    protected String getSwimSound()
    {
    return "game.hostile.swim";
    }

    protected String getSplashSound()
    {
    return "game.hostile.swim.splash";
    }

    /**
    * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking
    * (Animals, Spiders at day, peaceful PigZombies).
    */

    /**
    * Called when the entity is attacked.
    */

    /**
    * Returns the sound this mob makes when it is hurt.
    */
    protected String getHurtSound()
    {
    return "game.hostile.hurt";
    }

    /**
    * Returns the sound this mob makes on death.
    */
    protected String getDeathSound()
    {
    return "game.hostile.die";
    }

    protected String func_146067_o(int p_146067_1_)
    {
    return p_146067_1_ > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small";
    }



    /**
    * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
    */

    /**
    * 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);
    }
    }
    protected void fall(float p_70069_1_) {}

    /**
    * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance
    * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround
    */
    protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {}

    /**
    * Moves the entity based on the specified heading. Args: strafe, forward
    */
    public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
    {
    if (this.isInWater())
    {
    this.moveFlying(p_70612_1_, p_70612_2_, 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(p_70612_1_, p_70612_2_, 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 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F;
    }

    float f3 = 0.16277136F / (f2 * f2 * f2);
    this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F);
    f2 = 0.91F;

    if (this.onGround)
    {
    f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 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 d1 = this.posX - this.prevPosX;
    double d0 = this.posZ - this.prevPosZ;
    float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;

    if (f4 > 1.0F)
    {
    f4 = 1.0F;
    }

    this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
    this.limbSwing += this.limbSwingAmount;
    }
    protected void attackEntity(Entity p_70785_1_, float p_70785_2_) {}

    /**
    * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block.
    * Args: x, y, z
    */
    public float getBlockPathWeight(int p_70783_1_, int p_70783_2_, int p_70783_3_)
    {
    return 0.0F;
    }
    /**
    * Checks if the entity's current position is a valid location to spawn this entity.
    */
    /*public boolean getCanSpawnHere()
    {
    return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.isValidLightLevel() && super.getCanSpawnHere();
    }*/

    protected void applyEntityAttributes()
    {
    super.applyEntityAttributes();
    this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
    }

    protected boolean func_146066_aG()
    {
    return true;
    }
    }

    and I've been trying to play with the extensions but because entityflying only has the flying code it doesn't work.
    Posted in: Modification Development
  • 0

    posted a message on Questions about making mods
    to make a custom mob spawn in your dimension. go into the dimension's biome class and put this in:

     
    
    this.spawnableMonsterList.clear();
     this.spawnableCreatureList.clear();
     this.spawnableWaterCreatureList.clear();
    
     this.spawnableCreatureList.add(new SpawnListEntry(EntityName.class, 5, 2, 6));  //5,2,6 change how the much the mob spawns. changing these numbers may crash so look in other biome classes for mobs to see what numbers they use 




    this goes under the topfiller and bottomfiller blocks code.
    Posted in: Modification Development
  • 0

    posted a message on is there anyone who can 'Compile' my .JAVA files?
    why can't you compile your own java code?



    all you have to do is go into the forge src folder, press shift and right click then click on open command window here. then type in "gradlew build"
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    Thankyou very much for helping me :D. Also I'm going to learn java so I don't keep making these mistakes. sorry if I was annoying.
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    I have no idea if i've fixed it but I think i've set it so it connects to one of my entities because it doesn't crash anymore.










    import java.util.Random;
    import net.minecraft.entity.*;
    import fisherman77.paleocraft.common.mobs.EntityDimorphodon;
    import fisherman77.paleocraft.common.mobs.EntityDimorphodonL;
    import fisherman77.paleocraft.common.mobs.EntityMasso;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityCreature;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.ai.EntityAIBase;
    import net.minecraft.entity.ai.RandomPositionGenerator;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.World;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.monster.EntityMob;

    public class PaleocraftFlyingLandAI extends EntityAIBase
    {
    private EntityDimorphodonL entitydimorphodonl;

    //private EntityCreature entity;
    double posX;
    double posY;
    double posZ;
    private World world;
    // private World entitymasso;

    //private EntityMasso entitymasso
    float renderYawOffset;
    private float rotationYaw;
    float rotationPitch;
    //private World worldObj;
    private int value;
    private static final String __OBFID = "CL_00001608";
    private boolean entityland = false;
    private EntityLiving entity;
    public PaleocraftFlyingLandAI(EntityMasso entityMasso)
    {

    int number = (int) ((Math.random()*21));
    this.setMutexBits(1);
    Random value = new Random();
    world = entityMasso.worldObj;
    this.entity = entityMasso;
    // this.entity = entitydimorphodonl;

    }

    /**
    * Returns whether the EntityAIBase should begin execution.
    */
    public boolean shouldExecute()
    {


    int number = (int) ((Math.random()*0));
    //if (worldobj != null)
    if (number == 0)
    //if(worldobj != null)
    //if (world == null)

    {
    entity.setDead();
    EntityDimorphodonL entitydimorphodonl = new EntityDimorphodonL(world);
    // EntityDimorphodonL entitydimorphodonl = (EntityDimorphodonL)

    //float rotationPitch;
    entitydimorphodonl.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
    // entitydimorphodonl.setHealth(this.getHealth());
    // float renderYawOffset;
    entitydimorphodonl.renderYawOffset = renderYawOffset;
    world.spawnEntityInWorld(entitydimorphodonl);
    }
    return entityland = true;
    }







    private float getHealth() {
    // TODO Auto-generated method stub
    return 0;
    }

    /**
    * Returns whether an in-progress EntityAIBase should continue executing
    */
    public boolean continueExecuting()
    {
    int number = (int) ((Math.random()*21));

    if (number < 1)
    {
    }
    return entityland = false;
    }
    }

    /**
    * Execute a one shot task or start executing a continuous task
    */

    Now it kills the entity that has the AI but it doesn't spawn anything.
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    oh sorry:

    worldObj.spawnEntityInWorld(entitydimorphodonl);



    yea it seems to be a problem with worldObj
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    it's complaining about ticking entity:

    java.lang.NullPointerException: Ticking entity
    at fisherman77.paleocraft.common.mobs.ai.PaleocraftFlyingLandAI.shouldExecute(PaleocraftFlyingLandAI.java:76)
    at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:84)
    at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:613)
    at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:1983)
    at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:431)
    at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39)
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)
    at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:250)
    at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684)
    at net.minecraft.world.World.updateEntity(World.java:2258)
    at net.minecraft.world.World.updateEntities(World.java:2108)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    thanks that fixed the entity.setDead() but I'm still getting crashes on the spawning code:



    EntityDimorphodonL entitydimorphodonl = new EntityDimorphodonL(worldObj);

    //float rotationPitch;
    entitydimorphodonl.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
    entitydimorphodonl.setHealth(this.getHealth());
    // float renderYawOffset;
    entitydimorphodonl.renderYawOffset = renderYawOffset;
    worldObj.spawnEntityInWorld(entitydimorphodonl);
    Posted in: Modification Development
  • 0

    posted a message on Mod Texture acting up
    something you might have done wrong in mcreator. Just try remaking the ore in Mcreator because I think mcreater stores textures differently so I'm not sure if I could even give texture codes.
    Posted in: Modification Development
  • 0

    posted a message on Techne Problem
    you might have parts of other textures overlapping or you might have accidently textured the wrong spot. I recommend moving the texture offset for the parts so its not all together.
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    anyone?
    Posted in: Modification Development
  • 0

    posted a message on Can someone give me premade 1.6.4 files
    for 1.6.4 I think you need forge and mcp. there's quite a few tutorials on youtube and on the forums.
    Posted in: Modification Development
  • 0

    posted a message on addchild code animation problem
    don't put the addChild code to render. Put it in Public "model name". (its the place that has the texture width and texture height)
    Posted in: Modification Development
  • 0

    posted a message on Entity AI help
    Hi I was wondering if someone could check out my entity ai? I'm still learning java so it may seem bad.




    package fisherman77.paleocraft.common.mobs.ai;


    import java.util.Random;

    import fisherman77.paleocraft.common.mobs.EntityDimorphodonL;
    import net.minecraft.entity.EntityCreature;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.ai.EntityAIBase;
    import net.minecraft.entity.ai.RandomPositionGenerator;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.World;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.monster.EntityMob;

    public class PaleocraftFlyingLandAI extends EntityAIBase
    {
    private EntityCreature entity;
    private double xPosition;
    private double yPosition;
    private double zPosition;
    private double speed;
    private float rotationYaw;
    private World worldObj;
    private int value;
    private static final String __OBFID = "CL_00001608";
    private boolean entityland = false;
    public PaleocraftFlyingLandAI(EntityLiving host)
    {
    this.entity = entity;
    int number = (int) ((Math.random()*21));
    this.setMutexBits(1);
    Random value = new Random();

    }

    /**
    * Returns whether the EntityAIBase should begin execution.
    */
    public boolean shouldExecute()
    {
    int number = (int) ((Math.random()*21));

    if (number ==0)
    {
    entity.setDead();

    EntityDimorphodonL entitydimorphodonl = new EntityDimorphodonL(worldObj);
    entitydimorphodonl.setLocationAndAngles(xPosition, yPosition, zPosition, rotationYaw, rotationYaw);
    entitydimorphodonl.setHealth(entity.getHealth());
    entitydimorphodonl.renderYawOffset = rotationYaw;
    worldObj.spawnEntityInWorld(entitydimorphodonl);
    }
    return entityland = true;
    }





    /**
    * Returns whether an in-progress EntityAIBase should continue executing
    */
    public boolean continueExecuting()
    {
    int number = (int) ((Math.random()*21));

    if (number < 1)
    {
    }
    return entityland = false;
    }
    }

    /**
    * Execute a one shot task or start executing a continuous task
    */



    What I was trying to do was make the code randomly generate numbers. When it generated a 0 it would activate the spawning code. When I run the code I get an error from set entity dead but there's probably more stuff wrong with it. I'm not sure if the entity spawning code even works so I was wondering if someone could check that aswell.
    Posted in: Modification Development
  • To post a comment, please or register a new account.