Jump to content

[1.9] Dragon wont move


American2050

Recommended Posts

Hello, I have a problem with the Ender Dragon that I spawn with my mod, when it spawn, it does nothing, it just stand still waving the wings and you can't attack him or anything.

 

I was told that in 1.9 it could be for something related with the phases of the dragon, but I'm not sure how should I set that phase before spawning the dragon in the world.

 

Any ideas?

 

This is how I spawned it with the code I had for 1.7

 

entityX1 = new EntityDragon(world);
   		entityX1.setPosition(pos.getX(), pos.getY()+2, pos.getZ());
   		world.spawnEntityInWorld(entityX1);

Link to comment
Share on other sites

First off, all that needs to be in a if(!worldObj.isRemote)

 

Second off, we're going to need a lot more code than that to help you. There's so many potential causes for something like that man, just post your source

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Link to comment
Share on other sites

It's called when a block is break, it works on 1.7 and it works ok on servers from what I have seen also.

 

This part of the code, the one that can spawn the dragon, is called when the block that triggers it gets powered.

 

    public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
    {
        if (!world.isRemote)
        {
            if (this.activated && !world.isBlockPowered(pos))
            {
                world.scheduleBlockUpdate(pos, this, 4, 1);
            }
            else if (!this.activated && world.isBlockPowered(pos))
            {
                //world.setBlock(x, y, z, Blocks.lit_redstone_lamp, 0, 2);
            	gotActivated(world, pos);
            }
        }
    }

 

gotActivated is a little bit of code to decide different possibilities:

 

    public void gotActivated(World world, BlockPos pos)
    {
    	//Let's remove the water
    	MAMBuilder.placeBlock(world, pos.add(0,+2,0), Blocks.air.getDefaultState());
    	
    	//Let's remove the pressure plate
    	MAMBuilder.placeBlock(world, pos.add(0,+1,0), Blocks.air.getDefaultState());
    	
    	//Let's remove the block itself
    	MAMBuilder.placeBlock(world, pos, Blocks.air.getDefaultState());

    	
    	final int randOutput = (int) (Math.random() * 17);
    	
    	if(randOutput<=
    	{
    		goodThings(world, pos);
    	}
    	else if (randOutput>=9 && randOutput <=12)
    	{
    		regularThings(world, pos);
    	}
    	else
    	{
    		badThings(world, pos);
    	}
        
    }

 

badThings is the one that has the chance to spawn dragons.

 

public static void badThings(World world, BlockPos pos)
    {
    	
    	MAMBuilder.cleanAreaFromBlockBis(world, pos, 5, 5, 7, 0);
    	
    	final int badTimes = (int) (Math.random() * 6)+3;
    	
        for(int a=0; a <=badTimes; a++)
        {
    	
    	
	Entity entityX1;

	final int j = (int) ((Math.random() * 15)+5);

	final int rand = (int) (Math.random() * 19);

	if (ModInfo.DEBUG_MODE){ System.out.println("<< IrishLuck - SM IS: "+rand+" >>"); }
   	
   	switch(rand)
   	{
   	case 0: //BLAZE
   		for(int i=1; i<=j; i++) { entityX1 = new EntityBlaze(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 1: //CAVE SPIDER
   		for(int i=1; i<=j; i++) { entityX1 = new EntityCaveSpider(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 2: //CREEPER
   		for(int i=1; i<=j; i++) { entityX1 = new EntityCreeper(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 3: //ENDERMAN
   		for(int i=1; i<=j; i++) { entityX1 = new EntityEnderman(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 4: //GHAST
   		for(int i=1; i<=j; i++) { entityX1 = new EntityGhast(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 5: //IRON GOLEM
   		for(int i=1; i<=j; i++) { entityX1 = new EntityIronGolem(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 6: //MAGMA CUBE
   		for(int i=1; i<=j; i++) { entityX1 = new EntityMagmaCube(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 7: //PIG ZOMBIE
   		for(int i=1; i<=j; i++) { entityX1 = new EntityPigZombie(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 8: //SILVERFISH
   		for(int i=1; i<=j; i++) { entityX1 = new EntitySilverfish(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 9: //SKELETON
   		for(int i=1; i<=j; i++) { entityX1 = new EntitySkeleton(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 10: //SLIME
   		for(int i=1; i<=j; i++) { entityX1 = new EntitySlime(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 11: //SNOWMAN
   		for(int i=1; i<=j; i++) { entityX1 = new EntitySnowman(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 12: //SPIDER
   		for(int i=1; i<=j; i++) { entityX1 = new EntitySpider(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 13: //WITCH
   		for(int i=1; i<=j; i++) { entityX1 = new EntityWitch(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 14: //ZOMBIE
   		for(int i=1; i<=j; i++) { entityX1 = new EntityZombie(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 15: //SHULKER
   		for(int i=1; i<=j; i++) { entityX1 = new EntityShulker(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 16: //ENDERMITE
   		for(int i=1; i<=j; i++) { entityX1 = new EntityEndermite(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1);	}
   	break;
   	
   	case 17: //WHITER
   		entityX1 = new EntityWither(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY()+2, pos.getZ());world.spawnEntityInWorld(entityX1);
   	break;
   	
   	case 18: //DRAGON
   		entityX1 = new EntityDragon(world);
   		Stuff.setEntityPos(entityX1, pos.getX(), pos.getY()+2, pos.getZ());
   		world.spawnEntityInWorld(entityX1);
   	break;
   	
   	default: 
   		for(int i=1; i<=j; i++) { entityX1 = new EntityBlaze(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY()+1, pos.getZ());world.spawnEntityInWorld(entityX1);	}

   	}


        }

 

Stuff.setEntityPos just do this

 

	 public static void setEntityPos(Entity entity, double x, double y, double z)
 {
	double doubleX = (Math.random()*2) - 1;
	double doubleZ = (Math.random()*2) - 1;

	entity.setPosition(x+0.5+doubleX, y+0.5, z+0.5+doubleZ);

 }

 

Any other mob works perfectly, either in 1.9 or 1.7, but the Dragon on 1.9 is broken somehow.

Link to comment
Share on other sites

  • 2 weeks later...

I'm trying this and still nothing. Not sure what I'm missing here.

 

	   		EntityDragon entityLocal = new EntityDragon(world);
   		Stuff.setEntityPos(entityLocal, pos.getX(), pos.getY()+2, pos.getZ());
   		entityLocal.getDataManager().set(entityLocal.PHASE, Integer.valueOf(PhaseList.STRAFE_PLAYER.getId()));
   		world.spawnEntityInWorld(entityLocal);

 

If anyone has any clue it would be great.

 

PS: Stuff.setEntityPos just do this

	public static void setEntityPos(Entity entity, double x, double y, double z)
{
	double doubleX = (Math.random()*2) - 1;
	double doubleZ = (Math.random()*2) - 1;

	entity.setPosition(x+0.5+doubleX, y+0.5, z+0.5+doubleZ);

}

Link to comment
Share on other sites

  • 2 weeks later...

Well, here is an update. Thanks to the help I got here http://www.minecraftforge.net/forum/index.php/topic,38425.0.html now I am able to spawn the Dragon with a Phase other than the 10 default and the Dragon will actually move now.

 

Problem is... Once spawned in the World, the dragon will flight towards 0/0 and this I have no idea how to fix, even if I do the entity to .setAttackTarget(player); it doesnt care, it just flights towards 0/0

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.