mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 23:02:04 -04:00
Only blocks of different types should be replaced by /paste.
This commit is contained in:
parent
c0be192333
commit
48c3b7cf94
@ -91,7 +91,6 @@ namespace MCGalaxy.Commands
|
||||
} else {
|
||||
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
|
||||
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
|
||||
|
||||
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
|
||||
{
|
||||
p.level.Blockchange(p, xx, yy, zz, blocks[xx + (zz * width) + (yy * width * height)]);
|
||||
|
@ -65,10 +65,8 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p)
|
||||
{
|
||||
public override void Help(Player p) {
|
||||
Player.SendMessage(p, "/TempRankInfo <player> - Lists the info of the Temporary rank of the given player");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,39 +44,45 @@ namespace MCGalaxy.Commands
|
||||
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
|
||||
RevertAndClearState(p, x, y, z);
|
||||
int offX = p.copyoffset[0] + x, offY = p.copyoffset[1] + y, offZ = p.copyoffset[2] + z;
|
||||
Player.UndoPos Pos1;
|
||||
CopyState state = p.CopyBuffer;
|
||||
if (state.X != state.OriginX) offX -= (state.Width - 1);
|
||||
if (state.Y != state.OriginY) offY -= (state.Height - 1);
|
||||
if (state.Z != state.OriginZ) offZ -= (state.Length - 1);
|
||||
int blocksChanged = 0;
|
||||
|
||||
if (p.level.bufferblocks && !p.level.Instant) {
|
||||
for (int i = 0; i < state.Blocks.Length; i++ ) {
|
||||
ushort locX, locY, locZ;
|
||||
byte b = state.Blocks[i];
|
||||
byte b = state.Blocks[i], extB = state.ExtBlocks[i];
|
||||
state.GetCoords(i, out locX, out locY, out locZ);
|
||||
|
||||
Pos1.x = (ushort)(locX + offX);
|
||||
Pos1.y = (ushort)(locY + offY);
|
||||
Pos1.z = (ushort)(locZ + offZ);
|
||||
if ((b != Block.air || p.copyAir) && p.level.InBound(Pos1.x, Pos1.y, Pos1.z))
|
||||
BlockQueue.Addblock(p, Pos1.x, Pos1.y, Pos1.z, b, state.ExtBlocks[i]);
|
||||
x = (ushort)(locX + offX); y = (ushort)(locY + offY); z = (ushort)(locZ + offZ);
|
||||
type = p.level.GetTile(x, y, z);
|
||||
if (type == Block.custom_block) extType = p.level.GetExtTile(x, y, z);
|
||||
|
||||
bool place = p.level.InBound(x, y, z) && (b != type || (b == Block.custom_block && extB != extType));
|
||||
if ((b != Block.air || p.copyAir) && place) {
|
||||
BlockQueue.Addblock(p, x, y, z, b, extB); blocksChanged++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < state.Blocks.Length; i++ ) {
|
||||
ushort locX, locY, locZ;
|
||||
byte b = state.Blocks[i];
|
||||
byte b = state.Blocks[i], extB = state.ExtBlocks[i];
|
||||
state.GetCoords(i, out locX, out locY, out locZ);
|
||||
|
||||
Pos1.x = (ushort)(locX + offX);
|
||||
Pos1.y = (ushort)(locY + offY);
|
||||
Pos1.z = (ushort)(locZ + offZ);
|
||||
if ((b != Block.air || p.copyAir) && p.level.InBound(Pos1.x, Pos1.y, Pos1.z))
|
||||
p.level.Blockchange(p, Pos1.x, Pos1.y, Pos1.z, b, state.ExtBlocks[i]);
|
||||
x = (ushort)(locX + offX); y = (ushort)(locY + offY); z = (ushort)(locZ + offZ);
|
||||
type = p.level.GetTile(x, y, z);
|
||||
if (type == Block.custom_block) extType = p.level.GetExtTile(x, y, z);
|
||||
|
||||
bool place = p.level.InBound(x, y, z) && (b != type || (b == Block.custom_block && extB != extType));
|
||||
if ((b != Block.air || p.copyAir) && place) {
|
||||
p.level.Blockchange(p, x, y, z, b, extB); blocksChanged++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Player.SendMessage(p, "Pasted " + p.CopyBuffer.Volume + " blocks.");
|
||||
Player.SendMessage(p, "Pasted " + p.CopyBuffer.Volume + " blocks, " + blocksChanged + " changed.");
|
||||
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user