use of thpmc.engine.api.nms.INMSHandler in project THP-Engine by TheHollowPlanetMC.
the class PacketHandler method channelRead.
@Override
public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {
INMSHandler nmsHandler = NMSManager.getNMSHandler();
if (nmsHandler.isFlyPacket(packet)) {
super.channelRead(channelHandlerContext, NMSManager.getFlyPacketHandler().rewrite(packet, EnginePlayer, ImplTHPESettings.isUseCachedChunkPacket()));
return;
}
super.channelRead(channelHandlerContext, packet);
}
use of thpmc.engine.api.nms.INMSHandler in project THP-Engine by TheHollowPlanetMC.
the class EnginePlayerEntity method hide.
@Override
public void hide(EnginePlayer player) {
INMSHandler nmsHandler = THPEngineAPI.getInstance().getNMSHandler();
Player bukkitPlayer = player.getBukkitPlayer();
nmsHandler.sendPacket(bukkitPlayer, nmsHandler.createPlayerInfoPacket(nmsEntity, WrappedPlayerInfoAction.REMOVE_PLAYER));
nmsHandler.sendPacket(bukkitPlayer, nmsHandler.createEntityDestroyPacket(nmsEntity));
}
use of thpmc.engine.api.nms.INMSHandler in project THP-Engine by TheHollowPlanetMC.
the class EnginePlayerEntity method playTickResult.
@Override
public void playTickResult(EnginePlayer player, boolean absolute) {
INMSHandler nmsHandler = THPEngineAPI.getInstance().getNMSHandler();
Player bukkitPlayer = player.getBukkitPlayer();
nmsHandler.sendPacket(bukkitPlayer, nmsHandler.createHeadRotationPacket(nmsEntity, yaw));
if (absolute) {
nmsHandler.sendPacket(bukkitPlayer, nmsHandler.createTeleportPacket(nmsEntity));
} else {
nmsHandler.sendPacket(bukkitPlayer, nmsHandler.createRelEntityMoveLookPacket(nmsEntity, x - previousX, y - previousY, z - previousZ, yaw, pitch));
}
}
use of thpmc.engine.api.nms.INMSHandler in project THP-Engine by TheHollowPlanetMC.
the class ImplParallelChunk method sendUpdate.
@Override
public void sendUpdate(Player player) {
INMSHandler nmsHandler = NMSManager.getNMSHandler();
nmsHandler.sendChunkMultiBlockChangeUpdatePacket(player, this);
TaskHandler.runSync(() -> {
World world = Bukkit.getWorld(getWorld().getName());
if (world == null)
return;
TaskHandler.runWorldSync(world, () -> {
Object lightUpdatePacket = nmsHandler.createLightUpdatePacketAtPrimaryThread(this);
if (lightUpdatePacket != null)
nmsHandler.sendPacket(player, lightUpdatePacket);
});
});
}
use of thpmc.engine.api.nms.INMSHandler in project THP-Engine by TheHollowPlanetMC.
the class ImplParallelWorld method sendMultiBlockUpdate.
@Override
public void sendMultiBlockUpdate(Set<BlockPosition3i> blocks) {
INMSHandler nmsHandler = NMSManager.getNMSHandler();
Set<Object> packets = nmsHandler.createMultiBlockChangePacket(this, blocks);
for (Object packet : packets) {
parallelUniverse.getResidents().forEach(player -> {
if (worldName.equals(player.getBukkitPlayer().getWorld().getName()))
nmsHandler.sendPacket(player.getBukkitPlayer(), packet);
});
}
}
Aggregations