use of net.minecraft.network.play.server.SPacketSpawnPainting in project SpongeCommon by SpongePowered.
the class EntityUtil method refreshPainting.
public static boolean refreshPainting(EntityPainting painting, EntityPainting.EnumArt art) {
EntityPainting.EnumArt oldArt = painting.art;
painting.art = art;
painting.updateFacingWithBoundingBox(painting.facingDirection);
if (!painting.onValidSurface()) {
painting.art = oldArt;
painting.updateFacingWithBoundingBox(painting.facingDirection);
return false;
}
final EntityTracker paintingTracker = ((WorldServer) painting.world).getEntityTracker();
EntityTrackerEntry paintingEntry = paintingTracker.trackedEntityHashTable.lookup(painting.getEntityId());
List<EntityPlayerMP> playerMPs = new ArrayList<>();
for (EntityPlayerMP player : paintingEntry.trackingPlayers) {
SPacketDestroyEntities packet = new SPacketDestroyEntities(painting.getEntityId());
player.connection.sendPacket(packet);
playerMPs.add(player);
}
for (EntityPlayerMP playerMP : playerMPs) {
SpongeImpl.getGame().getScheduler().createTaskBuilder().delayTicks(SpongeImpl.getGlobalConfig().getConfig().getEntity().getPaintingRespawnDelaly()).execute(() -> {
final SPacketSpawnPainting packet = new SPacketSpawnPainting(painting);
playerMP.connection.sendPacket(packet);
}).submit(SpongeImpl.getPlugin());
}
return true;
}
Aggregations