mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 20:53:40 -04:00
Fix /paste not working correctly when paste origin was outside the map.
This commit is contained in:
parent
d311ee34eb
commit
e7409d5301
@ -45,11 +45,11 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
|
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
|
||||||
CatchPos cpos = (CatchPos)p.blockchangeObject;
|
CatchPos cpos = (CatchPos)p.blockchangeObject;
|
||||||
RevertAndClearState(p, x, y, z);
|
RevertAndClearState(p, x, y, z);
|
||||||
int offX = p.copyoffset[0] + x, offY = p.copyoffset[1] + y, offZ = p.copyoffset[2] + z;
|
int x1 = p.copyoffset[0] + x, y1 = p.copyoffset[1] + y, z1 = p.copyoffset[2] + z;
|
||||||
CopyState state = p.CopyBuffer;
|
CopyState state = p.CopyBuffer;
|
||||||
if (state.X != state.OriginX) offX -= (state.Width - 1);
|
if (state.X != state.OriginX) x1 -= (state.Width - 1);
|
||||||
if (state.Y != state.OriginY) offY -= (state.Height - 1);
|
if (state.Y != state.OriginY) y1 -= (state.Height - 1);
|
||||||
if (state.Z != state.OriginZ) offZ -= (state.Length - 1);
|
if (state.Z != state.OriginZ) z1 -= (state.Length - 1);
|
||||||
|
|
||||||
DrawOp op;
|
DrawOp op;
|
||||||
if (cpos.message == "") {
|
if (cpos.message == "") {
|
||||||
@ -64,8 +64,8 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
else
|
else
|
||||||
((PasteDrawOp)op).Include = ReplaceBrush.GetBlocks(p, 0, args.Length, args);
|
((PasteDrawOp)op).Include = ReplaceBrush.GetBlocks(p, 0, args.Length, args);
|
||||||
}
|
}
|
||||||
|
Vec3S32[] marks = { new Vec3S32(x1, y1, z1) };
|
||||||
if (!DrawOp.DoDrawOp(op, null, p, (ushort)offX, (ushort)offY, (ushort)offZ, 0, 0, 0))
|
if (!DrawOp.DoDrawOp(op, null, p, marks))
|
||||||
return;
|
return;
|
||||||
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
|
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,17 @@ namespace MCGalaxy.Drawing.Ops {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
|
public override void Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush) {
|
||||||
Vec3U16 p1 = Clamp(marks[0]);
|
|
||||||
CopyState state = CopyState;
|
CopyState state = CopyState;
|
||||||
bool pasteAir = state.PasteAir;
|
bool pasteAir = state.PasteAir;
|
||||||
// Adjust for the fact that paste origin may be outside the map.
|
// Adjust for the fact that paste origin may be outside the map.
|
||||||
short offX = (short)p1.X, offY = (short)p1.Y, offZ = (short)p1.Z;
|
int x1 = marks[0].X, y1 = marks[0].Y, z1 = marks[0].Z;
|
||||||
|
|
||||||
for (int i = 0; i < state.Blocks.Length; i++ ) {
|
for (int i = 0; i < state.Blocks.Length; i++ ) {
|
||||||
ushort locX, locY, locZ;
|
ushort locX, locY, locZ;
|
||||||
byte b = state.Blocks[i], extB = state.ExtBlocks[i];
|
byte b = state.Blocks[i], extB = state.ExtBlocks[i];
|
||||||
state.GetCoords(i, out locX, out locY, out locZ);
|
state.GetCoords(i, out locX, out locY, out locZ);
|
||||||
|
|
||||||
ushort x = (ushort)(locX + offX), y = (ushort)(locY + offY), z = (ushort)(locZ + offZ);
|
ushort x = (ushort)(locX + x1), y = (ushort)(locY + y1), z = (ushort)(locZ + z1);
|
||||||
byte type = lvl.GetTile(x, y, z), extType = 0;
|
byte type = lvl.GetTile(x, y, z), extType = 0;
|
||||||
if (type == Block.custom_block) extType = lvl.GetExtTile(x, y, z);
|
if (type == Block.custom_block) extType = lvl.GetExtTile(x, y, z);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user