3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 20:10:06 +01:00
Dieser Commit ist enthalten in:
Jesse Boyd 2019-08-07 10:25:57 +10:00
Ursprung ee59dec3d8
Commit 3b879477b6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
5 geänderte Dateien mit 24 neuen und 52 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -338,7 +338,7 @@ public class SchematicCommands {
} }
if (other) { if (other) {
if (!actor.hasPermission("worldedit.schematic.delete.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; return;
} }
} }

Datei anzeigen

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

Datei anzeigen

@ -27,6 +27,7 @@ import com.boydti.fawe.object.changeset.FaweChangeSet;
import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.LightingExtent; import com.boydti.fawe.object.extent.LightingExtent;
import com.boydti.fawe.util.ExtentTraverser; import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer; import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
@ -165,6 +166,10 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
return extent.setBlock(x, y, z, block); 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

Datei anzeigen

@ -25,6 +25,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.jnbt.ByteTag; import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.jnbt.FloatTag; import com.sk89q.jnbt.FloatTag;
import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag; import com.sk89q.jnbt.ListTag;
@ -164,68 +165,34 @@ public class ExtentEntityCopy implements EntityFunction {
} }
} }
boolean changed = false;
// Handle hanging entities (paintings, item frames, etc.) // Handle hanging entities (paintings, item frames, etc.)
boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ"); boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ");
boolean hasFacing = tag.containsKey("Facing"); 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) { if (hasTilePosition) {
changed = true;
Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
values.put("TileX", new IntTag(newTilePosition.getBlockX())); CompoundTagBuilder builder = tag.createBuilder()
values.put("TileY", new IntTag(newTilePosition.getBlockY())); .putInt("TileX", newTilePosition.getBlockX())
values.put("TileZ", new IntTag(newTilePosition.getBlockZ())); .putInt("TileY", newTilePosition.getBlockY())
.putInt("TileZ", newTilePosition.getBlockZ());
if (hasDirection || hasLegacyDirection || hasFacing) { if (hasFacing) {
int d; boolean isPainting = state.getType() == EntityTypes.PAINTING; // Paintings have different facing values
if (hasDirection) { Direction direction = isPainting ? MCDirections.fromHorizontalHanging(tag.asInt("Facing")) : MCDirections.fromHanging(tag.asInt("Facing"));
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 (direction != null) { if (direction != null) {
Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize();
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL);
if (newDirection != null) { if (newDirection != null) {
byte hangingByte = (byte) MCDirections.toHanging(newDirection); builder.putByte("Facing", (byte) (isPainting ? MCDirections.toHorizontalHanging(newDirection) : 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))));
}
} }
} }
} }
ListTag rotation = tag.getListTag("Rotation"); return new BaseEntity(state.getType(), builder.build());
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);
} }
} }