Search in sources :

Example 1 with SPacketMaps

use of net.minecraft.network.play.server.SPacketMaps in project Magma by magmafoundation.

the class CraftPlayer method sendMap.

@Override
public void sendMap(MapView map) {
    if (getHandle().connection == null)
        return;
    RenderData data = ((CraftMapView) map).render(this);
    Collection<MapDecoration> icons = new ArrayList<>();
    for (MapCursor cursor : data.cursors) {
        if (cursor.isVisible()) {
            icons.add(new MapDecoration(MapDecoration.Type.byIcon(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection()));
        }
    }
    SPacketMaps packet = new SPacketMaps(map.getId(), map.getScale().getValue(), true, icons, data.buffer, 0, 0, 128, 128);
    getHandle().connection.sendPacket(packet);
}
Also used : SPacketMaps(net.minecraft.network.play.server.SPacketMaps) RenderData(org.bukkit.craftbukkit.v1_12_R1.map.RenderData) ArrayList(java.util.ArrayList) MapDecoration(net.minecraft.world.storage.MapDecoration) CraftMapView(org.bukkit.craftbukkit.v1_12_R1.map.CraftMapView) MapCursor(org.bukkit.map.MapCursor)

Example 2 with SPacketMaps

use of net.minecraft.network.play.server.SPacketMaps in project CumServerPro by MCUmbrella.

the class CraftPlayer method sendMap.

@Override
public void sendMap(MapView map) {
    if (getHandle().connection == null)
        return;
    RenderData data = ((CraftMapView) map).render(this);
    Collection<MapDecoration> icons = new ArrayList<>();
    for (MapCursor cursor : data.cursors) {
        if (cursor.isVisible()) {
            icons.add(new MapDecoration(MapDecoration.Type.byIcon(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection()));
        }
    }
    SPacketMaps packet = new SPacketMaps(map.getId(), map.getScale().getValue(), true, icons, data.buffer, 0, 0, 128, 128);
    getHandle().connection.sendPacket(packet);
}
Also used : SPacketMaps(net.minecraft.network.play.server.SPacketMaps) RenderData(org.bukkit.craftbukkit.map.RenderData) ArrayList(java.util.ArrayList) MapDecoration(net.minecraft.world.storage.MapDecoration) CraftMapView(org.bukkit.craftbukkit.map.CraftMapView) MapCursor(org.bukkit.map.MapCursor)

Aggregations

ArrayList (java.util.ArrayList)2 SPacketMaps (net.minecraft.network.play.server.SPacketMaps)2 MapDecoration (net.minecraft.world.storage.MapDecoration)2 MapCursor (org.bukkit.map.MapCursor)2 CraftMapView (org.bukkit.craftbukkit.map.CraftMapView)1 RenderData (org.bukkit.craftbukkit.map.RenderData)1 CraftMapView (org.bukkit.craftbukkit.v1_12_R1.map.CraftMapView)1 RenderData (org.bukkit.craftbukkit.v1_12_R1.map.RenderData)1