Jump to content

Generate Problem Please Help


laifsjo

Recommended Posts

Hey guys, i'm using forge, and i have a problem when generating a few blocks. The way i want it is that if you put specific items in an altars inventory, then the portal will build. This is all working, but the portal actually "isn't" there. I can see them, but the portal block is not working, and also, if i place a block next to the portal block or the portal frame block, it disappears. i am spawning everything from onRandomDisplayTick() maybe that's the problem? here is the code:

 

The Block Altar:

 

public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
	if(canPortalSpawn && !isPortalThere) {
		timeout++;
		//System.out.println(timeout);
		if(timeout == 1) par1World.setBlockWithNotify(par2 + 2, par3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 2) par1World.setBlockWithNotify(par2 + 1, par3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 3) par1World.setBlockWithNotify(par2, par3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 4) par1World.setBlockWithNotify(par2 - 1, par3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 5) par1World.setBlockWithNotify(par2 - 2, par3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 6) par1World.setBlockWithNotify(par2 - 2, par3 + 1, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 7) par1World.setBlockWithNotify(par2 - 2, par3 + 2, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout ==  par1World.setBlockWithNotify(par2 - 2, par3 + 3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 9) par1World.setBlockWithNotify(par2 - 2, par3 + 4, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 10) par1World.setBlockWithNotify(par2 - 1, par3 + 4, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 11) par1World.setBlockWithNotify(par2, par3 + 4, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 12) par1World.setBlockWithNotify(par2 + 1, par3 + 4, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 13) par1World.setBlockWithNotify(par2 + 2, par3 + 4, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 14) par1World.setBlockWithNotify(par2 + 2, par3 + 4, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 15) par1World.setBlockWithNotify(par2 + 2, par3 + 3, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 16) par1World.setBlockWithNotify(par2 + 2, par3 + 2, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 17) par1World.setBlockWithNotify(par2 + 2, par3 + 1, par4 - 5, MethyrBlocks.MethyrGla.blockID);
		if(timeout == 18) {
			par1World.setBlockWithNotify(par2 + 1, par3 + 1, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2, par3 + 1, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2 - 1, par3 + 1, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2 + 1, par3 + 2, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2, par3 + 2, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2 - 1, par3 + 2, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2 + 1, par3 + 3, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2, par3 + 3, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
			par1World.setBlockWithNotify(par2 - 1, par3 + 3, par4 - 5, MethyrBlocks.MethyrPortal.blockID);
		}
		if(timeout > 19) {
			isPortalThere = true;
		}
	}

}

 

 

The TileEntity:

 

public boolean checkRecipe() {
	boolean bone = false;
	boolean pearl = false;
	boolean emerald = false;
	boolean powder = false;
	for (int i = 0; i < 4; i++) {
		if (inv[i] != null) {
			if (inv[i].getItem().equals(Item.bone)) {
				if (bone) {
					return false;
				} else {
					bone = true;
				}
			}
			if (inv[i].getItem().equals(Item.enderPearl)) {
				if (pearl) {
					return false;
				} else {
					pearl = true;
				}
			}
			if (inv[i].getItem().equals(Item.emerald)) {
				if (emerald) {
					return false;
				} else {
					emerald = true;
				}
			}
			if (inv[i].getItem().equals(Item.blazePowder)) {
				if (powder) {
					return false;
				} else {
					powder = true;
				}
			}
		}
	}

	if (bone && pearl && emerald && powder) {
		MethyrBlockAltar.canPortalSpawn = true;
		return true;
	} else {
		return false;
	}
}

public void updateEntity() {
	checkRecipe();
}

 

 

Please help me out!!!

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.