Jump to content

Recommended Posts

Posted

OK so I am working on my first mod and within it I have added a way of respawning the ender dragon and the wither in a new way.

The process is within a block looking for the correct arrangement of blocks around it.

The problem I am having is when activated the wither.dragon will spawn but it seems to sync from them as their damage bars appear ad they can be heard but they are invisible for about 30 seconds (roughly).

Another problem I have with the wither is it only seems to spawn in the end even though the code to execute its spawn isn't under if the dimension is in the end (as the dragon is)

 

package blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.init.Blocks;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import java.util.Random;


public class dragonSummon extends Block {

   public dragonSummon(Material material)
   {
      super(material);
      setBlockName("the summoner");
      setCreativeTab(CreativeTabs.tabRedstone);
      setHardness(1.0f);

   }







   @Override
   public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
   {
      //items checked for in spawning dragon
      Block dragonSpawnOne=Blocks.diamond_block;
      Block dragonSpawnTwo=Blocks.obsidian;
      Block dragonSpawnThree=Blocks.beacon;

      //items checked for when spawning the wither (possibly change)
      Block witherSpawn=Blocks.soul_sand;

      if(!world.isRemote)
      {
         if(world.isBlockIndirectlyGettingPowered(x,y,z))
      {

            if(world.provider.dimensionId==1)
            {
               Minecraft.getMinecraft().thePlayer.sendChatMessage("block destroyed in the end");
               if(world.getBlock(x,y+1,z)==dragonSpawnThree)
               {
                  Minecraft.getMinecraft().thePlayer.sendChatMessage("the block was destroyed successfuly");
                  if(world.getBlock(x,y,z+1)==dragonSpawnOne && world.getBlock(x,y,z-1)==dragonSpawnOne)
                  {
                     Minecraft.getMinecraft().thePlayer.sendChatMessage("diamond blocks in the right place");
                     if(world.getBlock(x+1,y,z)==dragonSpawnTwo && world.getBlock(x-1,y,z)==dragonSpawnTwo)
                     {
                        Minecraft.getMinecraft().thePlayer.sendChatMessage("you summoned the ender dragon rawr");
                        EntityDragon dragon=new EntityDragon(world);
                        world.spawnEntityInWorld(dragon);
                        dragon.setPosition((double)x,(double)y+30,(double)z);
                        world.func_147480_a(x,y,z,true);
                        world.func_147480_a(x+1,y,z,true);
                        world.func_147480_a(x-1,y,z,true);
                        world.func_147480_a(x,y,z+1,true);
                        world.func_147480_a(x,y,z-1,true);
                        world.func_147480_a(x,y+1,z,true);
                        world.createExplosion(null,x,y,z,2.0f,true);

                     }
                  }
                  else if(world.getBlock(x,y,z+1)==dragonSpawnTwo && world.getBlock(x,y,z-1)==dragonSpawnTwo)
                  {
                     Minecraft.getMinecraft().thePlayer.sendChatMessage("obsidian blocks in the right place");
                     if(world.getBlock(x+1,y,z)==dragonSpawnOne && world.getBlock(x-1,y,z)==dragonSpawnOne)
                     {
                        Minecraft.getMinecraft().thePlayer.sendChatMessage("you summoned the ender dragon rawr");
                        EntityDragon dragon=new EntityDragon(world);
                        world.spawnEntityInWorld(dragon);
                        dragon.setPosition((double)x,(double)y+30,(double)z);
                        world.func_147480_a(x,y,z,true);
                        world.func_147480_a(x+1,y,z,true);
                        world.func_147480_a(x-1,y,z,true);
                        world.func_147480_a(x,y,z+1,true);
                        world.func_147480_a(x,y,z-1,true);
                        world.func_147480_a(x,y+1,z,true);
                        world.createExplosion(null,x,y,z,2.0f,true);




                     }
                  }

               }
            }

         if(world.getBlock(x,(y-1),z)==witherSpawn && world.getBlock(x,(y-2),z)==witherSpawn && world.getBlock((x-1),(y-1),z)==witherSpawn && world.getBlock((x+1),(y-1),z)==witherSpawn)
         {
            EntityWither wither=new EntityWither(world);
            world.spawnEntityInWorld(wither);
            wither.setPosition((double)x,(double)y+1,(double)z);
            world.func_147480_a(x,y-1,z,true);
            world.func_147480_a(x,y,z,true);
            world.func_147480_a(x,y-2,z,true);
            world.func_147480_a(x-1,y-1,z,true);
            world.func_147480_a(x+1,y-1,z,true);
            world.createExplosion(null,x,y,z,2.0f,true);

            Minecraft.getMinecraft().thePlayer.sendChatMessage("you spawned the wither get ready to fight");
         }
         else if(world.getBlock(x,(y-1),z)==witherSpawn && world.getBlock(x,(y-2),z)==witherSpawn && world.getBlock(x,(y-1),(z-1))==witherSpawn && world.getBlock(x,(y-1),(z+1))==witherSpawn)
         {
            EntityWither wither=new EntityWither(world);
            world.spawnEntityInWorld(wither);
            wither.setPosition((double)x,(double)y+10,(double)z);
            world.func_147480_a(x,y-1,z,true);
            world.func_147480_a(x,y,z,true);
            world.func_147480_a(x,y-2,z,true);
            world.func_147480_a(x,y-1,z-1,true);
            world.func_147480_a(x,y-1,z+1,true);
            world.createExplosion(null,x,y,z,2.0f,true);
            Minecraft.getMinecraft().thePlayer.sendChatMessage("you spawned the wither get ready to fight");

         }
         }
      }
   }


}

 

 

 

 

 

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.