Fix rotation

fixes rotation for signs, banners and nbt data
This commit is contained in:
Jesse Boyd 2016-10-24 22:22:55 +11:00
parent f13c01a177
commit 3c371d2eb1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 37 additions and 4 deletions

View File

@ -78,11 +78,19 @@ public class BlockTransformExtent extends AbstractDelegateExtent {
}
private final BaseBlock transformFast(BaseBlock block) {
return BLOCK_TRANSFORM[FaweCache.getCombined(block)];
BaseBlock newBlock = BLOCK_TRANSFORM[FaweCache.getCombined(block)];
if (block.hasNbtData()) {
newBlock.setNbtData(block.getNbtData());
}
return newBlock;
}
private final BaseBlock transformFastInverse(BaseBlock block) {
return BLOCK_TRANSFORM_INVERSE[FaweCache.getCombined(block)];
BaseBlock newBlock = BLOCK_TRANSFORM_INVERSE[FaweCache.getCombined(block)];
if (block.hasNbtData()) {
newBlock.setNbtData(block.getNbtData());
}
return newBlock;
}
/**

View File

@ -21,7 +21,6 @@ package com.sk89q.worldedit.session;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
@ -97,7 +96,6 @@ public class PasteBuilder {
extent = new BlockTransformExtent(extent, transform, targetWorldData.getBlockRegistry());
}
ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to);
System.out.println(clipboard.getRegion());
copy.setTransform(transform);
if (ignoreAirBlocks) {
copy.setSourceMask(new ExistingBlockMask(clipboard));

View File

@ -114,6 +114,33 @@ public class BundledBlockData {
if (bot != null && bot.getDirection() == null) {
bot.setDirection(new Vector(0, -1, 0));
}
} else {
FaweState dir = entry.states.get("rotation");
if (dir != null && dir.values != null) {
Vector[] dirs = new Vector[]{new Vector(0, 0, -1),
new Vector(0.5, 0, -1),
new Vector(1, 0, -1),
new Vector(1, 0, -0.5),
new Vector(1, 0, 0),
new Vector(1, 0, 0.5),
new Vector(1, 0, 1),
new Vector(0.5, 0, 1),
new Vector(0, 0, 1),
new Vector(-0.5, 0, 1),
new Vector(-1, 0, 1),
new Vector(-1, 0, 0.5),
new Vector(-1, 0, 0),
new Vector(-1, 0, -0.5),
new Vector(-1, 0, -1),
new Vector(-0.5, 0, -1)};
int len = dir.values.size();
int increment = 16 / len;
int index = 0;
for (Map.Entry<String, FaweStateValue> valuesEntry : dir.values.entrySet()) {
valuesEntry.getValue().setDirection(dirs[index]);
index += increment;
}
}
}
}