13
0
Fix Motion
Dieser Commit ist enthalten in:
jojo 2020-08-22 18:44:11 +02:00
Ursprung d5910ea7b2
Commit 727d7c6b6e
2 geänderte Dateien mit 28 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -8,9 +8,7 @@ import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_15_R1.Block; import net.minecraft.server.v1_15_R1.Block;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
import java.io.EOFException; import java.io.EOFException;
@ -123,6 +121,25 @@ class PacketProcessor {
}); });
} }
private void sound() throws IOException {
double x = source.rDouble();
double y = source.rDouble();
double z = source.rDouble();
String soundName = source.rString();
String soundCategory = source.rString();
float volume = source.rFloat();
float pitch = source.rFloat();
Sound sound = Sound.valueOf(soundName);
SoundCategory sCategory = SoundCategory.valueOf(soundCategory);
Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
world.playSound(new Location(world, x, y, z), sound, sCategory, volume, pitch);
});
}
private void process(){ private void process(){
try{ try{
while(!source.isClosed()){ while(!source.isClosed()){
@ -154,6 +171,9 @@ class PacketProcessor {
case 0x31: case 0x31:
particle(); particle();
break; break;
case 0x32:
sound();
break;
case (byte) 0xA0: case (byte) 0xA0:
send(ChatMessageType.CHAT); send(ChatMessageType.CHAT);
break; break;

Datei anzeigen

@ -76,6 +76,11 @@ public abstract class REntity {
public void setMotion(double dX, double dY, double dZ) { public void setMotion(double dX, double dY, double dZ) {
entity.setMot(dX, dY, dZ); entity.setMot(dX, dY, dZ);
PacketPlayOutEntityVelocity packet = new PacketPlayOutEntityVelocity(entity);
for(Player player : Bukkit.getOnlinePlayers()){
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
connection.sendPacket(packet);
}
} }
private void sendToPlayer(Player player){ private void sendToPlayer(Player player){