- Баллы
- 96
Java:
public class FakePlayer {
private String name;
private Location loc;
private EntityPlayer fake;
private Player var1;
public FakePlayer(String name, Location location, Player accept) {
this.name = name;
this.loc = location;
this.var1 = accept;
MinecraftServer server = MinecraftServer.getServer();
WorldServer world = ((CraftWorld) loc.getWorld()).getHandle();
PlayerInteractManager manager = new PlayerInteractManager(world);
this.fake = new EntityPlayer(server, world, name, manager);
}
public void spawn() {
if (this.name == null || this.var1 == null || this.loc == null) {
return;
}
this.fake.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(this.fake);
((CraftPlayer) this.var1).getHandle().playerConnection.sendPacket(packet);
}
public Location getLocation() {
return this.loc;
}
public void a(Location loc) {
this.loc = loc;
}
public void despawn() {
if (this.name == null || this.var1 == null || this.loc == null) {
return;
}
Packet29DestroyEntity despawnPacket = new Packet29DestroyEntity(this.fake.id);
((CraftPlayer) this.var1).getHandle().playerConnection.sendPacket(despawnPacket);
}
public int getId() {
return this.fake.id;
}
}
Заранее спасибо.
Буду думать дальше, пытаться что - то с крафт плаером сделать