/pillar (height)

/pillar (height)

Postby Leeizazombie » 15 Jan 2014, 00:12

Kinda like /pillareraser but it actually makes a pillar, handy for creating towers, I've never tried making building commands but I'm sure if someone can make this command, it will help me get the idea ;)!
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /pillar (height)

Postby dzienny » 15 Jan 2014, 14:28

Drawing command example may help you understand how to make a drawing command. It hasn't been mentioned there, but to check the block at the given coordinates you can use:
Code: Select all
byte Level.GetTile(int x, int y, int z)

Then you can check the block type, or whether it is air.
Example:
Code: Select all
// Get a block from a player's current level at x, y, z coordinates.
byte block = p.level.GetTile(x, y, z);

// Block.IsAir(byte block) returns true if a block is air or op_air; false otherwise.
bool isAir = Block.IsAir(block);

// Check if block is a grass block.
bool isGrass = block == Block.grass;
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: /pillar (height)

Postby Leeizazombie » 21 Jan 2014, 23:50

Thank you Dzienny, it was helpful!
I was able to make it place a pillar at a set height but the problem is that I have to place two blocks to set the spot, I tried:
Code: Select all
BlockCatch.CaptureOneBlock(p, 2, DrawCuboid, new BasicDrawArgs(block));

No matter what arguments I use it keeps giving errors that the arguments are invalid, I have no idea how to make it capture one block only, can you show an example please?
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /pillar (height)

Postby ismellike » 22 Jan 2014, 02:44

I didn't truly familiarize myself with the new blockchange event, but I can give you some help with the old one.

Code: Select all
public override void use(Player p, string message)
{
   p.ClearBlockchange();
   p.Blockchange+=Blockchange;
}
public void Blockchange(Player p, ushort x, ushort y, ushort z, byte type)
{
   for(ushort height = y; height<=p.level.height-1; height++)
   {
       byte b = p.level.GetTile(x,height,z);
       //if checking for something {  }
       p.level.Blockchange(p,x,height,z,type);
   }
   if(!p.static)
     p.ClearBlockchange();
}


there is probably errors, but it should definitely help you
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /pillar (height)

Postby Leeizazombie » 22 Jan 2014, 04:09

Thank you, I'll take a look into it tomorrow!

ps: err sorry if I sent too many of the same post in Knowledge base, I tought it was not sending until I finally seen a message saying that moderators must see it first.
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /pillar (height)

Postby dzienny » 22 Jan 2014, 14:33

Leeizazombie wrote:Thank you Dzienny, it was helpful!
I was able to make it place a pillar at a set height but the problem is that I have to place two blocks to set the spot, I tried:
Code: Select all
BlockCatch.CaptureOneBlock(p, 2, DrawCuboid, new BasicDrawArgs(block));

No matter what arguments I use it keeps giving errors that the arguments are invalid, I have no idea how to make it capture one block only, can you show an example please?


The CaptureOneBlock method has a different signature. You can use
Code: Select all
BlockCatch.CaptureOneBlock(p, DrawPillar, new BasicDrawArgs(block));

or alternatively
Code: Select all
BlockCatch.CaptureMultipleBlocks(p, 1, DrawPillar, new BasicDrawArgs(block));

where 1 is the number of blocks to capture.

If you use the first option then your callback method has to be:
Code: Select all
void DrawPillar(Player p, ChangeInfo change, BasicDrawArgs args) { }

If you use CaptureMultipleBlocks then the callback method signature is:
Code: Select all
void DrawPillar(Player p, List<ChangeInfo> changes, BasicDrawArgs args) { }


Of course if you use CaptureMultipleBlocks with the argument of blocks to catch equal to 1, then the list of changes will contain exactly one element.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: /pillar (height)

Postby Leeizazombie » 22 Jan 2014, 15:02

Ah, I see what I done wrong, thanks for your help!
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /pillar (height)

Postby tommyz_ » 20 May 2014, 08:58

Hey man here ya go: viewtopic.php?f=19&t=2862
Made it for ya, the easy way! :D
tommyz_
 
Posts: 12
Joined: 17 May 2014, 02:46


Return to Requests for Addon

Who is online

Users browsing this forum: No registered users and 1 guest

cron