Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Update for Spout entity changes
Dieser Commit ist enthalten in:
Ursprung
ef62a60fff
Commit
67178da4d3
@ -28,6 +28,7 @@ import org.spout.api.entity.Entity;
|
||||
import org.spout.api.geo.LoadOption;
|
||||
import org.spout.api.geo.World;
|
||||
import org.spout.api.geo.discrete.Point;
|
||||
import org.spout.api.math.QuaternionMath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@ -66,8 +67,7 @@ public class SpoutEntity extends LocalEntity {
|
||||
Entity e = world.createAndSpawnEntity(pos, mainComponent, LoadOption.LOAD_ONLY); // Blocks should already be pasted by time entitieos are brought in
|
||||
|
||||
if (e != null) {
|
||||
e.getTransform().setPitch(loc.getPitch());
|
||||
e.getTransform().setYaw(loc.getYaw());
|
||||
e.getScene().setRotation(QuaternionMath.rotation(loc.getPitch(), loc.getYaw(), 0));
|
||||
for (Class<? extends Component> clazz : Iterables.skip(components, 1)) {
|
||||
e.add(clazz);
|
||||
}
|
||||
|
@ -31,10 +31,12 @@ import com.sk89q.worldedit.cui.CUIEvent;
|
||||
|
||||
import org.spout.api.Client;
|
||||
import org.spout.api.chat.style.ChatStyle;
|
||||
import org.spout.api.component.impl.TransformComponent;
|
||||
import org.spout.api.component.impl.SceneComponent;
|
||||
import org.spout.api.geo.discrete.Point;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.entity.Player;
|
||||
import org.spout.api.math.QuaternionMath;
|
||||
import org.spout.api.math.Vector3;
|
||||
import org.spout.vanilla.api.inventory.Slot;
|
||||
import org.spout.vanilla.plugin.component.inventory.PlayerInventory;
|
||||
import org.spout.vanilla.plugin.component.living.neutral.Human;
|
||||
@ -72,19 +74,19 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
|
||||
@Override
|
||||
public WorldVector getPosition() {
|
||||
Point loc = player.getTransform().getPosition();
|
||||
Point loc = player.getScene().getPosition();
|
||||
return new WorldVector(SpoutUtil.getLocalWorld(loc.getWorld()),
|
||||
loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPitch() {
|
||||
return player.getTransform().getPitch();
|
||||
return player.getScene().getRotation().getYaw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getYaw() {
|
||||
return player.getTransform().getYaw();
|
||||
return player.getScene().getRotation().getYaw();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,10 +126,9 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||
TransformComponent component = player.getTransform();
|
||||
SceneComponent component = player.getScene();
|
||||
player.teleport(SpoutUtil.toPoint(player.getWorld(), pos));
|
||||
component.setPitch(pitch);
|
||||
component.setYaw(yaw);
|
||||
component.setRotation(QuaternionMath.rotation(pitch, yaw, component.getRotation().getRoll()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,7 @@ import org.spout.api.geo.World;
|
||||
import org.spout.api.geo.cuboid.Block;
|
||||
import org.spout.api.geo.discrete.Point;
|
||||
import org.spout.api.material.block.BlockFace;
|
||||
import org.spout.api.math.MathHelper;
|
||||
import org.spout.api.math.GenericMath;
|
||||
import org.spout.api.math.Vector3;
|
||||
import org.spout.api.entity.Player;
|
||||
|
||||
@ -91,9 +91,9 @@ public class SpoutUtil {
|
||||
public static Point center(Point loc) {
|
||||
return new Point(
|
||||
loc.getWorld(),
|
||||
MathHelper.floor(loc.getX()) + 0.5F,
|
||||
MathHelper.floor(loc.getY()) + 0.5F,
|
||||
MathHelper.floor(loc.getZ()) + 0.5F
|
||||
GenericMath.floor(loc.getX()) + 0.5F,
|
||||
GenericMath.floor(loc.getY()) + 0.5F,
|
||||
GenericMath.floor(loc.getZ()) + 0.5F
|
||||
);
|
||||
}
|
||||
|
||||
@ -110,6 +110,7 @@ public class SpoutUtil {
|
||||
}
|
||||
|
||||
public static Location toLocation(Entity ent) {
|
||||
return new Location(getLocalWorld(ent.getWorld()), toVector(ent.getTransform().getPosition()), ent.getTransform().getYaw(), ent.getTransform().getPitch());
|
||||
return new Location(getLocalWorld(ent.getWorld()), toVector(ent.getScene().getPosition()),
|
||||
ent.getScene().getRotation().getYaw(), ent.getScene().getRotation().getPitch());
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ package com.sk89q.worldedit.spout;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.BiomeType;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -41,7 +39,6 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import org.spout.api.component.Component;
|
||||
import org.spout.api.entity.Entity;
|
||||
import org.spout.api.event.cause.PluginCause;
|
||||
import org.spout.api.generator.biome.BiomeGenerator;
|
||||
import org.spout.api.geo.LoadOption;
|
||||
import org.spout.api.geo.World;
|
||||
@ -49,19 +46,17 @@ import org.spout.api.geo.cuboid.Chunk;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.BlockMaterial;
|
||||
import org.spout.api.material.Material;
|
||||
import org.spout.api.math.Vector3;
|
||||
import org.spout.vanilla.plugin.component.substance.Item;
|
||||
import org.spout.vanilla.plugin.component.substance.Painting;
|
||||
import org.spout.vanilla.plugin.component.substance.XPOrb;
|
||||
import org.spout.vanilla.plugin.component.substance.object.Item;
|
||||
import org.spout.vanilla.plugin.component.substance.object.Tnt;
|
||||
import org.spout.vanilla.plugin.component.substance.object.projectile.Arrow;
|
||||
import org.spout.vanilla.plugin.component.substance.object.vehicle.Boat;
|
||||
import org.spout.vanilla.plugin.component.substance.object.vehicle.Minecart;
|
||||
import org.spout.vanilla.api.material.VanillaMaterial;
|
||||
import org.spout.vanilla.plugin.component.substance.object.vehicle.minecart.Minecart;
|
||||
import org.spout.vanilla.plugin.material.VanillaMaterials;
|
||||
import org.spout.vanilla.plugin.world.generator.normal.object.tree.TreeObject;
|
||||
import org.spout.vanilla.plugin.world.generator.normal.object.tree.SmallTreeObject;
|
||||
import org.spout.vanilla.plugin.world.generator.object.VanillaObjects;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@ -561,7 +556,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
|
||||
for (Entity ent : world.getAll()) {
|
||||
if (radius != -1
|
||||
&& origin.distanceSq(SpoutUtil.toVector(ent.getTransform().getPosition())) > radiusSq) {
|
||||
&& origin.distanceSq(SpoutUtil.toVector(ent.getScene().getPosition())) > radiusSq) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -805,7 +800,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
continue;
|
||||
}
|
||||
for (Entity ent : chunk.getEntities()) {
|
||||
if (region.contains(SpoutUtil.toVector(ent.getTransform().getPosition()))) {
|
||||
if (region.contains(SpoutUtil.toVector(ent.getScene().getPosition()))) {
|
||||
Collection<Class<? extends Component>> revisedComponents = Collections2.transform(ent.values(), new Function<Component, Class<? extends Component>>() {
|
||||
@Override
|
||||
public Class<? extends Component> apply(@Nullable Component component) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren