Jump to content

Control blocks that can be place in a custom dimension


ColdFox

Recommended Posts

Your own blocks or vannila blocks?

 

If your own blocks detect at the placing part the dimension id and when the id is not the overworldID (0) then you can tell that the block sets to 0 (equals as not there)

 

All blocks. If it was with my blocks it would be easy xD

Link to comment
Share on other sites

I never had think about that^^"

Hmmm thats hard. But i got an idea. Why dont you make an block which is in your dimemsion and search for all blocks from top to the bottom after special blockids.

 

like this:

 

public class TileEntityYourBlock extends TileEntity
{
     public void updateEntity()
     {

          for(int i = 0; i<=255; i++)
          {
                if(!getValidBlockID(i))
                {
                      world.setBlockWithNotify(xCoord, i, zCoord, 0);
                }

           }
     }


     public boolean getValidBlockID(int i)
     {
        int blockId = worldObj.getBlockID(xCoord, i, zCoord);
        if(blockId = Block.planks.blockID)
        {
             return true;
        }
       return false;
      }

}

 

So what this code does it checks (in a tileEntity) the world from the bottom to the hight.

And if there is a not valid BlockID then he set the blockID to 0. That the way i would do it when i have my own dimension^^ i hope that is what you want.

Link to comment
Share on other sites

I never had think about that^^"

Hmmm thats hard. But i got an idea. Why dont you make an block which is in your dimemsion and search for all blocks from top to the bottom after special blockids.

 

like this:

 

public class TileEntityYourBlock extends TileEntity
{
     public void updateEntity()
     {

          for(int i = 0; i<=255; i++)
          {
                if(!getValidBlockID(i))
                {
                      world.setBlockWithNotify(xCoord, i, zCoord, 0);
                }

           }
     }


     public boolean getValidBlockID(int i)
     {
        int blockId = worldObj.getBlockID(xCoord, i, zCoord);
        if(blockId = Block.planks.blockID)
        {
             return true;
        }
       return false;
      }

}

 

So what this code does it checks (in a tileEntity) the world from the bottom to the hight.

And if there is a not valid BlockID then he set the blockID to 0. That the way i would do it when i have my own dimension^^ i hope that is what you want.

 

That's sounds like a solution but I don't think that's the best one. But thanks anyway, I'm gonna try that out.

Btw,aren't those xCoord and zCoord always the same? That way it would only check the blocks above and below. And do a layer of only the blocks with this tile entity would be kinda stupid

Link to comment
Share on other sites

The aether team did it, I would use the same method used for the end/nether, maybe have the item blown up when it is clicked on, or maybe have it so that when the player tries to place down the block, that the games checks the block ID and if it is a vanilla block, then they can't place it (I think that is what you are saying, right?)

Link to comment
Share on other sites

The aether team did it, I would use the same method used for the end/nether, maybe have the item blown up when it is clicked on, or maybe have it so that when the player tries to place down the block, that the games checks the block ID and if it is a vanilla block, then they can't place it (I think that is what you are saying, right?)

 

To do that I think that I've to change the Block.java

Link to comment
Share on other sites

you could always use a block placed event (if it exists) and if it's the wrong block and the wrong dimension, then you can cancel it.

 

there's is one but only for the interaction with a block, I don't think that it works for the placement

Link to comment
Share on other sites

I never had think about that^^"

Hmmm thats hard. But i got an idea. Why dont you make an block which is in your dimemsion and search for all blocks from top to the bottom after special blockids.

 

like this:

 

public class TileEntityYourBlock extends TileEntity
{
     public void updateEntity()
     {

          for(int i = 0; i<=255; i++)
          {
                if(!getValidBlockID(i))
                {
                      world.setBlockWithNotify(xCoord, i, zCoord, 0);
                }

           }
     }


     public boolean getValidBlockID(int i)
     {
        int blockId = worldObj.getBlockID(xCoord, i, zCoord);
        if(blockId = Block.planks.blockID)
        {
             return true;
        }
       return false;
      }

}

 

So what this code does it checks (in a tileEntity) the world from the bottom to the hight.

And if there is a not valid BlockID then he set the blockID to 0. That the way i would do it when i have my own dimension^^ i hope that is what you want.

 

That's sounds like a solution but I don't think that's the best one. But thanks anyway, I'm gonna try that out.

Btw,aren't those xCoord and zCoord always the same? That way it would only check the blocks above and below. And do a layer of only the blocks with this tile entity would be kinda stupid

 

Why x and z coord are the same because badrock is the lowest Level and every block on the bottom are badrock^^

 

With that you can make a check it easy^^.

 

The other ways are good to but what is when a player find a way to jump over the place function?

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.