more compiling

This commit is contained in:
Jesse Boyd 2019-08-07 10:25:57 +10:00
parent ee59dec3d8
commit 3b879477b6
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 24 additions and 52 deletions

View File

@ -52,7 +52,7 @@ public class CompoundTag extends Tag {
}
@Override
public final Map<String, Tag> getValue() {
public Map<String, Tag> getValue() {
return value;
}

View File

@ -338,7 +338,7 @@ public class SchematicCommands {
}
if (other) {
if (!actor.hasPermission("worldedit.schematic.delete.other")) {
BBC.NO_PERM.send(player, "worldedit.schematic.delete.other");
BBC.NO_PERM.send(actor, "worldedit.schematic.delete.other");
return;
}
}

View File

@ -61,7 +61,7 @@ public class DelegateCommandManager implements CommandManager {
}
@Override
public int execute(InjectedValueAccess context, List<String> args) {
public Object execute(InjectedValueAccess context, List<String> args) {
return parent.execute(context, args);
}

View File

@ -27,6 +27,7 @@ import com.boydti.fawe.object.changeset.FaweChangeSet;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.LightingExtent;
import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
import com.sk89q.worldedit.function.operation.Operation;
@ -165,10 +166,14 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
return extent.setBlock(x, y, z, block);
}
@Override
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile));
}
/*
Light
*/
Light
*/
public int getSkyLight(int x, int y, int z) {
if (extent instanceof LightingExtent) {
return ((LightingExtent) extent).getSkyLight(x, y, z);

View File

@ -25,6 +25,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.jnbt.FloatTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag;
@ -156,76 +157,42 @@ public class ExtentEntityCopy implements EntityFunction {
BlockVector3 newLeash = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
return new BaseEntity(state.getType(), tag.createBuilder()
.put("Leash", leashCompound.createBuilder()
.putInt("X", newLeash.getBlockX())
.putInt("Y", newLeash.getBlockY())
.putInt("Z", newLeash.getBlockZ())
.build()
.putInt("X", newLeash.getBlockX())
.putInt("Y", newLeash.getBlockY())
.putInt("Z", newLeash.getBlockZ())
.build()
).build());
}
}
boolean changed = false;
// Handle hanging entities (paintings, item frames, etc.)
boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ");
boolean hasFacing = tag.containsKey("Facing");
tag = tag.createBuilder().build();
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
boolean hasDirection = tag.containsKey("Direction");
boolean hasLegacyDirection = tag.containsKey("Dir");
if (hasTilePosition) {
changed = true;
Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
values.put("TileX", new IntTag(newTilePosition.getBlockX()));
values.put("TileY", new IntTag(newTilePosition.getBlockY()));
values.put("TileZ", new IntTag(newTilePosition.getBlockZ()));
CompoundTagBuilder builder = tag.createBuilder()
.putInt("TileX", newTilePosition.getBlockX())
.putInt("TileY", newTilePosition.getBlockY())
.putInt("TileZ", newTilePosition.getBlockZ());
if (hasDirection || hasLegacyDirection || hasFacing) {
int d;
if (hasDirection) {
d = tag.asInt("Direction");
} else if (hasLegacyDirection) {
d = MCDirections.fromLegacyHanging((byte) tag.asInt("Dir"));
} else {
d = tag.asInt("Facing");
}
Direction direction = MCDirections.fromHanging(d);
if (hasFacing) {
boolean isPainting = state.getType() == EntityTypes.PAINTING; // Paintings have different facing values
Direction direction = isPainting ? MCDirections.fromHorizontalHanging(tag.asInt("Facing")) : MCDirections.fromHanging(tag.asInt("Facing"));
if (direction != null) {
Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize();
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL);
if (newDirection != null) {
byte hangingByte = (byte) MCDirections.toHanging(newDirection);
values.put("Direction", new ByteTag(hangingByte));
values.put("Facing", new ByteTag(hangingByte));
values.put("Dir", new ByteTag(MCDirections.toLegacyHanging(MCDirections.toHanging(newDirection))));
builder.putByte("Facing", (byte) (isPainting ? MCDirections.toHorizontalHanging(newDirection) : MCDirections.toHanging(newDirection)));
}
}
}
}
ListTag rotation = tag.getListTag("Rotation");
if (rotation != null && rotation.getValue().size() >= 2) {
changed = true;
double yaw = Math.toRadians(rotation.getFloat(0));
double pitch = Math.toRadians(rotation.getFloat(1));
double xz = Math.cos(pitch);
Vector3 direction = Vector3.at(-xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw));
direction = transform.apply(direction);
FloatTag yawTag = new FloatTag((float) direction.toYaw());
FloatTag pitchTag = new FloatTag((float) direction.toPitch());
values.put("Rotation", new ListTag(FloatTag.class, Arrays.asList(yawTag, pitchTag)));
}
if (changed) {
return new BaseEntity(state.getType(), tag);
return new BaseEntity(state.getType(), builder.build());
}
}