Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 08:10:11 +01:00
Added JavaEntityDestoryTranslator and JavaSpawnExpOrbTranslator
Dieser Commit ist enthalten in:
Ursprung
2a07e05877
Commit
39bc9baf16
@ -28,10 +28,8 @@ package org.geysermc.connector.network.translators;
|
|||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.*;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
||||||
import com.nukkitx.nbt.CompoundTagBuilder;
|
import com.nukkitx.nbt.CompoundTagBuilder;
|
||||||
@ -45,14 +43,12 @@ import org.geysermc.connector.network.translators.bedrock.BedrockAnimateTranslat
|
|||||||
import org.geysermc.connector.network.translators.bedrock.BedrockCommandRequestTranslator;
|
import org.geysermc.connector.network.translators.bedrock.BedrockCommandRequestTranslator;
|
||||||
import org.geysermc.connector.network.translators.bedrock.BedrockTextTranslator;
|
import org.geysermc.connector.network.translators.bedrock.BedrockTextTranslator;
|
||||||
import org.geysermc.connector.network.translators.java.JavaChatTranslator;
|
import org.geysermc.connector.network.translators.java.JavaChatTranslator;
|
||||||
import org.geysermc.connector.network.translators.java.JavaEntityPositionRotationTranslator;
|
import org.geysermc.connector.network.translators.java.entity.*;
|
||||||
import org.geysermc.connector.network.translators.java.JavaEntityPositionTranslator;
|
|
||||||
import org.geysermc.connector.network.translators.java.JavaEntityTeleportTranslator;
|
|
||||||
import org.geysermc.connector.network.translators.java.JavaEntityVelocityTranslator;
|
|
||||||
import org.geysermc.connector.network.translators.java.JavaJoinGameTranslator;
|
import org.geysermc.connector.network.translators.java.JavaJoinGameTranslator;
|
||||||
import org.geysermc.connector.network.translators.java.JavaNotifyClientTranslator;
|
import org.geysermc.connector.network.translators.java.entity.spawn.JavaSpawnExpOrbTranslator;
|
||||||
|
import org.geysermc.connector.network.translators.java.world.JavaNotifyClientTranslator;
|
||||||
import org.geysermc.connector.network.translators.java.JavaTitleTranslator;
|
import org.geysermc.connector.network.translators.java.JavaTitleTranslator;
|
||||||
import org.geysermc.connector.network.translators.java.JavaUpdateTimeTranslator;
|
import org.geysermc.connector.network.translators.java.world.JavaUpdateTimeTranslator;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -86,6 +82,8 @@ public class TranslatorsInit {
|
|||||||
Registry.registerJava(ServerEntityTeleportPacket.class, new JavaEntityTeleportTranslator());
|
Registry.registerJava(ServerEntityTeleportPacket.class, new JavaEntityTeleportTranslator());
|
||||||
Registry.registerJava(ServerEntityVelocityPacket.class, new JavaEntityVelocityTranslator());
|
Registry.registerJava(ServerEntityVelocityPacket.class, new JavaEntityVelocityTranslator());
|
||||||
Registry.registerJava(ServerNotifyClientPacket.class, new JavaNotifyClientTranslator());
|
Registry.registerJava(ServerNotifyClientPacket.class, new JavaNotifyClientTranslator());
|
||||||
|
Registry.registerJava(ServerEntityDestroyPacket.class, new JavaEntityDestroyTranslator());
|
||||||
|
Registry.registerJava(ServerSpawnExpOrbPacket.class, new JavaSpawnExpOrbTranslator());
|
||||||
|
|
||||||
Registry.registerBedrock(AnimatePacket.class, new BedrockAnimateTranslator());
|
Registry.registerBedrock(AnimatePacket.class, new BedrockAnimateTranslator());
|
||||||
Registry.registerBedrock(CommandRequestPacket.class, new BedrockCommandRequestTranslator());
|
Registry.registerBedrock(CommandRequestPacket.class, new BedrockCommandRequestTranslator());
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 GeyserMC. http://geysermc.org
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* @author GeyserMC
|
||||||
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geysermc.connector.network.translators.java.entity;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityDestroyPacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
|
|
||||||
|
public class JavaEntityDestroyTranslator extends PacketTranslator<ServerEntityDestroyPacket> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void translate(ServerEntityDestroyPacket packet, GeyserSession session) {
|
||||||
|
for (int entityId : packet.getEntityIds()) {
|
||||||
|
RemoveEntityPacket removeEntityPacket = new RemoveEntityPacket();
|
||||||
|
removeEntityPacket.setUniqueEntityId(entityId);
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(removeEntityPacket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.geysermc.connector.network.translators.java.entity.spawn;
|
||||||
|
|
||||||
|
import com.flowpowered.math.vector.Vector3f;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.SpawnExperienceOrbPacket;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
|
|
||||||
|
public class JavaSpawnExpOrbTranslator extends PacketTranslator<ServerSpawnExpOrbPacket> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void translate(ServerSpawnExpOrbPacket packet, GeyserSession session) {
|
||||||
|
SpawnExperienceOrbPacket spawnExperienceOrbPacket = new SpawnExperienceOrbPacket();
|
||||||
|
spawnExperienceOrbPacket.setPosition(new Vector3f(packet.getX(), packet.getY(), packet.getZ()));
|
||||||
|
spawnExperienceOrbPacket.setAmount(packet.getExp());
|
||||||
|
|
||||||
|
session.getUpstream().sendPacket(spawnExperienceOrbPacket);
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren